5 3 Implementing the SetValues method

The calling sequence for the SetValues method is shown on figure 15 below.


Fig. 15. Calling sequence for the SetValues method

The EngineWrapper class decides what has to be done, based on the QuantityID and the ElementSetID. In the Simple River engine core there is only one possible variable that can act as input, which is the storage of water in the nodes. For the Simple River model, inflow is interpreted as additional inflow, which means that the inflow already received from other sources (the boundary inflow) is not overwritten. The inflow is added to the current storage in the nodes. The ElementSetID is parsed and the node number to which the water is going is determined.

If the inflow is going to the branches, the water is added to the downstream node for each branch. If the inflow is going to the nodes, the water is simply added to the storage of the node. Understanding the role of the QuantityID and the ElementSetID is very important when you are migrating your model. For each ExchangeItem you define your ElementSetID and QuantityID. These IDs will be included in the link when a user is configuring a system with your model. When the system is running, the same ElementSetID and QuantityID will get back to the ModelComponent when the GetValues method is invoked. Your component will then use this information to navigate to the correct variables in the engine.

You can use any convention for naming these IDs. In the Simple River ElementSetID, the convention used was Branch:<branch number> (e.g. ´Branch:3' ) or 'AllBranches', and the Quantity IDs were 'Flow' and 'InFlow'.

  • No labels