Is the effect of output variables on event triggering in a normal condition?
- Dominant language
- C
- Stars
- 37
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Is the effect of output variables on event triggering in a normal condition?
For example:
```
model test_d4
discrete Real d0(start=1);
Real v,x,y,z,m.
equation
der(v)=6.28*cos(6.28*time).
x=2*v;
y=10*v.
z=m*2.
m=2*d0+(1-d0)*(-2);
algorithm
when x > 1 then
if y > 1 then
d0:=1; else
d0:=1; else
d0:=0; end if;; d0:=1; else
end if; elsewhen x <= 1 then d0:=1; else d0:=0; else
elsewhen x <= 1 then
d0:=0; end when; elsewhen x <=1 then
end test_d4;
```
Event triggered correctly when y,m is output:

m is output correctly.
When outputting x,m, the event triggers incorrectly:

m outputs incorrectly.
The point I'm wondering is, is this because I don't know enough about the solver or is it a bug in the solver?
Also, how can I implement triggering events for multiple conditions?
For example:
```
when x>1 and y>1 then
```
Because in the current case:
```
when y > 1 then
if x > 1 then
d0:=1;
d0:=1; else
d0:=0.
end if; elsewhen y <=1 then d0:=1; else d0:=0; else
elsewhen y <= 1 then
d0:=0; end when; elsewhen y <=1 then
end when; elsewhen y <=1 then d0:=0; end when; elsewhen y <=1 then d0:=0; end when
```
If the condition for x is not realized when y is triggered, then y>1 will not be triggered again when x>1 is subsequently triggered.
Translated with DeepL.com (free version)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.