From 0176d6de6975124866d40b487eb99b96cb5e0714 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Tue, 26 Mar 2024 10:09:29 -0600 Subject: [PATCH] Fix issue with components still passing flow when failed --- docs/erin_next_examples/ex03-out.csv | 80 ++++++------ docs/erin_next_examples/ex03-stats.csv | 20 +-- docs/erin_next_examples/ex03.toml | 3 +- docs/erin_next_examples/ex04-out.csv | 20 +-- docs/erin_next_examples/ex04-stats.csv | 10 +- docs/erin_next_examples/ex04.toml | 2 - docs/erin_next_examples/ex26-out.csv | 80 ++++++------ docs/erin_next_examples/ex26-stats.csv | 20 +-- docs/erin_next_examples/ex26.toml | 8 +- docs/erin_next_examples/regress.py | 2 + include/erin_next/erin_next.h | 14 +++ src/erin_next.cpp | 166 +++++++++++++++++++++---- src/erin_next_scenario.cpp | 20 ++- src/erin_next_simulation.cpp | 7 ++ 14 files changed, 304 insertions(+), 148 deletions(-) diff --git a/docs/erin_next_examples/ex03-out.csv b/docs/erin_next_examples/ex03-out.csv index 1b74bd30..8c2d5335 100644 --- a/docs/erin_next_examples/ex03-out.csv +++ b/docs/erin_next_examples/ex03-out.csv @@ -24,43 +24,43 @@ class_1_hurricane,P0090-00-00T00:00:00,0,1,1,0,1,1,0,4294967,10,4294967,availabl class_1_hurricane,P0090-00-00T00:00:00,336,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available class_1_hurricane,P0100-00-00T00:00:00,0,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available class_1_hurricane,P0100-00-00T00:00:00,336,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available -class_4_hurricane,P0010-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0010-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0020-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0020-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0030-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0030-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0040-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0040-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0050-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0050-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0060-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0060-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0070-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0070-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0080-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0080-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0090-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0090-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0100-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0100-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_5_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0020-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0020-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0040-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0040-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0060-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0060-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0080-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0080-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0100-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0100-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_4_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0020-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0020-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0040-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0040-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0060-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0060-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0080-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0080-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0100-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0100-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_5_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0020-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0020-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0040-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0040-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0060-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0060-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0080-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0080-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0100-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0100-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding diff --git a/docs/erin_next_examples/ex03-stats.csv b/docs/erin_next_examples/ex03-stats.csv index 265efd9d..f0e2d68f 100644 --- a/docs/erin_next_examples/ex03-stats.csv +++ b/docs/erin_next_examples/ex03-stats.csv @@ -10,16 +10,16 @@ class_1_hurricane,7,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0, class_1_hurricane,8,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 class_1_hurricane,9,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 class_1_hurricane,10,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 -class_4_hurricane,1,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,2,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,3,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,4,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,5,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,6,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,7,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,8,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,9,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,10,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,1,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,2,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,3,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,4,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,5,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,6,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,7,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,8,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,9,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,10,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 class_5_hurricane,1,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1 class_5_hurricane,2,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1 class_5_hurricane,3,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1 diff --git a/docs/erin_next_examples/ex03.toml b/docs/erin_next_examples/ex03.toml index 3a1268b9..922a6055 100644 --- a/docs/erin_next_examples/ex03.toml +++ b/docs/erin_next_examples/ex03.toml @@ -66,7 +66,8 @@ upper_bound = 160.0 connections = [ ["electric_utility:OUT(0)", "bus:IN(0)", "electricity"], ["emergency_generator:OUT(0)", "bus:IN(1)", "electricity"], - ["bus:OUT(0)", "cluster_01_electric:IN(0)", "electricity"]] + ["bus:OUT(0)", "cluster_01_electric:IN(0)", "electricity"], + ] ############################################################ # Distributions [dist.immediately] diff --git a/docs/erin_next_examples/ex04-out.csv b/docs/erin_next_examples/ex04-out.csv index 7a8862f8..8e017e87 100644 --- a/docs/erin_next_examples/ex04-out.csv +++ b/docs/erin_next_examples/ex04-out.csv @@ -4,23 +4,23 @@ blue_sky,P0000-00-00T00:00:00,1200,10,10,0,10,10,0,4294967,10,4294967,available, blue_sky,P0000-00-00T00:00:00,2400,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available blue_sky,P0000-00-00T00:00:00,3600,0,0,0,0,0,0,4294967,10,4294967,available,available,available,available blue_sky,P0000-00-00T00:00:00,8760,0,0,0,0,0,0,4294967,10,4294967,available,available,available,available -class_4_hurricane,P0010-00-00T00:00:00,0,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding -class_4_hurricane,P0010-00-00T00:00:00,336,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding class_4_hurricane,P0020-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available class_4_hurricane,P0020-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0030-00-00T00:00:00,0,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding -class_4_hurricane,P0030-00-00T00:00:00,336,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding class_4_hurricane,P0040-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available class_4_hurricane,P0040-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0050-00-00T00:00:00,0,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding -class_4_hurricane,P0050-00-00T00:00:00,336,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding class_4_hurricane,P0060-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available class_4_hurricane,P0060-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0070-00-00T00:00:00,0,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding -class_4_hurricane,P0070-00-00T00:00:00,336,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding class_4_hurricane,P0080-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available class_4_hurricane,P0080-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0090-00-00T00:00:00,0,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding -class_4_hurricane,P0090-00-00T00:00:00,336,1,1,0,1,1,0,10,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding +class_4_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,0,0,0,10,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,available,somewhat_vulnerable_to_flooding class_4_hurricane,P0100-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available class_4_hurricane,P0100-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,available,available,highly_vulnerable_to_wind,available diff --git a/docs/erin_next_examples/ex04-stats.csv b/docs/erin_next_examples/ex04-stats.csv index 9e0da59c..6ca0e2c1 100644 --- a/docs/erin_next_examples/ex04-stats.csv +++ b/docs/erin_next_examples/ex04-stats.csv @@ -1,12 +1,12 @@ scenario id,occurrence number,duration (h),total source (kJ),total load (kJ),total storage (kJ),total waste (kJ),energy balance (source-(load+storage+waste)) (kJ),site efficiency,uptime (h),downtime (h),load not served (kJ),energy robustness [ER],energy availability [EA],max single event downtime [MaxSEDT] (h),global availability,availability: bus,availability: cluster_01_electric,availability: electric_utility,availability: emergency_generator,global count: highly_vulnerable_to_wind,global count: somewhat_vulnerable_to_flooding,global time fraction: highly_vulnerable_to_wind,global time fraction: somewhat_vulnerable_to_flooding,count: bus / highly_vulnerable_to_wind,count: bus / somewhat_vulnerable_to_flooding,count: electric_utility / highly_vulnerable_to_wind,count: emergency_generator / somewhat_vulnerable_to_flooding,time fraction: bus / highly_vulnerable_to_wind,time fraction: bus / somewhat_vulnerable_to_flooding,time fraction: electric_utility / highly_vulnerable_to_wind,time fraction: emergency_generator / somewhat_vulnerable_to_flooding blue_sky,1,8760,5.184e+07,5.184e+07,0,0,0,1,8760,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 -class_4_hurricane,1,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 +class_4_hurricane,1,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 class_4_hurricane,2,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,1,0 -class_4_hurricane,3,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 +class_4_hurricane,3,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 class_4_hurricane,4,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,1,0 -class_4_hurricane,5,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 +class_4_hurricane,5,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 class_4_hurricane,6,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,1,0 -class_4_hurricane,7,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 +class_4_hurricane,7,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 class_4_hurricane,8,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,1,0 -class_4_hurricane,9,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 +class_4_hurricane,9,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1 class_4_hurricane,10,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,1,0 diff --git a/docs/erin_next_examples/ex04.toml b/docs/erin_next_examples/ex04.toml index 030a9602..bd9832fe 100644 --- a/docs/erin_next_examples/ex04.toml +++ b/docs/erin_next_examples/ex04.toml @@ -24,9 +24,7 @@ max_outflow = 10.0 type = "load" inflow = "electricity" loads_by_scenario.blue_sky = "building_electrical" -loads_by_scenario.class_1_hurricane = "building_electrical" loads_by_scenario.class_4_hurricane = "building_electrical" -loads_by_scenario.class_5_hurricane = "building_electrical" [components.emergency_generator] type = "source" outflow = "electricity" diff --git a/docs/erin_next_examples/ex26-out.csv b/docs/erin_next_examples/ex26-out.csv index 1b74bd30..8c2d5335 100644 --- a/docs/erin_next_examples/ex26-out.csv +++ b/docs/erin_next_examples/ex26-out.csv @@ -24,43 +24,43 @@ class_1_hurricane,P0090-00-00T00:00:00,0,1,1,0,1,1,0,4294967,10,4294967,availabl class_1_hurricane,P0090-00-00T00:00:00,336,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available class_1_hurricane,P0100-00-00T00:00:00,0,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available class_1_hurricane,P0100-00-00T00:00:00,336,1,1,0,1,1,0,4294967,10,4294967,available,available,available,available -class_4_hurricane,P0010-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0010-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0020-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0020-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0030-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0030-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0040-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0040-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0050-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0050-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0060-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0060-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0070-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0070-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0080-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0080-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0090-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0090-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0100-00-00T00:00:00,0,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_4_hurricane,P0100-00-00T00:00:00,336,1,0,1,1,1,1,4294967,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available -class_5_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0020-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0020-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0040-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0040-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0060-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0060-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0080-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0080-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0100-00-00T00:00:00,0,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding -class_5_hurricane,P0100-00-00T00:00:00,336,0,0,0,1,1,1,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_4_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0020-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0020-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0040-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0040-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0060-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0060-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0080-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0080-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0100-00-00T00:00:00,0,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_4_hurricane,P0100-00-00T00:00:00,336,0,0,0,1,0,0,0,0,4294967,highly_vulnerable_to_wind,available,highly_vulnerable_to_wind,available +class_5_hurricane,P0010-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0010-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0020-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0020-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0030-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0030-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0040-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0040-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0050-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0050-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0060-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0060-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0070-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0070-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0080-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0080-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0090-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0090-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0100-00-00T00:00:00,0,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding +class_5_hurricane,P0100-00-00T00:00:00,336,0,0,0,1,0,0,0,0,0,highly_vulnerable_to_wind | somewhat_vulnerable_to_flooding,available,highly_vulnerable_to_wind,somewhat_vulnerable_to_flooding diff --git a/docs/erin_next_examples/ex26-stats.csv b/docs/erin_next_examples/ex26-stats.csv index 265efd9d..f0e2d68f 100644 --- a/docs/erin_next_examples/ex26-stats.csv +++ b/docs/erin_next_examples/ex26-stats.csv @@ -10,16 +10,16 @@ class_1_hurricane,7,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0, class_1_hurricane,8,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 class_1_hurricane,9,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 class_1_hurricane,10,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 -class_4_hurricane,1,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,2,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,3,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,4,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,5,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,6,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,7,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,8,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,9,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 -class_4_hurricane,10,336,1.2096e+06,1.2096e+06,0,0,0,1,336,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,1,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,2,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,3,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,4,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,5,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,6,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,7,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,8,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,9,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 +class_4_hurricane,10,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0 class_5_hurricane,1,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1 class_5_hurricane,2,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1 class_5_hurricane,3,336,0,0,0,0,0,0,0,336,1.2096e+06,0,0,336,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1 diff --git a/docs/erin_next_examples/ex26.toml b/docs/erin_next_examples/ex26.toml index 4ed41ce4..26d15504 100644 --- a/docs/erin_next_examples/ex26.toml +++ b/docs/erin_next_examples/ex26.toml @@ -41,7 +41,10 @@ type = "muxer" flow = "electricity" num_inflows = 2 num_outflows = 1 -fragility_modes = ["highly_vulnerable_to_wind", "somewhat_vulnerable_to_flooding"] +fragility_modes = [ + "highly_vulnerable_to_wind", + "somewhat_vulnerable_to_flooding", + ] ############################################################ # Fragility Modes [fragility_mode.somewhat_vulnerable_to_flooding] @@ -70,7 +73,8 @@ intensity_failure_pairs = [ connections = [ ["electric_utility:OUT(0)", "bus:IN(0)", "electricity"], ["emergency_generator:OUT(0)", "bus:IN(1)", "electricity"], - ["bus:OUT(0)", "cluster_01_electric:IN(0)", "electricity"]] + ["bus:OUT(0)", "cluster_01_electric:IN(0)", "electricity"], + ] ############################################################ # Distributions [dist.immediately] diff --git a/docs/erin_next_examples/regress.py b/docs/erin_next_examples/regress.py index 5a769277..7ec9394b 100644 --- a/docs/erin_next_examples/regress.py +++ b/docs/erin_next_examples/regress.py @@ -178,6 +178,7 @@ def run_cli(example_name): print(f"diff did not compare clean for out.csv for {example_name}") print(f"stdout:\n{result.stdout}") print(f"stderr:\n{result.stderr}") + print(("=" * 20) + " DETAILED DIFF") compare_csv(f'ex{example_name}-out.csv', 'out.csv') sys.exit(1) result = subprocess.run( @@ -187,6 +188,7 @@ def run_cli(example_name): print(f'diff did not compare clean for stats.csv for {example_name}') print(f"stdout:\n{result.stdout}") print(f"stderr:\n{result.stderr}") + print(("=" * 20) + " DETAILED DIFF") compare_csv(f'ex{example_name}-stats.csv', 'stats.csv') sys.exit(1) diff --git a/include/erin_next/erin_next.h b/include/erin_next/erin_next.h index ab03001c..f4cb8903 100644 --- a/include/erin_next/erin_next.h +++ b/include/erin_next/erin_next.h @@ -826,9 +826,23 @@ namespace erin_next flow_t remainingRequest ); + void + Mux_BalanceRequestFlows( + SimulationState& ss, + std::vector const& inflowConns, + flow_t remainingRequest_W, + bool logNewActivity); + void RunMuxBackward(Model& model, SimulationState& ss, size_t compIdx); + void + BalanceMuxRequests( + Model& model, + SimulationState& ss, + size_t muxIdx, + bool isUnavailable); + void RunStoreBackward( Model& model, diff --git a/src/erin_next.cpp b/src/erin_next.cpp index 201c2f5d..299ca4f0 100644 --- a/src/erin_next.cpp +++ b/src/erin_next.cpp @@ -8,6 +8,9 @@ namespace erin_next { + // TODO[mok]: need to rethink this. This adds a branch with an add. + // Probably a horrible performance issue. Use double but convert to + // unsigned int when finalize flows? inline flow_t UtilSafeAdd(flow_t a, flow_t b) @@ -166,14 +169,7 @@ namespace erin_next for (size_t loadIdx = 0; loadIdx < model.ConstLoads.size(); ++loadIdx) { size_t connIdx = model.ConstLoads[loadIdx].InflowConn; - size_t compId = model.Connections[connIdx].ToId; - if (ss.UnavailableComponents.contains(compId)) - { - // TODO: should we set flows here to zero? - continue; - } - if (ss.Flows[connIdx].Requested_W - != model.ConstLoads[loadIdx].Load_W) + if (ss.Flows[connIdx].Requested_W != model.ConstLoads[loadIdx].Load_W) { ss.ActiveConnectionsBack.insert(connIdx); } @@ -190,7 +186,11 @@ namespace erin_next size_t compId = m.Connections[connIdx].FromId; if (ss.UnavailableComponents.contains(compId)) { - // TODO: should we set flows here to zero? + if (ss.Flows[connIdx].Available_W != 0) + { + ss.ActiveConnectionsFront.insert(connIdx); + } + ss.Flows[connIdx].Available_W = 0; continue; } if (ss.Flows[connIdx].Available_W @@ -212,12 +212,6 @@ namespace erin_next for (size_t i = 0; i < m.ScheduledLoads.size(); ++i) { size_t connIdx = m.ScheduledLoads[i].InflowConn; - size_t compId = m.Connections[connIdx].ToId; - if (ss.UnavailableComponents.contains(compId)) - { - // TODO: should we set flows here to zero? - continue; - } size_t idx = ss.ScheduleBasedLoadIdx[i]; if (idx < m.ScheduledLoads[i].TimesAndLoads.size()) { @@ -249,7 +243,11 @@ namespace erin_next size_t compId = m.Connections[outIdx].FromId; if (ss.UnavailableComponents.contains(compId)) { - // TODO: should we set flows here to zero? + if (ss.Flows[outIdx].Available_W != 0) + { + ss.ActiveConnectionsFront.insert(outIdx); + } + ss.Flows[outIdx].Available_W = 0; continue; } auto idx = ss.ScheduleBasedSourceIdx[i]; @@ -287,12 +285,21 @@ namespace erin_next Store const& store = m.Stores[storeIdx]; size_t inflowConn = store.InflowConn; size_t compId = m.Connections[inflowConn].ToId; + size_t outflowConn = store.OutflowConn; if (ss.UnavailableComponents.contains(compId)) { - // TODO: should we zero flows here? + if (ss.Flows[inflowConn].Requested_W != 0) + { + ss.ActiveConnectionsBack.insert(inflowConn); + } + ss.Flows[inflowConn].Requested_W = 0; + if (ss.Flows[outflowConn].Available_W != 0) + { + ss.ActiveConnectionsFront.insert(outflowConn); + } + ss.Flows[outflowConn].Available_W = 0; continue; } - size_t outflowConn = store.OutflowConn; if (ss.StorageNextEventTimes[storeIdx] == t) { flow_t available = ss.Flows[inflowConn].Available_W @@ -337,10 +344,31 @@ namespace erin_next if (ts.state) { Model_SetComponentToRepaired(m, ss, rel.ComponentId); + std::cout << "... REPAIRED: " + << m.ComponentMap.Tag[rel.ComponentId] + << "[" << rel.ComponentId << "]" + << std::endl; } else { Model_SetComponentToFailed(m, ss, rel.ComponentId); + std::cout << "... FAILED: " + << m.ComponentMap.Tag[rel.ComponentId] + << "[" << rel.ComponentId << "]" + << std::endl; + std::cout << "... causes: " << std::endl; + for (auto const& fragCause : ts.fragilityModeCauses) + { + std::cout << "... ... fragility mode: " + << fragCause + << std::endl; + } + for (auto const& failCause : ts.failureModeCauses) + { + std::cout << "... ... failure mode: " + << failCause + << std::endl; + } } } else if (ts.time > time) @@ -582,6 +610,67 @@ namespace erin_next } } + void + Mux_BalanceRequestFlows( + SimulationState& ss, + std::vector const& inflowConns, + flow_t remainingRequest_W, + bool logNewActivity) + { + std::vector requests_W(inflowConns.size(), 0); + for (size_t i = 0; i < inflowConns.size(); ++i) + { + size_t inflowConn = inflowConns[i]; + flow_t req_W = + remainingRequest_W >= ss.Flows[inflowConn].Available_W + ? ss.Flows[inflowConn].Available_W + : remainingRequest_W; + requests_W[i] = req_W; + remainingRequest_W -= req_W; + } + if (remainingRequest_W > 0) + { + requests_W[0] = UtilSafeAdd(requests_W[0], remainingRequest_W); + } + for (size_t i = 0; i < inflowConns.size(); ++i) + { + size_t inflowConn = inflowConns[i]; + if (logNewActivity && ss.Flows[inflowConn].Requested_W != requests_W[i]) + { + ss.ActiveConnectionsBack.insert(inflowConn); + } + ss.Flows[inflowConn].Requested_W = requests_W[i]; + } + } + + void + BalanceMuxRequests( + Model& model, + SimulationState& ss, + size_t muxIdx, + bool isUnavailable) + { + Mux const& mux = model.Muxes[muxIdx]; + flow_t totalRequest = 0; + if (isUnavailable) + { + Mux_BalanceRequestFlows(ss, mux.InflowConns, totalRequest, true); + } + else + { + for (size_t i = 0; i < mux.NumOutports; ++i) + { + auto outflowConnIdx = mux.OutflowConns[i]; + auto outflowRequest_W = + ss.Flows[outflowConnIdx].Requested_W > mux.MaxOutflows_W[i] + ? mux.MaxOutflows_W[i] + : ss.Flows[outflowConnIdx].Requested_W; + totalRequest = UtilSafeAdd(totalRequest, outflowRequest_W); + } + Mux_BalanceRequestFlows(ss, mux.InflowConns, totalRequest, true); + } + } + void RunMuxBackward(Model& model, SimulationState& ss, size_t muxIdx) { @@ -703,6 +792,13 @@ namespace erin_next { size_t connIdx = *it; size_t compIdx = model.Connections[connIdx].FromIdx; + size_t compId = model.Connections[connIdx].FromId; + if (ss.UnavailableComponents.contains(compId)) + { + // TODO: test if we need to call this + Model_SetComponentToFailed(model, ss, compId); + continue; + } switch (model.Connections[connIdx].From) { case ComponentType::ConstantSourceType: @@ -794,7 +890,7 @@ namespace erin_next << ToString(model.Connections[connIdx].From) << std::endl; } - } + } } } } @@ -990,6 +1086,13 @@ namespace erin_next { size_t connIdx = *it; size_t compIdx = model.Connections[connIdx].ToIdx; + size_t compId = model.Connections[connIdx].ToId; + if (ss.UnavailableComponents.contains(compId)) + { + // TODO: test if we need to call this + Model_SetComponentToFailed(model, ss, compId); + continue; + } switch (model.Connections[connIdx].To) { case ComponentType::ConstantLoadType: @@ -1132,8 +1235,10 @@ namespace erin_next void RunMuxPostFinalization(Model& model, SimulationState& ss, size_t compIdx) { + // TODO: test if we need to run backward/forward again RunMuxBackward(model, ss, compIdx); RunMuxForward(model, ss, compIdx); + //BalanceMuxRequests(model, ss, compIdx); } void @@ -1142,6 +1247,11 @@ namespace erin_next for (size_t connIdx = 0; connIdx < model.Connections.size(); ++connIdx) { size_t compIdx = model.Connections[connIdx].ToIdx; + size_t compId = model.Connections[connIdx].ToId; + if (ss.UnavailableComponents.contains(compId)) + { + continue; + } switch (model.Connections[connIdx].To) { case ComponentType::StoreType: @@ -1786,6 +1896,7 @@ namespace erin_next // arrays // note: these two arrays could be sorted by component type for // faster running over loops... + ActivateConnectionsForReliability(model, ss, t); ActivateConnectionsForScheduleBasedLoads(model, ss, t); ActivateConnectionsForScheduleBasedSources(model, ss, t); ActivateConnectionsForStores(model, ss, t); @@ -1796,12 +1907,15 @@ namespace erin_next ActivateConnectionsForConstantLoads(model, ss); ActivateConnectionsForConstantSources(model, ss); } - ActivateConnectionsForReliability(model, ss, t); - size_t const maxLoop = 10; + size_t const maxLoop = 1000; for (size_t loopIter = 0; loopIter <= maxLoop; ++loopIter) { if (CountActiveConnections(ss) == 0) { + if (print) + { + std::cout << "loop iter: " << loopIter << std::endl; + } break; } if (loopIter == maxLoop) @@ -1812,6 +1926,7 @@ namespace erin_next } if (print) { + std::cout << std::endl; PrintFlows(model, ss, t); PrintFlowSummary(SummarizeFlows(model, ss, t)); PrintModelState(model, ss); @@ -2091,8 +2206,7 @@ namespace erin_next } ss.Flows[inflowConn].Requested_W = 0; } - for (size_t outIdx = 0; outIdx < m.Muxes[idx].NumOutports; - ++outIdx) + for (size_t outIdx = 0; outIdx < m.Muxes[idx].NumOutports; ++outIdx) { auto outflowConn = m.Muxes[idx].OutflowConns[outIdx]; if (ss.Flows[outflowConn].Available_W != 0) @@ -2103,7 +2217,7 @@ namespace erin_next } } break; - case (ComponentType::StoreType): + case ComponentType::StoreType: { auto inflowConn = m.Stores[idx].InflowConn; if (ss.Flows[inflowConn].Requested_W != 0) @@ -2119,7 +2233,7 @@ namespace erin_next ss.Flows[outflowConn].Available_W = 0; } break; - case (ComponentType::PassThroughType): + case ComponentType::PassThroughType: { auto const& pt = m.PassThroughs[idx]; if (ss.Flows[pt.InflowConn].Requested_W != 0) @@ -2134,7 +2248,7 @@ namespace erin_next ss.Flows[pt.OutflowConn].Available_W = 0; } break; - case (ComponentType::WasteSinkType): + case ComponentType::WasteSinkType: { WriteErrorMessage("waste sink", "waste sink cannot fail"); std::exit(1); diff --git a/src/erin_next_scenario.cpp b/src/erin_next_scenario.cpp index 719abaf0..c820fe6a 100644 --- a/src/erin_next_scenario.cpp +++ b/src/erin_next_scenario.cpp @@ -103,15 +103,21 @@ namespace erin_next auto maybeOccurrenceDist = TOMLTable_ParseString(table, "occurrence_distribution", fullName); if (!maybeOccurrenceDist.has_value()) + { return {}; + } auto maybeTimeUnitStr = TOMLTable_ParseStringWithSetResponses( table, ValidTimeUnits, "time_unit", fullName ); if (!maybeTimeUnitStr.has_value()) + { return {}; + } auto maybeDuration = TOMLTable_ParseDouble(table, "duration", fullName); if (!maybeDuration.has_value()) + { return {}; + } std::optional maxOccurrences = {}; if (table.contains("max_occurrences")) { @@ -120,7 +126,9 @@ namespace erin_next auto maxOccurrencesString = TOMLTable_ParseString(table, "max_occurrences", fullName); if (!maxOccurrencesString.has_value()) + { return {}; + } if (maxOccurrencesString.value() != "unlimited") { std::cout << "[" << fullName << "] max_occurrences must " @@ -133,15 +141,23 @@ namespace erin_next } else { - maxOccurrences = + std::optional maxOccurrenceValue = TOMLTable_ParseInteger(table, "max_occurrences", fullName); - if (!maxOccurrences.has_value()) + if (!maxOccurrenceValue.has_value()) + { return {}; + } + if (maxOccurrenceValue.value() > 0) + { + maxOccurrences = maxOccurrenceValue; + } } } auto maybeTimeUnit = TagToTimeUnit(maybeTimeUnitStr.value()); if (!maybeTimeUnit.has_value()) + { return {}; + } size_t id = ScenarioDict_RegisterScenario( sd, tag, diff --git a/src/erin_next_simulation.cpp b/src/erin_next_simulation.cpp index e51f85ae..f8421353 100644 --- a/src/erin_next_simulation.cpp +++ b/src/erin_next_simulation.cpp @@ -1923,6 +1923,13 @@ namespace erin_next // including any repair distribution if we have // one. size_t compId = s.ComponentFragilities.ComponentIds[cfmIdx]; + // TODO: make the below printout optional; e.g., if verbose flag is true + std::cout << "... FAILED: " + << s.TheModel.ComponentMap.Tag[compId] + << " (cause: " + << s.FragilityModes.Tags[s.ComponentFragilities.FragilityModeIds[cfmIdx]] + << ")" + << std::endl; // does the component have a reliability signal? bool hasReliabilityAlready = false; size_t reliabilityId = 0;