Opened 7 years ago
Last modified 7 years ago
#4500 new defect
Reinit of variables
Reported by: | Owned by: | Jal Panchal | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | v1.12.0 |
Keywords: | reinit, when | Cc: |
Description
I faced a problem while using reinit in my code and I have extracted the essential parts into the code below
model erraticWhenCondition Modelica.Blocks.Sources.Sine sine1(amplitude = 1, freqHz = 0.5) annotation( Placement(visible = true, transformation(origin = {-58, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Real x (start = 1); Real y,z,a,b; equation when sine1.y < 0.8 then reinit(x, 1); end when; when sine1.y > -0.8 then reinit(x ,-1); end when; x = 1; y = x; z = x*1; a = x*(-1); b = x*2; end erraticWhenCondition;
What I observed was, x is switching between -1 and 1 correctly, so is y and z. But a and b get constant values of -1 and 2.
So either such an equation should raise an error or the calculation must be done rightly for a and b.
Attachments (1)
Change History (2)
by , 7 years ago
Attachment: | erraticWhenCondition.pdf added |
---|
comment:1 by , 7 years ago
Component: | *unknown* → Backend |
---|---|
Reporter: | changed from | to
Type: | task → defect |
Note:
See TracTickets
for help on using tickets.
The model is invalid and an error should be triggered.