Opened 5 years ago
Last modified 5 years ago
#5847 new defect
Constant is used without having been given a value
Reported by: | Owned by: | Per Östlund | |
---|---|---|---|
Priority: | blocker | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | v1.16.0-dev |
Keywords: | Cc: |
Description
The initialization of parameters through function at initial algorithm produces (non-blocking) errors.
This happens when such parameters are then used to initialise other model instances.
with old frontend only vector-output functions fail, while with the new one both scalar and vector output fail.
[1] 14:26:06 Translation Notification [InitializationInInitial: 17:5-17:58]: From here: [2] 14:26:06 Translation Error [Modelica.SIunits: 471:7-471:53]: Constant <VARNAME> is used without having been given a value.
Attachments (1)
Change History (4)
by , 5 years ago
Attachment: | InitializationInInitial.mo added |
---|
comment:1 by , 5 years ago
Component: | *unknown* → New Instantiation |
---|---|
Milestone: | Future → 2.0.0 |
Owner: | changed from | to
Priority: | normal → blocker |
Unit checking also fails when checking the model. I guess this is related to constant evaluation of functions. @perost, can you comment on that?
comment:2 by , 5 years ago
FixedRotation
contains the record parameter R_rel
whose binding equations contains a couple of function calls using the variables that the example models initialize in an initial equation. The NF will always try to evaluate the binding of final record parameters to avoid having to move the binding to an initial equation, since that doesn't always work so well.
So what happens here is that the NF will try to evaluate the binding of R_rel
since it's a final record parameter, it will fail because some parameters used in the binding of R_rel
does not have any binding equations, and the NF will then move the binding of R_rel
to an initial equation instead.
Both of the models compile and simulate just fine though, they just give an error message due to the failed attempt at evaluating the binding equation. So I don't really see any major issues here except perhaps bad error reporting, we should probably tell the user that the evaluation failed and the binding was moved to an initial equation instead.
comment:3 by , 5 years ago
FYI, I confirm (if there was any need for) that initializing R_rel
in initial equation does solve the problem as @perost was saying.
Example package