Skip to content

Commit 7051091

Browse files
authored
Merge pull request modelica#4045 from dietmarw/4035-ZeroOrderHoldv2
Fix startTime of (SignalPWM) -> ZeroOrderHold
2 parents 07612fb + 39b0799 commit 7051091

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modelica/Blocks/Discrete.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package Discrete
55
extends Modelica.Icons.Package;
66

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

1010
equation
1111
when {sampleTrigger, initial()} then
12-
y = u;
12+
y = if time>=startTime then u else pre(y);
1313
end when;
1414
annotation (
1515
Icon(
@@ -44,7 +44,7 @@ via parameter <strong>samplePeriod</strong>.
4444

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

0 commit comments

Comments
 (0)