Skip to contents

Find the damage total of the model based on the hydraulic simulation

Usage

get_hydraulic_damage(
  h_max_by_room,
  damage,
  exposition,
  threshold_height = 1,
  threshold_duration = 12
)

Arguments

h_max_by_room

vector of doubles, max water level by room

damage

damaging part of an object of class model

exposition

character or list of characters, giving the names of the walls concerned by external limnigraphs

threshold_height

numeric, height in centimeters above which a damage is considered

threshold_duration

numeric, maximum duration for the damage function used for interpolation. See details.

Value

matrix, damages for each rooms and externals based on water level

Details

The damage functions used for interpolation are those with the smallest positive duration available in damage. This minimum must be less than or equal to threshold_duration. If this is not the case, an error is returned to force the user to construct the damage functions with analyse_model() using a hazard_range consistent with the needs of the hydraulic analysis.

Examples


model = adu_t

# generate limnigraph
flood = generate_limnigraph(
   model = model,
  time = c(0, 300, 900),
  depth = cbind(facade = c(0, 3, 0)),
  exposition = list(
    facade = list(external = c("wall_A", "wall_B", "wall_C", "wall_D", "wall_E",
    "wall_F", "wall_G", "wall_H")))
)
#> generating limnigraph ...
#>  limnigraph successfully generated
# calculate maximum flood water depth for event in "flood" in model adu_t
hydraulic = analyse_hydraulic(
  model = model,
  limnigraph = flood,
  sim_id = "test",
  stage = c("hydraulic")
)
#> Simulating hydraulics for 'adu_t'...
#> 	... hydraulics successfully modeled for 'adu_t'
#> End of analysis for 'adu_t'. Total elapsed time 0.42 secs
# calculate damage for flood water depth calculated with hydraulic model
get_hydraulic_damage(
 h_max_by_room = hydraulic$hmax["z",], 
 damage = model[["dam_room_wall"]][c("absolute_room","absolute_external")], 
 exposition = flood[["exposition"]]
)
#>          room_1  room_2   room_3   room_4  facade    total
#> damage 4189.854 2470.95 4389.854 7539.854 4399.54 22990.05

# Test of some thresholds
hmax = c(room_1 = 0, room_1 = 0.005, room_1 = 0.2, room_1 = 0.12, room_1 = 10.0)
dam = list()
dam[["absolute_room"]][["room_1"]][["total"]] = matrix(
 c(0, 0, 0, 0, 1000, 2000, 0, 1500, 2500),
 ncol = 3, byrow = FALSE,
 dimnames = list(h = c(0, 10, 20), d = c(0, 12, 40))
)
get_hydraulic_damage(hmax, dam, NULL)
#>        room_1 room_1 room_1 room_1 room_1 total
#> damage      0      0   2000   1200   2000  5200