When attempting to write code to split regimes that contain piecewise expressions (either directly or via aliases) into separate regimes I realised that there isn't a way to specify which regime to transition to based on the current state for OnEvent transitions. For example, it is not possible to split a Dynamics class such as this
because the target of the OnEvent transition needs to change based on the value of x.
One way to handle this would be to introduce a conditional statement on the regime target, however, I think this would be a bit messy and wouldn't allow you to update states and chain subsequent events conditionally. Therefore, I would favour adding an optional ActiveWhen (or another name) element to OnEvent transitions, which would allow you to write
The only problem I can see with this is that it would be impossible to check whether two OnEvent transitions that listen to the same port could be active together, which would have to be left to the user to ensure it doesn't happen. However, this problem already occurs with multiple OnCondition transition statements so it is not a new problem.
When attempting to write code to split regimes that contain piecewise expressions (either directly or via aliases) into separate regimes I realised that there isn't a way to specify which regime to transition to based on the current state for
OnEvent
transitions. For example, it is not possible to split aDynamics
class such as thisinto
because the target of the
OnEvent
transition needs to change based on the value ofx
.One way to handle this would be to introduce a conditional statement on the regime target, however, I think this would be a bit messy and wouldn't allow you to update states and chain subsequent events conditionally. Therefore, I would favour adding an optional
ActiveWhen
(or another name) element toOnEvent
transitions, which would allow you to writeThe only problem I can see with this is that it would be impossible to check whether two
OnEvent
transitions that listen to the same port could be active together, which would have to be left to the user to ensure it doesn't happen. However, this problem already occurs with multipleOnCondition
transition statements so it is not a new problem.