Skip to contents

Create a ramp function that increases linearly from 0 to a specified height at a specified start time, and stays at this height after the specified end time.

Usage

ramp(start, finish, height = 1)

Arguments

start

Start time of ramp

finish

End time of ramp

height

End height of ramp, defaults to 1

Value

Interpolation function

Details

Equivalent of Ramp() in Insight Maker

Examples

# Create a simple model with a ramp function
sfm = xmile() %>%
build("a", "stock") %>%
build("input", "constant", eqn = "ramp(2, 5, 3)") %>%
build("inflow", "flow", eqn = "input(t)", to = "a")

sim = simulate(sfm)
plot(sim)
# To create a decreasing ramp, set the height to a negative value sfm = sfm %>% build("input", eqn = "ramp(2, 5, -3)") sim = simulate(sfm) plot(sim)