The upwards compatible wrapper is intended for those who does not have the time to migrate their 1.4 IEngine compatible engine using the LinkableEngine. The UpwardsCompatible namespace contains a version of the IEngine that requires only minor modifications to the original engine source code.

Instead of using the 1.4 IEngine, its dependant standard, wrapper and backbone, then you can use the UpwardsCompatible IEngine with its version of the standard, wrapper and backbone. The upwards compatible version implements all required functionality of the 2.0 ILinkableEngine.

Quantities

The biggest difference in the source code stems from the difference in the quantity, which in 1.4 itself contains as well the unit as the dimension

while in 2.0 the quantity contains a unit, which then again contains the quantity:

The source code in 1.4 changes from

Dimension flowDimension = new Dimension();
Unit literPrSecUnit = new Unit("LiterPrSecond",0.001,0,"Liters pr Second");
Quantity flowQuantity = new Quantity(literPrSecUnit, "Flow", "Flow", global::OpenMI.Standard.ValueType.Scalar, flowDimension);

to

Dimension flowDimension = new Dimension();
Unit literPrSecUnit = new Unit("LiterPrSecond", 0.001, 0, "Liters pr Second");
literPrSecUnit.Dimension = flowDimension;
Quantity flowQuantity = new Quantity(literPrSecUnit, "Flow", "Flow");
flowQuantity.ValueType = typeof(double);
References

The tricky part of using the upwards compatible wrapper is to get the references correct. All references to 1.4 should be removed and replaces with upwards compatible version, and also some of the 2.0 references.

In 1.4 the following references:

using OpenMI.Standard;
using Oatc.OpenMI.Sdk.Backbone;
using Oatc.OpenMI.Sdk.Wrapper;

is to be replaced with 2.0 versions:

using OpenMI.Standard;
using Oatc.OpenMI.Sdk.Backbone;
using Oatc.UpwardsComp.Backbone;
using Oatc.UpwardsComp.Standard;
using ITime = Oatc.UpwardsComp.Standard.ITime;
Other minor changes

Time helper functions has been improved, 1.4 source code:

TimeStamp startTime = new TimeStamp(Oatc.OpenMI.Sdk.DevelopmentSupport.CalendarConverter.Gregorian2ModifiedJulian(_simulationStart));

2.0 source code:

TimeStamp startTime = new TimeStamp(Time.ToModifiedJulianDay(_simulationStart));

Id's have changed from ID to Id, for example the IElementSet.GetElementID is now IElementSet.GetElementId.

  • No labels