Skip to contents

This function adds two types of protections to an existing model (cofferdams and pumps). The model should be correctly loaded, with an existing data_table slot.

Usage

add_protection(model, cofferdam = NULL, pump = NULL)

Arguments

model

list of table informations of the model.

cofferdam

named vector of cofferdam with their height of cofferdam in meters. Default to NULL (no cofferdam).

pump

named vector of pumps with their flow rates (m3/s). Default to NULL (no pump).

Value

adjusted model of class model. See details

Details

Only pump that are located in existing rooms, given by model[["data_table"]][["room"]][["name"]] are added. If a pump is located in a non existing room, a warning is sent.

Only cofferdam that are located at existing opnings, given by model[["data_table"]][["opening"]][["name"]] are added. If a cofferdam is located at a non existing opning, a warning is sent.

If added, pump and cofferdam are found in model[["data_table"]].

Examples


# no warnings
add_protection(adu_t, cofferdam = c(door1 = 0.3))
add_protection(adu_t, pump = c(room_1 = 10))
add_protection(adu_t, pump = c(room_1 = 10), cofferdam = c(door1 = 0.3))

# warnings, nothing is added
add_protection(adu_t, cofferdam = c(no_door = 0.3), pump = c(no_room = 10))
#> Warning: Some cofferdam (no_door) are not located at existing openings They are removed. Some pumps (no_room) are not located in existing rooms. They are removed.