concrete_recovery_activity¶
- class pyrecodes.component_recovery_model.concrete_recovery_activity.ConcreteRecoveryActivity(name: str, initial_level=0.0)¶
Bases:
RecoveryActivity
Concrete implementation of a recovery activity.
- activity_finished() bool ¶
Check if the activity is finished and return a boolean value.
- Returns:
bool: True if the activity is finished, False otherwise.
- effect_of_unmet_demand_on_activity() float ¶
Determine how demand met for each resource in the recovery demand affects the recovery activity.
- Returns:
float: The effect of unmet demand on the activity.
- get_demand() dict ¶
Get the current resource demand of the activity.
- Returns:
dict: A dictionary of resource demands.
- record_progress(time_step: int) None ¶
Record progress at a specific time step. If the rate at a time step was higher than zero, than the time step is recorded.
- Args:
time_step (int): The time step when progress is recorded.
- recover(time_step: int) None ¶
Perform recovery for a given time step. Activity recovers (i.e., progresses) if it’s not already finished. The rate of progress depends on the percent of met resource demand.
- Args:
time_step (int): The time step for which recovery is performed.
- sample_duration(distribution: dict) float ¶
Sample the duration from a distribution.
- Args:
distribution (dict): A dictionary describing the duration distribution.
- Returns:
float: The sampled duration.
- set_demand(resources: list) None ¶
Set the resource demand for the activity.
- Args:
resources (list): List of dictionaries describing resource demands.
- set_demand_met(resource_name: str, demand_met: float) None ¶
Set the level of demand met (between 0 and 1) for a resource resource_name.
- Args:
resource_name (str): The name of the resource. demand_met (float): The level of demand met (between 0 and 1).
- set_duration(distribution: dict) None ¶
Set the duration of the activity based on a distribution. Duration must be a positive number. If duration is zero, the rate is infinite - activity is immediately finished.
- Args:
distribution (dict): A dictionary describing the duration distribution.
- set_level(level: float) None ¶
Set the progress level of the activity.
- Args:
level (float): The progress level of the activity (between 0 and 1).
- set_name(name: str) None ¶
Set the name of the activity.
- Args:
name (str): The name of the activity.
- set_preceding_activities(preceding_activities: [<class 'str'>]) None ¶
Set preceding activities that need to be completed for this activity to start.
- Args:
preceding_activities (list[str]): List of names of preceding activities.
- set_preceding_activities_finished(finished: bool) None ¶
Set the status of preceding activities.
- Args:
finished (bool): True if all preceding activities are finished.