Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Although it may appear a huge challenge to turn a model engine code (the computational heart of a model) into an OpenMI-compliant linkable component, it may not be as difficult as it seems. The OpenMI Software Development Kit (SDK) provides a large number of software utilities that make migration easier. These utilities can be used by anyone migrating a model but are not required in order to comply with the OpenMI standard. The utilities can be used as a whole or you can select only a few of them; alternatively, you can use the utilities as the basis for your own implementations. This article assumes that you will use the OpenMI SDK to the full extent. Step-by-step instructions are given for the whole migration process, from defining the requirements for an OpenMI omponentcomponent, through design and implementation to testing. This section describes the requirements for OpenMI-compliance and introduces the Simple River model, which is used to illustrate the migration process.

...

Code Block
using System;
using Oatc.OpenMI.Examples.ModelComponents.SimpleRiver.Wrapper;
using NUnit.Framework;
namespace org.OpenMITest.Examples.ModelComponents.SimpleRiver.Wrapper
{
   [TestFixture]
   public class SimpleRiverEngineDotNetAccessTest
   {
      [Test]
      public void GetModelID()
      {
         SimpleRiverEngineDotNetAccess _simpleRiverEngineDotNetAccess;
         String _filePath;
        _simpleRiverEngineDotNetAccess = new SimpleRiverEngineDotNetAccess();
        _filePath = 'C:\\SimpleRiver\\UnitTest\\Data\\Rhine';
        _simpleRiverEngineDotNetAccess.Initialize(_filePath);
        Assert.AreEqual('The river Rhine',
        _simpleRiverEngineDotNetAccess.GetModelID());
        _simpleRiverEngineDotNetAccess.Finish();
      }  
   }
}


Fig. 19. NUnit Userinterface with Simple River wrapper classes loaded

...

The structure of the OMI file is defined in OpenMI.Standared.LinkableComponent.XSD. (http://www.openmi.org/schemas/LinkableComponent.xsdImage Removed) Figure 21 provides a visual representation of the schema definition; The XML listing below provides an example of an OMI file.

...

OpenMI compliant components must be associated with an OpenMI compliance info file. This file useful information for people that are planning to use the component in an OpenMI configuration. The OpenMI compliance info file must comply to the schema OpenMICompliancyInfo.xsd ((http://www.openmi.org/schemas/OpenMICompliancyInfo.xsdImage Removed)).


The openmi compliance xml file for the Simple River is shown below:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2006 rel. 3 sp1 (http://www.altova.com)-->
<OpenMICompliancyInfo xmlns="http://www.openmi.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openmi.org/schemas/OpenMICompliancyInfo.xsd">
	<generalSoftwareInfo>
		<component name="SimpleRiver" version="1.4.0.0">
			<description>Fortran wrapping sample</description>
			<url>wiki.OpenMI.org/Oatc.OpenMI.Examples.ModelComponents.SimpleRiver</url>
		</component>
		<contactInfo>
			<supplierName>OATC (OpenMI Association Technical Committee)</supplierName>
			<contactPerson>Jan Borge Gregersen</contactPerson>
			<supplierEmail>association@openmi.org</supplierEmail>
		</contactInfo>
		<availability component="free" source="available">
			<comment>Available as part of OATC Software Development Kit</comment>
		</availability>
	</generalSoftwareInfo>
	<supportForOpenMI>
		<compliancy>
			<technology>dotNet</technology>
			<openMIStandardVersion>1.4.0.0</openMIStandardVersion>
		</compliancy>
		<exchangeItems>
			<dataOperations setId="spatial/time/buffering">
				<dataOperation>Nearest XYPolyLine to XYPoint</dataOperation>
				<dataOperation>Inverse XYPolyLine to XYPoint</dataOperation>
				<dataOperation>Weighted Mean XYPolyLine to XYPolyGon</dataOperation>
				<dataOperation>Weighted Sum XYPolyLine to XYPolyGon</dataOperation>
				<dataOperation>LinearConversion</dataOperation>
				<dataOperation>Buffering and temporal extrapolation</dataOperation>
			</dataOperations>
			<inputExchangeItem>
				<quantity>
					<description>Flow</description>
					<dimension lenght="3" time="-1"/>
				</quantity>
				<elementSet elementType="IDBased">
					<description>An ElementSet for each branch. Each ElementSet is identified by 'branch-N', where N is the branch number.</description>
				</elementSet>
			</inputExchangeItem>
			<outputExchangeItem>
				<quantity>
					<description>Outflow</description>
					<dimension lenght="3" time="-1"/>
				</quantity>
				<elementSet elementType="XYPolyLine">
					<description>An ElementSet with one element (line segment) for each branch, or an ElementSet with an element for each branch.</description>
				</elementSet>
				<dataOperations>spatial/time/buffering</dataOperations>
			</outputExchangeItem>
			<outputExchangeItem>
				<quantity>
					<description>Outflow</description>
					<dimension lenght="3" time="-1"/>
				</quantity>
				<elementSet elementType="XYPolyLine">
					<description>An ElementSet with one element (line segment) for each branch, or an ElementSet with an element for each branch.</description>
				</elementSet>
				<dataOperation>LinearConversion</dataOperation>
				<dataOperation>Buffering and temporal extrapolation</dataOperation>
			</outputExchangeItem>
			<inputExchangeItem>
				<quantity>
					<description>Flow</description>
					<dimension lenght="3" time="-1"/>
				</quantity>
				<elementSet elementType="XYPolyLine">
					<description>An ElementSet with one element (line segment) for each branch, or an ElementSet with an element for each branch.</description>
				</elementSet>
			</inputExchangeItem>
		</exchangeItems>
		<optionalInterfaces>
			<IManageState isSupported="false">
				<comment>Not implemented for this simple river example</comment>
			</IManageState>
			<IDiscreteTimes isSupported="false"/>
		</optionalInterfaces>
	</supportForOpenMI>
</OpenMICompliancyInfo>