setEvents: Setting Events

Description Usage Arguments Value Examples

View source: R/setEvents.R

Description

Sets different types of events for the given ODEnetwork.

Usage

1
setEvents(odenet, events, type = "dirac")

Arguments

odenet

[ODEnetwork]
List of class ODEnetwork.

events

[data.frame]
Data frame with a time base and named column per variable. See events for detailed definition of events.

type

[character]
The type of the events to use. Possible values are dirac, constant or linear.
Type dirac sets the current state at a given time point to a new value. Constant sets the state to the given value and the state does not change until setting new value or the end of events. Linear interpolates linear between events and sets the state variables to this value.
Default is dirac.

Value

an extended list of class [ODEnetwork].

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
masses <- 1
dampers <- as.matrix(1.5)
springs <- as.matrix(4)
odenet <- ODEnetwork(masses, dampers, springs)
eventdat <- data.frame(  var = c("x.1", "x.1")
                       , time = c(1, 3)
                       , value = c(1, 3)
                       , stringsAsFactors = TRUE
                       )
odenet <- setState(odenet, 0, 0)
odenet <- setEvents(odenet, eventdat)
odenet <- simuNetwork(odenet, seq(0, 10, by = 0.1))
plot(odenet)

surmann/ODEnetwork documentation built on April 6, 2020, 8:53 p.m.