Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step is active at start time #324

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Blocks/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Generate step signal.
pars = @parameters offset=offset start_time=start_time height=height duration=duration
equation = if smooth == false # use comparison in case smooth is a float
offset +
ifelse((start_time < t) & (t < start_time + duration), height, zero(height))
ifelse((start_time <= t) & (t < start_time + duration), height, zero(height))
else
smooth === true && (smooth = 1e-5)
if duration_numeric == Inf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ using IfElse: ifelse
export HydraulicPort, HydraulicFluid
include("utils.jl")

export Cap, Tube, FixedVolume, DynamicVolume, Open, FlowDivider, Valve, Volume, SpoolValve, SpoolValve2Way, Actuator
export Cap, Tube, FixedVolume, DynamicVolume, Open, FlowDivider, Valve, Volume, SpoolValve,
SpoolValve2Way, Actuator
include("components.jl")

export MassFlow, Pressure, FixedPressure
Expand Down
1 change: 1 addition & 0 deletions test/Blocks/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ end

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

# test with duration
duration = 1.2
Expand Down
Loading