add_pulse_event: Register a pulse event on one of the compartment of a...

View source: R/ui_model-building.R

add_pulse_eventR Documentation

Register a pulse event on one of the compartment of a topology

Description

When applied to a steady-state compartment, this is equivalent to changing the steady state. Negative values are allowed, so one can add a "pulse" to a steady-state compartment and then later add a similar but negative "pulse" to simulate a drip in a stream for example.

Usage

add_pulse_event(nm, time, comp = NULL, unmarked, marked, which = NULL, pulses)

Arguments

nm

A networkModel object.

time

Numeric, time at which the pulse is happening.

comp

One compartment name only.

unmarked

Numeric, quantity of unmarked marker added.

marked

Numeric, quantity of marked marker added.

which

Vector of integers giving the nm rows to update. Default is to update all rows.

pulses

Optionally, a tibble containing the pulse information in columns. If provided, 'comp', 'time', 'unmarked' and 'marked' must be strings giving the corresponding column names.

Value

A networkModel object.

Examples

m <- trini_mod
m$events <- NULL
pulses <- tibble::tribble(
   ~ stream,    ~ transect, ~ comp, ~ time, ~ qty_14N, ~ qty_15N,
       "UL",  "transect.1",  "NH4",     11,         0,  -0.00569,
       "UL",  "transect.2",  "NH4",     11,         0,  -0.00264,
       "UL",  "transect.3",  "NH4",     11,         0, -0.000726,
       "UL",  "transect.1",  "NO3",     11,         0,  -0.00851,
       "UL",  "transect.2",  "NO3",     11,         0,  -0.01118,
       "UL",  "transect.3",  "NO3",     11,         0,  -0.01244,
   )
m <- add_pulse_event(m, pulses = pulses, comp = "comp", time = "time",
                     unmarked = "qty_14N", marked = "qty_15N")
m
 


isotracer documentation built on Sept. 22, 2023, 1:07 a.m.