5.4 Implementing the GetValues method
The source code for the IEngine GetValues implementation is shown below.
Code Block |
---|
public org//From Class: Oatc.OpenMI.Examples.ModelComponents.SimpleRiver.Wrapper.SimpleRiverEngineWrapper : Oatc.OpenMI.Standard.Sdk.Wrapper.IEngine public IValueSet GetValues(string QuantityID, string ElementSetID) { double\[\ { double[] returnValues; Char\[\ Char[] separator = new char\[\]{':'}; if (QuantityID == '"Flow') { ") { int index = Convert.ToInt32((ElementSetID.Split(separator))\[1\]); returnValues = new double\[1\]; returnValues\ returnValues[0\] = \_simpleRiverEngine.GetFlow(index); } else { } else { throw new Exception('"Illegal QuantityID in GetValues method in SimpleRiverEngine'"); } Oatc.OpenMI.Sdk.Backbone.ScalarSet values = } new Oatc.OpenMI.Sdk.Backbone.ScalarSet(returnValues); return values; } |
The branch number is extracted from the ElementSetID and used as an index in the GetValues call to the SimpleRiverDotNetAccess class.
...