Opened 7 years ago
Closed 7 years ago
#4618 closed defect (fixed)
states in statemachine are computed when they are not activated
Reported by: | Volker Waurich | Owned by: | Bernhard Thiele |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Frontend | Version: | |
Keywords: | statemachine | Cc: | Adrian Pop, Martin Sjölund, Lennart Ochel |
Description
Hi,
Please consider the attached model.
There are 2 states which are calculating the sum of a variable with its previous value at each tick. If I understood correctly, equations in a statemachine are only active if the state is active, but omc calculates alle equations in all states no matter which one is active. So s2.x2 should be 0 until s2 is activated.
Attachments (2)
Change History (5)
by , 7 years ago
Attachment: | stateMachine.mo added |
---|
by , 7 years ago
Attachment: | stateMachine2.mo added |
---|
comment:1 by , 7 years ago
Okay, I haven't tested models which use when Clock(c) then
within states. It is redundant in the sense that clock inference will ensure that all equations within a state machine run on the same clock (a modified example is attached). However, it is not forbidden to use the construct in the way as you do in the example, so it needs to be fixed.
comment:2 by , 7 years ago
Thank you for the remark. The when construct occurs when using Modelica_Synchronous.RealSignals.Periodic.PI
. Using a discrete PI-blocks without when
works perfectly with omc.
comment:3 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This should be fixed now (https://github.com/OpenModelica/OMCompiler/commit/92c6383188f2ee970d97015d2015534053a2a269).
Modified stateMachine.mo example without when-clause