Skip to content

Pelicun conversion module#8

Open
hgp297 wants to merge 27 commits intoOpenPBEE:mainfrom
hgp297:convert_pelicun
Open

Pelicun conversion module#8
hgp297 wants to merge 27 commits intoOpenPBEE:mainfrom
hgp297:convert_pelicun

Conversation

@hgp297
Copy link
Collaborator

@hgp297 hgp297 commented Mar 3, 2026

Summary

Added a Pelicun conversion method to input_builder.py. All major changes are implemented in input_builder.convert_pelicun(), and core ATC-138 functions are unmodified.

Key Changes

1. Support for Pelicun outputs as input files

  • input_builder.convert_pelicun will be called if Pelicun files are found in a model directory
  • build_simulated_inputs() now searches for DMG_sample.csv as an indicator of Pelicun outputs
  • Required input files described in README
  • Added force_rebuild_flag in driver.run_analysis() and cli.py to allow overriding of existing simulated_inputs
  • Added examples/RCSW_4story_pelicun

2. Reorganized plotting module

  • Fixed plotting modules for Python conversion
  • Moved plotting under plotters/main_plot_functionality
  • Added p_gantt as an argument to plot realizations other than median

3. Hotfixes

  • build_inputs.py -> build_simulated_inputs(): check for tenant_units to populate now matches, and for story vice versa (Under # Write in individual dictionaries...)
  • functionality.other_functionality_functions: Fixed typo in sys.exit

4. Documentation

  • Updated README: Updated README.md to reflect the package changes.
    • Description of required inputs
    • Added sample run instructions
    • Major assumptions and unimplemented features documented under HP: comments

5. Implementation notes

  • Examples for Pelicun requires a custom damage_state_attribute_mapping.csv to override is_sim_ds for elevators
  • Damage to cladding is assigned random sides
  • Currently does not simulate racked door damage

Verification

  • Tested on PBE application v4.4.2, which implements Pelicun >= 3.8.1
  • Example Run: Ran the RCSW_4story_pelicun example:
from src.atc138 import driver

example_dir = './examples/RCSW_4story_pelicun'
output_dir = './examples/RCSW_4story_pelicun/output'

driver.run_analysis(example_dir, output_dir, seed=985)

from plotters.main_plot_functionality import plot_results
output_dir = './examples/RCSW_4story_pelicun/output'
plot_results(output_dir, p_gantt=50)
  • Results:
Building simulated_inputs.json from raw inputs...
found custom damage_state_attribute_mapping.csv in inputs. Overriding static tables...
Pelicun outputs found in ./examples/RCSW_4story_pelicun. Attempting build...
Recovery assessment complete
time to run 7.26s

Plots generated

Added a Pelicun conversion method to `input_builder.py`. This commit is
not yet functional due to incomplete simulated_damage.json outputs.

Changes:
	- build_simulated_inputs() now searches for DMG_sample.csv as an
	  indicator of Pelicun outputs
	- convert_pelicun() builds raw inputs using Pelicun outputs.
	- (hotfix) in build_inputs.py -> build_simulated_inputs():
		- check for 'tenant_units' to populate now matches, and
		  for 'story' vice versa
		- Under # Write in individual dictionaries...

Input:
	- CMP_QNT.csv
	- DL_summary.csv
	- DMG_sample.csv
	- DV_repair_sample.csv
	- general_inputs.json
	- input.json

Output:
	- building_model.json
	- damage_consequences.json
	- comp_ds_list.csv
	- comp_population.csv
	- simulated_damage.json
- Changed file structure to match src/ reorganization
- Temporarily handled edge case where `repair_start_day` is all NaN by
  replacing it with 0.0
- Removed x-lim on recovery plot as it is tied to currently faulty "Full
  recovery day"
- driver.run_analysis(force_rebuild=True) will now rebuild
  simulated_inputs.json even if existing file is found.
plotters/main_plot_functionality

- Removed plotModel_PBEE_recovery.py (moved under plotters for future
  archiving)
- Added plot_results() function to plotters.main_plot_functionality
- For input_builder.csv, damage for each side (affecting cladding) is
randomly assigned a percentage summing up to 1.0
- Separated "tenant_units" and "story" from simulated_damage.json.
  "Story" now only includes the ["qnt_damaged_dir_n"] keys.

Future implementation should consider allowing for side damage to be
specified via general_inputs, e.g.
- Set seed occurs earlier to account for randomness in side damage
  (cladding) assignment
- Fixed overwrite in comp_population.csv to prevent resetting of
  component quantity if same component is listed multiple times in
CMP_QNT.csv
- allow users to specify engineering cost as a fraction of repair cost
  in general_inputs.json
- updated example `general_inputs.json` to reflect this
- removed json typo error
- removed edge case NaN handling in other_plot_functions
@hgp297 hgp297 requested review from dustin-cook and zsarnoczay March 3, 2026 19:54
hgp297 added 2 commits March 4, 2026 10:51
- Allow users to specify `side_damage_ratio.csv`, an array to split
  cladding damage by direction
- Elevators and stair count can now be overridden from `CMP_QNT.csv` using
  `general_input.json`
- Default action for simultaneous damage state (elevators) is now to
  turn off the `is_sim_ds` flag without needing a custom
`damage_state_attribute_mapping.csv`. Users are warned about
simultaneous ds in multiple PGs and are recommended to change
component.
- Added robustness in cmp-loc-dir-ds metatag detection and reorder
  appropriately in DMG and DV samples.
- doc: Added default and override instructions to README for the above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant