r2d_building_with_households

class pyrecodes.component.r2d_building_with_households.R2DBuildingWithHouseholds

Bases: R2DBuilding

async async_initialize_households() None
component_represents_friends_house(household) bool
component_represents_home(household) bool
component_represents_out_of_town() bool
construct(component_name, component_parameters)
create_households(households: list)
households_decide() None
households_move() None

Move households to the component that they decided to move to. Make a copy of the households list to avoid modifying the original list while iterating over it. If a household moves, it is removed from the original list and then the loop will skip the next household.

initialize_households() None
map_buildings_to_households(built_environment) None

Map building components(home, friends, out of town) to households.

print_household_ids()
recover(time_step)

Recover the component as defined in its recovery model.

set_initial_damage_level(damage_level: float) None

Set the initial damage level of the component. Damage level must be between 0 and 1.

update(time_step: int, households_in_town: dict) None

Extend the parent method to update the R2D dictionary used to interface pyrecodes with SimCenter’s infrastructure simulators.

update_demand_from_households()
update_households(time_step: int, households_in_town: list) None
update_households_based_on_unmet_demand(percent_of_met_demand: float, resource_name: str) None

Update component’s households based on how much of their operation demand is met.

update_occupancy_status()

If there are households in the building, set the occupancy status to occupied.

update_operation_demand()

Update component’s operation demand based on its current functionality level.

update_supply_based_on_component_functionality()

Update component’s supply based on its current functionality level.

update_supply_based_on_unmet_demand(percent_of_met_demand: float, resource_name: str, time_step: int) None
Update component’s supply based on how much of its operation demand is met.
This is how component interdependencies are captured.
This method is called during resource distribution.
update_supply_from_households()
class pyrecodes.component.r2d_building_with_households.R2DTown

Bases: R2DBuildingWithHouseholds

Component representing a town where households can move to if they decide to leave their home.

Starts with no households.

Assume all resources are available in the town.

update_supply_based_on_unmet_demand(percent_of_met_demand: float, resource_name: str, time_step: int) None
Assume all demand is met in the town.