raplan.classes
¶
Dataclasses to use and configure maintenance planning and scheduling with.
Component
dataclass
¶
Component(
name: str
| None = field(default=None, skip_if_default=True),
age: int | float = 0.0,
lifetime: int | float = 1.0,
distribution: Distributions = field(
default_factory=Weibull
),
maintenance: list[Maintenance] = field(
default_factory=list, skip_if=_is_empty, repr=False
),
uuid: UUID = field(default_factory=uuid4),
)
Component with a failure distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name of this component. |
field(default=None, skip_if_default=True)
|
age
|
int | float
|
Starting age offset (usually in years). |
0.0
|
distribution
|
Distributions
|
Failure distribution to use. |
field(default_factory=Weibull)
|
maintenance
|
list[Maintenance]
|
List of maintenance tasks that should be applied over this component's lifespan. |
field(default_factory=list, skip_if=_is_empty, repr=False)
|
uuid
|
UUID
|
Automatically generated unique identifier for this component. |
field(default_factory=uuid4)
|
cfp
¶
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]
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
dataclass
¶
CyclicStrategy(
name: str
| None = field(default=None, skip_if_default=True),
tasks: list[Task] = field(
default_factory=list, skip_if=_is_empty
),
percentages: list[float] = field(
default_factory=list, skip_if=_is_empty
),
uuid: UUID = field(default_factory=uuid4),
)
Maintenance strategy to renovate or replace a component at certain percentages of a cycle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name for this cyclic strategy. |
field(default=None, skip_if_default=True)
|
tasks
|
list[Task]
|
List of tasks that should be applied at the corresponding entry in percentages. |
field(default_factory=list, skip_if=_is_empty)
|
percentages
|
list[float]
|
List of percentages [0.0, 1.0] at which to apply tasks. |
field(default_factory=list, skip_if=_is_empty)
|
uuid
|
UUID
|
Automatically generated unique identifier for this cyclic strategy. |
field(default_factory=uuid4)
|
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
dataclass
¶
Horizon(
start: int | float = 0.0,
end: int
| float
| None = field(default=None, skip_if_default=True),
uuid: UUID = field(default_factory=uuid4),
)
Maintenance planning and scheduling horizon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
int | float
|
Start of the planning horizon. |
0.0
|
end
|
int | float | None
|
End of the planning horizon. Optional, as it is otherwise derived from the final task in the schedule. |
field(default=None, skip_if_default=True)
|
uuid
|
UUID
|
Automatically generated unique identifier for this Horizon. |
field(default_factory=uuid4)
|
get_range
¶
Range between start and end (inclusive) in the given number of steps.
Source code in src/raplan/classes.py
Maintenance
dataclass
¶
Maintenance(
name: str
| None = field(default=None, skip_if_default=True),
task: Task = field(default_factory=Task),
time: int | float = 1.0,
uuid: UUID = field(default_factory=uuid4),
)
Maintenance task scheduled at a point in time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name of this maintenance task. |
field(default=None, skip_if_default=True)
|
task
|
Task
|
Task information. |
field(default_factory=Task)
|
time
|
int | float
|
Time at which this maintenance is scheduled. |
1.0
|
uuid
|
UUID
|
Automatically generated unique identifier for this maintenance. |
field(default_factory=uuid4)
|
get_progress
¶
Percentage of the set task that is completed at a given time.
Source code in src/raplan/classes.py
Procedure
dataclass
¶
Procedure(
name: str
| None = field(default=None, skip_if_default=True),
system: str = "system",
kind: str = "procedure",
time: int | float = 1.0,
cost: int | float = 1.0,
duration: int | float = 1.0,
uuid: UUID = field(default_factory=uuid4),
)
A specific grouping of tasks to apply to a System.
Note
Mainly used for plotting purposes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name for this procedure. |
field(default=None, skip_if_default=True)
|
system
|
str
|
System (name) to which the procedure should be applied. |
'system'
|
kind
|
str
|
Kind of procedure (category name). |
'procedure'
|
time
|
int | float
|
Time at which the procedure is scheduled. |
1.0
|
cost
|
int | float
|
Cost of the procedure. |
1.0
|
duration
|
int | float
|
Duration of the procedure. |
1.0
|
uuid
|
UUID
|
Automatically generated unique identifier for this procedure. |
field(default_factory=uuid4)
|
Project
dataclass
¶
Project(
name: str
| None = field(default=None, skip_if_default=True),
horizon: Horizon = field(default_factory=Horizon),
systems: list[System] = field(
default_factory=list, skip_if=_is_empty, repr=False
),
uuid: UUID = field(default_factory=uuid4),
)
Maintenance planning and scheduling project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Optional name to identify this project by. |
field(default=None, skip_if_default=True)
|
horizon
|
Horizon
|
Timescale horizon for this project. What timeframe are we looking at? |
field(default_factory=Horizon)
|
systems
|
list[System]
|
List of systems to consider a part of this maintenance project. |
field(default_factory=list, skip_if=_is_empty, repr=False)
|
uuid
|
UUID
|
Automatically generated unique identifier for this project. |
field(default_factory=uuid4)
|
cfp
¶
Cumulative failure probability density function as the sum of its systems' respective function incorporating maintenance.
Source code in src/raplan/classes.py
get_horizon_end
¶
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 all maintenance ordered in time.
get_schedule
¶
get_schedule() -> Schedule
Get a fully generated schedule.
Source code in src/raplan/classes.py
schedule_maintenance
¶
schedule_maintenance(
maintenance: Maintenance,
system: str | None = None,
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 |
system
|
str | None
|
System name. If kept |
None
|
component
|
str | None
|
Component name. If kept |
None
|
Source code in src/raplan/classes.py
Schedule
dataclass
¶
Schedule(
items: list[ScheduleItem] = field(
default_factory=list, skip_if=_is_empty
),
uuid: UUID = field(default_factory=uuid4),
)
A full maintenance schedule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
list[ScheduleItem]
|
Scheduled tasks. |
field(default_factory=list, skip_if=_is_empty)
|
uuid
|
UUID
|
Automatically generated unique identifier for this maintenance schedule. |
field(default_factory=uuid4)
|
from_projects
classmethod
¶
Create a schedule for multiple projects.
get_ordered_maintenance
¶
get_ordered_maintenance() -> list[ScheduleItem]
ScheduleItem
dataclass
¶
ScheduleItem(
name: str
| None = field(default=None, skip_if_default=True),
project: str
| None = field(default=None, skip_if_default=True),
system: str
| None = field(default=None, skip_if_default=True),
component: str
| None = field(default=None, skip_if_default=True),
maintenance: str
| None = field(default=None, skip_if_default=True),
task: str
| None = field(default=None, skip_if_default=True),
rejuvenation: int | float = 1.0,
duration: int | float = 1.0,
cost: int | float = 1.0,
time: int | float = 1.0,
uuid: UUID = field(default_factory=uuid4),
)
A schedule item with full detail regarding its system, component and maintenance task info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name for this action. |
field(default=None, skip_if_default=True)
|
project
|
str | None
|
Name of the project this item belongs to if any. |
field(default=None, skip_if_default=True)
|
system
|
str | None
|
Name of the system to which this maintenance is applied. |
field(default=None, skip_if_default=True)
|
component
|
str | None
|
Name of the component to which this maintenance is applied. |
field(default=None, skip_if_default=True)
|
maintenance
|
str | None
|
Name of the maintenance schedule this item belongs to if any. |
field(default=None, skip_if_default=True)
|
rejuvenation
|
int | float
|
Rejuvenation factor between [0.0-1.0]. Percentage of age that is regained. Therefore, 1.0 would mean a full replacement. |
1.0
|
duration
|
int | float
|
Duration of the maintenance. Usually in years. |
1.0
|
cost
|
int | float
|
Cost of the maintenance. Usually expressed in a currency or equivalent. |
1.0
|
time
|
int | float
|
Time at which this maintenance is scheduled. |
1.0
|
uuid
|
UUID
|
Automatically generated unique identifier for this schedule item. |
field(default_factory=uuid4)
|
System
dataclass
¶
System(
name: str
| None = field(default=None, skip_if_default=True),
components: list[Component] = field(
default_factory=list, skip_if=_is_empty, repr=False
),
uuid: UUID = field(default_factory=uuid4),
)
A system consisting of multiple components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name of this system. |
field(default=None, skip_if_default=True)
|
components
|
list[Component]
|
Components of this system. |
field(default_factory=list, skip_if=_is_empty, repr=False)
|
uuid
|
UUID
|
Automatically generated unique identifier for this system. |
field(default_factory=uuid4)
|
cfp
¶
Cumulative failure probability density function as the sum of its components' respective function incorporating maintenance.
Source code in src/raplan/classes.py
get_ordered_maintenance
¶
get_ordered_maintenance() -> list[Maintenance]
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
dataclass
¶
Task(
name: str
| None = field(default=None, skip_if_default=True),
rejuvenation: int | float = 1.0,
duration: int | float = 1.0,
cost: int | float = 1.0,
uuid: UUID = field(default_factory=uuid4),
)
Maintenance task to apply to a component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Name for this action. |
field(default=None, skip_if_default=True)
|
rejuvenation
|
int | float
|
Rejuvenation factor between [0.0-1.0]. Percentage of age that is regained. Therefore, 1.0 would mean a full replacement. |
1.0
|
duration
|
int | float
|
Duration of the maintenance. Usually in years. |
1.0
|
cost
|
int | float
|
Cost of the maintenance. Usually expressed in a currency or equivalent. |
1.0
|
uuid
|
UUID
|
Automatically generated unique identifier for this task. |
field(default_factory=uuid4)
|