raplan.classes
¶
Dataclasses to use and configure maintenance planning and scheduling with.
Component
¶
Component with a failure distribution.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name of this component. |
age |
int | float
|
Starting age offset (usually in years). |
distribution |
Distributions | None
|
Failure distribution to use. |
maintenance |
list[Maintenance]
|
List of maintenance tasks that should be applied over this component's lifespan. |
uuid |
UUID
|
Automatically generated unique identifier for this component. |
cfp
¶
Cumulative failure probability density function incorporating maintenance.
gen_maintenance
¶
gen_maintenance() -> Generator[Maintenance, None, None]
get_age_at
¶
Effective age at a point in time given the currently set schedule.
Source code in src/raplan/classes.py
get_ordered_maintenance
¶
get_ordered_maintenance() -> list[Maintenance]
get_unordered_maintenance
¶
get_unordered_maintenance() -> list[Maintenance]
reschedule_maintenance
¶
schedule_maintenance
¶
schedule_maintenance(maintenance: Maintenance)
Schedule maintenance for a single or all system's component or all components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maintenance
|
Maintenance
|
Maintenance to schedule. |
required |
CyclicStrategy
¶
Maintenance strategy to renovate or replace a component at certain percentages of a cycle.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name for this cyclic strategy. |
tasks |
list[Task]
|
List of tasks that should be applied at the corresponding entry in percentages. |
percentages |
list[float]
|
List of percentages [0.0, 1.0] at which to apply tasks. |
uuid |
UUID
|
Automatically generated unique identifier for this cyclic strategy. |
apply_to_component
¶
apply_to_component(
component: Component,
cycle_length: int | float,
horizon: Horizon,
repeat: bool = True,
include_history: bool = True,
integers: bool = False,
overwrite: bool = True,
) -> None
Apply this strategy to a component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Component
|
Component for which to schedule maintenance. |
required |
cycle_length
|
int | float
|
Cycle length. |
required |
horizon
|
Horizon
|
Planning horizon to consider. |
required |
repeat
|
bool
|
Whether the cycle should be repeated until the end of the horizon. |
True
|
include_history
|
bool
|
Whether to include historical maintenance entries for components that have a pre-defined age. |
True
|
overwrite
|
bool
|
Whether to fully overwrite a component's maintenance planning with this new one or extend it. |
True
|
integers
|
bool
|
Whether to force all times to be integers. |
False
|
Source code in src/raplan/classes.py
get_maintenance
¶
get_maintenance(
age: int | float,
cycle_length: int | float,
horizon: Horizon,
prefix: str | None = None,
repeat: bool = True,
include_history: bool = True,
integers: bool = False,
) -> list[Maintenance]
Get maintenance list for this strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age
|
int | float
|
Starting age of a virtual component. |
required |
cycle_length
|
int | float
|
Cycle length. |
required |
horizon
|
Horizon
|
Planning horizon to consider. |
required |
prefix
|
str | None
|
Maintenance naming prefix. |
None
|
repeat
|
bool
|
Whether the cycle should be repeated until the end of the horizon. |
True
|
include_history
|
bool
|
Whether to include historical maintenance entries for components that have a pre-defined age. |
True
|
integers
|
bool
|
Whether to force all times to be integers. |
False
|
Returns:
| Type | Description |
|---|---|
list[Maintenance]
|
Maintenance list. |
Source code in src/raplan/classes.py
Horizon
¶
Maintenance planning and scheduling horizon.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
int | float
|
Start of the planning horizon. |
end |
int | float | None
|
End of the planning horizon. Optional, as it is otherwise derived from the final task in the schedule. |
uuid |
UUID
|
Automatically generated unique identifier for this Horizon. |
get_range
¶
Range between start and end (inclusive) in the given number of steps.
Source code in src/raplan/classes.py
is_satisfied_by
¶
Whether the given time falls within this horizon.
Maintenance
¶
Maintenance task scheduled at a point in time.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name of this maintenance task. |
task |
Task
|
Task information. |
time |
int | float
|
Time at which this maintenance is scheduled. |
rescheduling |
list[Rescheduling]
|
Rescheduling history. |
window |
Window | None
|
Window in time within which the maintenance has to be scheduled. |
uuid |
UUID
|
Automatically generated unique identifier for this maintenance. |
get_progress
¶
Percentage of the set task that is completed at a given time.
Source code in src/raplan/classes.py
reschedule_from
¶
Reschedule maintenance based on the input data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[UUID, int | float]
|
Dictionary from maintenance UUIDs to assigned times. |
required |
Source code in src/raplan/classes.py
Procedure
¶
Grouping of maintenance tasks that should be executed in parallel.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name of this procedure. |
maintenance |
list[Maintenance]
|
Maintenance instances to group. |
uuid |
UUID
|
Unique identifier assigned to this procedure. |
duration
property
¶
Duration of this bundle, i.e. the longest duration of any of its members.
window
property
¶
window: Window | None
Window within which this maintenance procedure has to be scheduled. This window is calculated such that the relative timing of all contained maintenance is preserved.
apply_to
¶
apply_to(
target: Project | System | Component | Maintenance,
reason: str | None = None,
) -> None
Apply this procedure's schedule (maintenance timing) to a target.
Source code in src/raplan/classes.py
reschedule
¶
Reschedule this procedure's starting time.
Source code in src/raplan/classes.py
Project
¶
Maintenance planning and scheduling project.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Optional name to identify this project by. |
horizon |
Horizon
|
Timescale horizon for this project. What timeframe are we looking at? |
systems |
list[System]
|
List of systems to consider a part of this maintenance project. |
uuid |
UUID
|
Automatically generated unique identifier for this project. |
cfp
¶
Cumulative failure probability density function as the sum of its systems' respective function incorporating maintenance.
Source code in src/raplan/classes.py
gen_maintenance
¶
gen_maintenance() -> Generator[Maintenance, None, None]
Yield all component maintenance items from a generator (unordered).
gen_procedures
¶
gen_procedures(
prefix: str | None = None,
uuid_fn: Callable[
[list[Maintenance]], UUID
] = with_uuid4s_to_uuid5,
) -> Generator[Procedure]
Generate procedures from the current maintenance schedule.
Source code in src/raplan/classes.py
get_horizon_end
¶
get_horizon_end() -> float
Get the end of the planning horizon or last maintenance task.
Source code in src/raplan/classes.py
get_ordered_maintenance
¶
get_ordered_maintenance() -> list[Maintenance]
get_procedures
¶
get_procedures(
uuid_fn: Callable[
[list[Maintenance]], UUID
] = with_uuid4s_to_uuid5,
) -> list[Procedure]
Get the procedures per system per time.
get_schedule
¶
get_schedule() -> Schedule
Get a fully generated schedule.
Source code in src/raplan/classes.py
get_system
¶
get_unordered_maintenance
¶
get_unordered_maintenance() -> list[Maintenance]
reschedule_maintenance
¶
schedule_maintenance
¶
schedule_maintenance(
maintenance: Maintenance,
system: str | None = None,
component: str | None = None,
) -> None
Schedule maintenance for a single or all system's component or all components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maintenance
|
Maintenance
|
Maintenance to schedule. |
required |
system
|
str | None
|
System name. If kept |
None
|
component
|
str | None
|
Component name. If kept |
None
|
Source code in src/raplan/classes.py
Rescheduling
¶
Schedule
¶
A full maintenance schedule.
Attributes:
| Name | Type | Description |
|---|---|---|
items |
list[ScheduleItem]
|
Scheduled tasks. |
uuid |
UUID
|
Automatically generated unique identifier for this maintenance schedule. |
from_projects
classmethod
¶
Create a schedule for multiple projects.
ScheduleItem
¶
A schedule item with full detail regarding its system, component and maintenance task info.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name for this action. |
project |
str | None
|
Name of the project this item belongs to if any. |
system |
str | None
|
Name of the system to which this maintenance is applied. |
component |
str | None
|
Name of the component to which this maintenance is applied. |
maintenance |
str | None
|
Name of the maintenance schedule this item belongs to if any. |
task |
str | None
|
Name of the maintenance task this item belongs to if any. |
rejuvenation |
int | float
|
Rejuvenation factor between [0.0-1.0]. Percentage of age that is regained. Therefore, 1.0 would mean a full replacement. |
duration |
int | float
|
Duration of the maintenance. Usually in years. |
cost |
int | float
|
Cost of the maintenance. Usually expressed in a currency or equivalent. |
time |
int | float
|
Time at which this maintenance is scheduled. |
uuid |
UUID
|
Automatically generated unique identifier for this schedule item. |
System
¶
A system consisting of multiple components.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name of this system. |
components |
list[Component]
|
Components of this system. |
uuid |
UUID
|
Automatically generated unique identifier for this system. |
cfp
¶
Cumulative failure probability density function as the sum of its components' respective function incorporating maintenance.
Source code in src/raplan/classes.py
gen_maintenance
¶
gen_maintenance() -> Generator[Maintenance, None, None]
Yield all component maintenance items from a generator (unordered).
gen_procedures
¶
gen_procedures(
prefix: str | None = None,
uuid_fn: Callable[
[list[Maintenance]], UUID
] = with_uuid4s_to_uuid5,
) -> Generator[Procedure, None, None]
Generate procedures from the current maintenance schedule.
Source code in src/raplan/classes.py
get_component
¶
get_ordered_maintenance
¶
get_ordered_maintenance() -> list[Maintenance]
get_procedures
¶
get_procedures(
prefix: str | None = None,
uuid_fn: Callable[
[list[Maintenance]], UUID
] = with_uuid4s_to_uuid5,
) -> list[Procedure]
Get a list of procedures per system per time.
Source code in src/raplan/classes.py
get_unordered_maintenance
¶
get_unordered_maintenance() -> list[Maintenance]
reschedule_maintenance
¶
Reschedule system maintenance based on the input data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[UUID, int | float]
|
Dictionary from maintenance UUIDs to assigned times. |
required |
Source code in src/raplan/classes.py
schedule_maintenance
¶
schedule_maintenance(
maintenance: Maintenance, component: str | None = None
)
Schedule maintenance for a single or all system's component or all components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maintenance
|
Maintenance
|
Maintenance to schedule. |
required |
component
|
str | None
|
Component name. If kept |
None
|
Source code in src/raplan/classes.py
Task
¶
Maintenance task to apply to a component.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name for this action. |
rejuvenation |
int | float
|
Rejuvenation factor between [0.0-1.0]. Percentage of age that is regained. Therefore, 1.0 would mean a full replacement. |
duration |
int | float
|
Duration of the maintenance. Usually in years. |
cost |
int | float
|
Cost of the maintenance. Usually expressed in a currency or equivalent. |
uuid |
UUID
|
Automatically generated unique identifier for this task. |
Window
¶
Window in time within which a maintenance item can be scheduled.
Attributes:
| Name | Type | Description |
|---|---|---|
initial |
int | float
|
Initially scheduled time. |
max_rush |
int | float
|
Maximum earlier deviation with respect to the initial time within this window. |
max_post |
int | float
|
Maximum delay after the initial time in this window. |
uuid |
UUID
|
Automatically generated unique identifier for this window. |