Skip to content

Commit

Permalink
Merge pull request #4045 from dietmarw/4035-ZeroOrderHoldv2
Browse files Browse the repository at this point in the history
Fix startTime of (SignalPWM) -> ZeroOrderHold
  • Loading branch information
MartinOtter authored Mar 29, 2023
2 parents 07612fb + 39b0799 commit 7051091
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Modelica/Blocks/Discrete.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ package Discrete
extends Modelica.Icons.Package;

block Sampler "Ideal sampling of continuous signals"
extends Interfaces.DiscreteSISO;
extends Interfaces.DiscreteSISO(y(start=0, fixed=true));

equation
when {sampleTrigger, initial()} then
y = u;
y = if time>=startTime then u else pre(y);
end when;
annotation (
Icon(
Expand Down Expand Up @@ -44,7 +44,7 @@ via parameter <strong>samplePeriod</strong>.

equation
when {sampleTrigger, initial()} then
ySample = u;
ySample = if time>=startTime then u else pre(ySample);
end when;
/* Define y=ySample with an infinitesimal delay to break potential
algebraic loops if both the continuous and the discrete part have
Expand Down

0 comments on commit 7051091

Please sign in to comment.