maestro icon indicating copy to clipboard operation
maestro copied to clipboard

VDM default properties scalarvariable

Open CThuleHansen opened this issue 4 years ago • 0 comments

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 , -- causality , -- variability , -- initial nil, -- canHandleMultipleSetPerTimeInstant mk_Real ( "Modelica.SIunits.Inertia", -- declared type nil, -- quantity nil, -- unit nil, -- displayUnit nil, -- relativeQuantity 0, -- min nil, -- max nil, -- nominal nil, -- unbounded 1, -- start nil, -- derivative nil -- reinit ), nil -- annotations )

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

CThuleHansen avatar Dec 10 '20 22:12 CThuleHansen