Example: Bridge settings for valves
- Last UpdatedSep 04, 2024
- 1 minute read
This topic shows an example of the typical bridging settings for valves.
Two signals handle the valve.
-
The ItemValve.op drives the valve movement (writing the DYNSIM valve .OP). The value is used to read current valve state (the DYNSIM valve .POS). This approach correctly shows on the 3D realtime application the current value state and not the requested one. Also, it automatically supports malfunctions where the valve stops turning.
-
The DYNSIM valve .timeop is read to adjust valve rotation animation to the valve opening time. DYNSIM speed (SIMSPD) is also considered to react to execution speed changes. Note that the rule does not work in case of different .timeop and .timecl values. Because .rotationSpeed is not automatically shared, it must be added to the shares file.
Code example
This is a code example for the typical bridging settings for valves.
<mapping type="ItemValve" name="" outputEnabled="true">
<shares>
<share field="{name}.rotationSpeed" direction="in" />
</shares>
<dynsim>
<analog name="{name}.POS" direction="in" mode="router" uom="%"/>
<analog name="{name}.OP" direction="out" mode="direct" uom="%"/>
<analog name="{name}.TIMEOP" direction="in" mode="router" uom="sec"/>
</dynsim>
<mwpl>
<sfloat name="{name}.value" capture="false"/>
<sfloat name="{name}.op" capture="false"/>
<sfloat name="{name}.rotationSpeed" capture="false"/>
</mwpl>
<rules>
<trigger from="dynsim:{name}.POS" to="mwpl:{name}.value" value="[*'{0:0.000}',n:#@dynsim:{name}.POS@/100#]"/>
<trigger from="mwpl:{name}.op" to="dynsim:{name}.OP" value="#@mwpl:{name}.op@*100#"/>
<trigger from="dynsim:{name}.TIMEOP" to="mwpl:{name}.rotationSpeed" value="#(1/@dynsim:{name}.TIMEOP@)*(@dynsim:SIMSPD@/100)#"/>
</rules>
</mapping>