Skip to content

Commit 7006d2a

Browse files
committed
step is active at start time
for consistency with - other implementations - literature - the other sources in the same file
1 parent 8de0a39 commit 7006d2a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/Blocks/sources.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ Generate step signal.
328328
pars = @parameters offset=offset start_time=start_time height=height duration=duration
329329
equation = if smooth == false # use comparison in case smooth is a float
330330
offset +
331-
ifelse((start_time < t) & (t < start_time + duration), height, zero(height))
331+
ifelse((start_time <= t) & (t < start_time + duration), height, zero(height))
332332
else
333333
smooth === true && (smooth = 1e-5)
334334
if duration_numeric == Inf

src/Hydraulic/IsothermalCompressible/IsothermalCompressible.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ using IfElse: ifelse
1414
export HydraulicPort, HydraulicFluid
1515
include("utils.jl")
1616

17-
export Cap, Tube, FixedVolume, DynamicVolume, Open, FlowDivider, Valve, Volume, SpoolValve, SpoolValve2Way, Actuator
17+
export Cap, Tube, FixedVolume, DynamicVolume, Open, FlowDivider, Valve, Volume, SpoolValve,
18+
SpoolValve2Way, Actuator
1819
include("components.jl")
1920

2021
export MassFlow, Pressure, FixedPressure

test/Blocks/sources.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ end
233233

234234
@test sol.retcode == Success
235235
@test sol[src.output.u]step.(sol.t, offset, height, start_time) atol=1e-2
236+
@test sol(start_time, idxs = src.output.u) == height + offset # Test that the step is applied at the start time
236237

237238
# test with duration
238239
duration = 1.2

0 commit comments

Comments
 (0)