Multiple Unit Calculation and/or Converstion

Discussion about the use of Simantics System Dynamics
Post Reply
Jim P
Posts: 1
Joined: December 27th, 2016, 9:51 pm

Multiple Unit Calculation and/or Converstion

Post by Jim P » December 27th, 2016, 10:26 pm

This Simantics system looks like a fantastic tool, and just starting out, I've encountered an obstacle with units.

I need to create models using multiple units with combined unit relationships such as Aux1=Volts, Aux2=Amps, Aux4=Watts (Aux1*Aux2), Aux5=AmpHours Aux6=WattHours (Aux1*Aux5). Although these aren't really dimensionless quantities, it seems to only work by treating them as such and entering 1 for the units.

Similarly, it would be handy to be able to convert units inside the model, where, for example a main parameter receives data in hours, but seconds are best used downstream in the model. However, creating Aux1 with Units set to "Hours", value set to X, and Aux2 with Units set to "Seconds", value set to "Aux1*3600" generates an warning of "Hours!=Seconds".

While the warning is clearly true, I'd like to be able to define the relationship somewhere.

Is there a facility to do this such as a conversion symbol type, or is there documentation that I am missing on how to define these sorts of relationships in Simantic? Do I need to either disable unit validation, or set the units to "1" in this section of the model, or is there a better way? Also, is there some more detailed documentation on how the Units are handled and validated?

Thanks in advance for any help!
Tuomas Miettinen
Site Admin
Posts: 31
Joined: March 11th, 2013, 3:14 pm

Re: Multiple Unit Calculation and/or Converstion

Post by Tuomas Miettinen » January 9th, 2017, 10:25 am

Currently all that kind of unit validation problems can be cleared with one function: unitCast(). Using this function in the equation allows you to change the unit of any expression within that equation to a wildcard. Of course you can't check the validity of that unit, but at least you can get rid of the warnings. I updated a description of unitCast in the documentation in https://www.simantics.org/end_user_wiki ... m_Dynamics (all the documentation of Simantics System Dynamics is there).
Post Reply