-
Notifications
You must be signed in to change notification settings - Fork 31
Verify target of Real variables with attribute 'derivative' #56
Comments
@filip-stenstrom In VDMCheck2, we check the following:
But I think I agree that our check for being a state derivatives could be more precise. The standard doesn't really clearly say how a state derivative is defined (or a continuous time state, come to that). |
Thanks that's good to know. I'm not either certain about definition of state variables. I take it as "anything referenced by For your point 1, I see the point in skipping CS if no (Also, in my main post I wrote only continuous Reals, but discrete should also be checked, updating...) |
I don't believe the sets have to equal, since |
It is frustrating trying to work out the formal interpretation of an informal standard! Though hopefully the effort of doing so will be paid back one day :-) I interpreted the standard to mean that the SVs (or something else?) defines the states, and the ModelStructure derivatives have to be "Exactly all of the (exposed) state derivatives", taken from the XSD annotation. Though it may be that "exposed" is not something that can be determined by looking at the SVs (the term is not defined). It also says, "A ModelExchange These are the definitions that I currently have. I'd be very interested to know if I should tighten/change them!
I see your point about verifying the derivatives even if this is a CS only FMU. The standard does say that the derivatives are ignored in that case, but perhaps warnings would be appropriate anyway. |
my 2 cents:
There is no way AFAIK to know which and how many discrete states are present and so this is referring to continuous states.
There may be other variables with this attribute at least for aliases or for algebraic variables (probably rare case and not much used if used at all). Theoretically, FMU might even be indicating that it expects two inputs to have "derivative" relation to each other. Other pure theoretical case where target of derivative does not need to be continuous is if derivative is constant zero. I would therefore vote for checking target to be continuous but will not enforce that all variables with derivate attribute are listed under ModelStructure. |
@iakovn OK, I think that is getting clearer; thanks for the extra input. So it sounds like I need to relax the current check that all SVs labelled as "derivative" must be in ModelStructure. And you're saying that a derivative need not be continuous (because it could be constant), unless it is listed as having dependencies, in which case it must be continuous. If that's correct, it is easy to state formally (for the checker). Trying to fix the wording in the standard seems harder (ironically!) |
(@filip-stenstrom Sorry if I'm hijacking this discussion, but this is the best input I've had so far on what the Standard means!) I've changed the formal model to say the following. (Hopefully the VDM-SL syntax is obvious. The strange looking set={true} constructs are to ensure that every test in the set is made; an and-clause would stop at the first falsity):
That now picks up various cases in the cross-check repository, like this:
This is because they have listed various variables in the ModelStructure derivatives, but they are not "derivative" in the ModelVariables section (though they are continuous Reals). |
When a variable references what other variable they are a derivative of, no warning/error is produced if the referenced variable cannot have a derivative.
Example of part of XML that doesn't produce any warnings/errors:
I believe there are two levels of strictness:
derivative
attribute has some more limitations (I guess it has to havecausality=local/output
)The text was updated successfully, but these errors were encountered: