Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Modelica/Blocks/Sources.mo
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,10 @@ by a falling exponential signal:
count := integer((time - startTime)/period);
T_start := startTime + count*period;
equation
when integer((time - startTime)/period) > pre(count) then
//The following formulation causes a state event
//when integer((time - startTime)/period) > pre(count) then
//A formulation causing a time event is more efficient:
when time >= (pre(count) + 1)*period + startTime then
count = pre(count) + 1;
T_start = time;
end when;
Expand Down Expand Up @@ -823,7 +826,10 @@ 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
//The following formulation causes a state event
//when integer((time - startTime)/period) > pre(count) then
//A formulation causing a time event is more efficient:
when time >= (pre(count) + 1)*period + startTime then
count = pre(count) + 1;
T_start = time;
end when;
Expand Down Expand Up @@ -888,7 +894,10 @@ 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
//The following formulation causes a state event
//when integer((time - startTime)/period) > pre(count) then
//A formulation causing a time event is more efficient:
when time >= (pre(count) + 1)*period + startTime then
count = pre(count) + 1;
T_start = time;
end when;
Expand Down