maestro
maestro copied to clipboard
VDM default properties scalarvariable
Hi Casper,
In the bi-weekly yesterday, you asked:
@Nick can you fmi static checker provide a hook to calculate i.e. remaining properties on a scalar variable? based on the defaults in the standard
There is a function to do this for all variables. I've just added something a bit friendlier to get one effective variable by name (not committed):
getEffectiveVariables: FMIModelDescription * VarName +> [ScalarVariable]
DEFAULT`getEffectiveVariables(springMassDamper, "inertial.J") =
mk_ScalarVariable
(
123, -- location in XML (line, used by model)
"inertial.J", -- name
0, -- vref
nil, -- description
I've added the comments :-) Normally it just returns a VDM record value, which prints on one line.
So you may find there are more nils (undefined values) in there than you were expecting? Some of these are because the field cannot be defaulted. For example, this variable has no description, but there is no default value for this. Ditto with units, display units and quantities. Other cases could have plausible defaults set, like canHandleMultipleSetPerTimeInstant (which would be false and is perhaps a bug). Note that although min/max default to (something like) MININT and MAXINT, they are actually treated as null because the precision of the model (32-bit, 64-bit etc) is not defined. But the processing should correctly handle the inheritance of default min/max values (and some others) from the declaredType.
Does this sort of thing give you what you need, or did I misunderstand?
Cheers, -nick