| 1 | model ResetIntegrator
|
|---|
| 2 | annotation(Diagram(coordinateSystem(extent={{-100,-100},{100,100}})));
|
|---|
| 3 | Real state;
|
|---|
| 4 | parameter Real zero=1e-05;
|
|---|
| 5 | Modelica.Blocks.Interfaces.RealInput u annotation(Placement(transformation(x=-90.27189, y=59.032257, scale=0.21000001), iconTransformation(x=-92.0, y=55.0, scale=0.21000001)));
|
|---|
| 6 | Modelica.Blocks.Interfaces.RealInput c annotation(Placement(transformation(x=-90.64056, y=-0.69585264, scale=0.21000001), iconTransformation(x=-82.0, y=-3.0, scale=0.21000001)));
|
|---|
| 7 | Modelica.Blocks.Interfaces.RealInput s annotation(Placement(transformation(x=-88.15208, y=-59.207375, scale=0.21000001), iconTransformation(x=-87.0, y=-69.0, scale=0.21000001)));
|
|---|
| 8 | Modelica.Blocks.Interfaces.RealOutput y annotation(Placement(transformation(x=96.792625, y=0.1520737, scale=0.21000001), iconTransformation(x=87.0, y=-1.0, scale=0.21000001)));
|
|---|
| 9 |
|
|---|
| 10 | equation
|
|---|
| 11 | der(state)=u;
|
|---|
| 12 | algorithm
|
|---|
| 13 | if c < zero and c > -zero then
|
|---|
| 14 | y:=s;
|
|---|
| 15 |
|
|---|
| 16 | else y:=state;
|
|---|
| 17 |
|
|---|
| 18 | end if;
|
|---|
| 19 | when c < zero and c > -zero then
|
|---|
| 20 | reinit(y,s);
|
|---|
| 21 |
|
|---|
| 22 | end when;
|
|---|
| 23 | end ResetIntegrator;
|
|---|
| 24 |
|
|---|