Hello!
I was wondering if anyone could tell me whether MasterSim supports unit conversion when a BaseUnit and DisplayUnits are stated for a variable in the modelDescription.xml of an FMU. I tried to test this using this code in the modelDescription:
<!-- Index of variable = "7" --><ScalarVariablename="y"valueReference="6"description="Current Distance"variability="continuous"causality="output"initial="exact"><Realstart="0.0"unit="m"displayUnit="2m"/></ScalarVariable>
MasterSimulator recognizes the unit "m" since it names the output file appropriately. But it does not matter whether I set the displayUnit of the variable to "1m" or "2m", the resulting values do not change, which I would expect. It might of course also be that there is an error in my code or that there is another way for MasterSim to recognize units.
Thanks for any ideas!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unit conversion is not handled by MasterSim. That means:
unit attribute of ScalarVariable specifies the base unit, which shall be used for any input/output quantities set/read by the master
in the MasterSim output files, the base unit is used in the table caption, thus postprocessing has to do the conversion between, for example, from K to degC
To my knowledge the FMI standard expects DisplayUnit property as something for user interfaces; start attribute is expected to have a value of the baseunit.
Suggestion/workaround:
as part of the postprocessing, you could use a simply python script that reads in the CSV-files generated by MasterSim using pandas, scaling/transforming values and dumping data out again.
Last edit: Andreas Nicolai 2017-11-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I was wondering if anyone could tell me whether MasterSim supports unit conversion when a BaseUnit and DisplayUnits are stated for a variable in the modelDescription.xml of an FMU. I tried to test this using this code in the modelDescription:
.
.
.
MasterSimulator recognizes the unit "m" since it names the output file appropriately. But it does not matter whether I set the displayUnit of the variable to "1m" or "2m", the resulting values do not change, which I would expect. It might of course also be that there is an error in my code or that there is another way for MasterSim to recognize units.
Thanks for any ideas!
Unit conversion is not handled by MasterSim. That means:
To my knowledge the FMI standard expects DisplayUnit property as something for user interfaces; start attribute is expected to have a value of the baseunit.
Suggestion/workaround:
as part of the postprocessing, you could use a simply python script that reads in the CSV-files generated by MasterSim using pandas, scaling/transforming values and dumping data out again.
Last edit: Andreas Nicolai 2017-11-21
Thank you very much! Yes, the workaround with the python script will probably be the way to go for me.