CIFASIS / CIFASIS/qss-solver

Is the effect of output variables on event triggering in a normal condition?

Open
#300 1 comment 0 reactions 0 assignees View on GitHub
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:

![Image](https://github.com/user-attachments/assets/b9d05c20-05c0-4013-a650-35f07886f962)

m is output correctly.

When outputting x,m, the event triggers incorrectly:

![Image](https://github.com/user-attachments/assets/ba21de42-f351-4123-9ffe-797ae7a948a0)

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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.