Skip to content

Commit

Permalink
Replaced state events by time events
Browse files Browse the repository at this point in the history
  • Loading branch information
AHaumer committed Dec 14, 2022
1 parent 410d60b commit c80a86a
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Modelica/Blocks/Sources.mo
Expand Up @@ -413,13 +413,13 @@ The Real output y is a cosine signal:
transformation(
extent={{-2,-2},{2,2}},
origin={-80,-60})));
Blocks.Sources.Constant amplitude_constant(final k=constantAmplitude) if
useConstantAmplitude
Blocks.Sources.Constant amplitude_constant(final k=constantAmplitude)
if useConstantAmplitude
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=90,
origin={-80,30})));
Blocks.Sources.Constant f_constant(final k=constantFrequency) if
useConstantFrequency
Blocks.Sources.Constant f_constant(final k=constantFrequency)
if useConstantFrequency
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=90,
origin={-80,-30})));
Expand Down Expand Up @@ -516,13 +516,13 @@ and that the parameter <code>startTime</code> is omitted since the voltage can b
transformation(
extent={{-2,-2},{2,2}},
origin={-80,-60})));
Blocks.Sources.Constant amplitude_constant(final k=constantAmplitude) if
useConstantAmplitude
Blocks.Sources.Constant amplitude_constant(final k=constantAmplitude)
if useConstantAmplitude
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=90,
origin={-80,30})));
Blocks.Sources.Constant f_constant(final k=constantFrequency) if
useConstantFrequency
Blocks.Sources.Constant f_constant(final k=constantFrequency)
if useConstantFrequency
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=90,
origin={-80,-30})));
Expand Down Expand Up @@ -768,7 +768,8 @@ by a falling exponential signal:
count := integer((time - startTime)/period);
T_start := startTime + count*period;
equation
when integer((time - startTime)/period) > pre(count) then
//when integer((time - startTime)/period) > pre(count) then
when time >= (pre(count) + 1)*period + startTime then
count = pre(count) + 1;
T_start = time;
end when;
Expand Down Expand Up @@ -823,7 +824,8 @@ The Real output y is a pulse signal:
count := integer((time - startTime)/period);
T_start := startTime + count*period;
equation
when integer((time - startTime)/period) > pre(count) then
//when integer((time - startTime)/period) > pre(count) then
when time >= (pre(count) + 1)*period + startTime then
count = pre(count) + 1;
T_start = time;
end when;
Expand Down Expand Up @@ -888,7 +890,8 @@ The Real output y is a saw tooth signal:
count := integer((time - startTime)/period);
T_start := startTime + count*period;
equation
when integer((time - startTime)/period) > pre(count) then
//when integer((time - startTime)/period) > pre(count) then
when time >= (pre(count) + 1)*period + startTime then
count = pre(count) + 1;
T_start = time;
end when;
Expand Down

0 comments on commit c80a86a

Please sign in to comment.