Wind Farm Classes#

The wind farm classes define how the wind farm's graph model are created, and power the timing out of the failures and maintenance events within the simulation for the cables, substations, and turbines.

Wind Farm#

Creates the Windfarm class/model.

class wombat.windfarm.windfarm.Windfarm(env, windfarm_layout, repair_manager)[source]#

The primary class for operating on objects within a windfarm. The substations, cables, and turbines are created as a network object to be more appropriately accessed and controlled.

Parameters:
_create_graph_layout(windfarm_layout)[source]#

Creates a network layout of the windfarm start from the substation(s) to be able to capture downstream turbines that can be cut off in the event of a cable failure.

Parameters:

windfarm_layout (str) -- Filename to use for reading in the windfarm layout; must be a csv file.

Return type:

None

_create_turbines_and_substations()[source]#

Instantiates the turbine and substation models as defined in the user-provided layout file, and connects these models to the appropriate graph nodes to create a fully representative windfarm network model.

Raises:

ValueError -- Raised if the subassembly data is not provided in the layout file.

Return type:

None

_create_cables()[source]#

Instantiates the cable models as defined in the user-provided layout file, and connects these models to the appropriate graph edges to create a fully representative windfarm network model.

Raises:

ValueError -- Raised if the cable model is not specified.

Return type:

None

calculate_distance_matrix()[source]#

Calculates the geodesic distance, in km, between all of the windfarm's nodes, e.g., substations and turbines, and cables.

Return type:

None

_create_substation_turbine_map()[source]#

Creates substation_turbine_map, a dictionary, that maps substation(s) to the dependent turbines in the windfarm, and the weighting of each turbine in the windfarm.

Return type:

None

_create_wind_farm_map()[source]#

Creates a secondary graph object strictly for traversing the windfarm to turn on/off the appropriate turbines, substations, and cables more easily.

Return type:

None

finish_setup()[source]#

Final initialization hook for any substations, turbines, or cables.

Return type:

None

_setup_logger(initial=True)[source]#
Parameters:

initial (bool)

_log_operations()[source]#

Logs the operational data for a simulation.

system(system_id)[source]#

Convenience function to returns the desired System object for a turbine or substation in the windfarm.

Parameters:

system_id (str) -- The system's unique identifier, wombat.windfarm.System.id.

Return type:

System

Returns:

System -- The System object.

cable(cable_id)[source]#

Convenience function to returns the desired Cable object for a cable in the windfarm.

Parameters:

cable_id (tuple[str, str] | str) -- The cable's unique identifier, of the form: (wombat.windfarm.System.id, wombat.windfarm.System.id), for the (downstream node id, upstream node id), or the Cable.id.

Return type:

Cable

Returns:

Cable -- The Cable object.

property current_availability: float#

Calculates the product of all system operating_level variables across the windfarm using the following forumation.

\[\sum{ OperatingLevel_{substation_{i}} * \sum{OperatingLevel_{turbine_{j}} * Weight_{turbine_{j}}} }\]

where the :math:{OperatingLevel} is the product of the operating level of each subassembly on a given system (substation or turbine), and the :math:{Weight} is the proportion of one turbine's capacity relative to the whole windfarm.

property current_availability_wo_servicing: float#

Calculates the product of all system operating_level variables across the windfarm using the following forumation, ignoring 0 operating level due to ongoing servicing.

\[\sum{ OperatingLevel_{substation_{i}} * \sum{OperatingLevel_{turbine_{j}} * Weight_{turbine_{j}}} }\]

where the :math:{OperatingLevel} is the product of the operating level of each subassembly on a given system (substation or turbine), and the :math:{Weight} is the proportion of one turbine's capacity relative to the whole windfarm.

System: Wind turbine or substation#

Creates the Turbine class.

class wombat.windfarm.system.system.System(env, repair_manager, t_id, name, subassemblies, system)[source]#

Can either be a turbine or substation, but is meant to be something that consists of 'Subassembly' pieces.

See here for more information.

Parameters:
_calculate_system_value(subassemblies)[source]#

Calculates the turbine's value based its capex_kw and capacity.

Parameters:
  • system (str) -- One of "turbine" or "substation".

  • subassemblies (dict) -- Dictionary of subassemblies.

Return type:

None

_create_subassemblies(subassembly_data, system)[source]#

Creates each subassembly as a separate attribute and also a list for quick access.

Parameters:
  • subassembly_data (dict) -- Dictionary providing the maintenance and failure definitions for at least one subassembly named

  • system (str) -- One of "turbine" or "substation" to indicate if the power curves should also be created, or not.

Return type:

None

_initialize_power_curve(power_curve_dict)[source]#

Creates the power curve function based on the power_curve input in the subassembly_data dictionary. If there is no valid input, then 0 will always be reutrned.

Parameters:

power_curve_dict (dict) -- The turbine definition dictionary.

Return type:

None

interrupt_all_subassembly_processes(origin=None, replacement=None)[source]#

Interrupts the running processes in all of the system's subassemblies.

Parameters:
  • origin (Subassembly) -- The subassembly that triggered the request, if the method call is coming from a subassembly shutdown event.

  • replacement (bool, optional) -- If a subassebly id is provided, this indicates the interruption is caused by its replacement event. Defaults to None.

Return type:

None

property operating_level: float#

The turbine's operating level, based on subassembly and cable performance.

Returns:

float -- Operating level of the turbine.

property operating_level_wo_servicing: float#

The turbine's operating level, based on subassembly and cable performance, without accounting for servicing status.

Returns:

float -- Operating level of the turbine.

power(windspeed)[source]#

Generates the power output for an iterable of windspeed values.

Parameters:

windspeed (list[float] | np.ndarrays) -- Windspeed values, in m/s.

Return type:

ndarray

Returns:

np.ndarray -- Power production, in kW.

Subassembly: The modeled components of a system#

Provides the Subassembly class.

class wombat.windfarm.system.subassembly.Subassembly(system, env, s_id, subassembly_data)[source]#

A major system composes the turbine or substation objects.

Parameters:
_create_processes()[source]#

Creates the processes for each of the failure and maintenance types.

Yields:

Tuple[Union[str, int], simpy.events.Process] -- Creates a dictionary to keep track of the running processes within the subassembly.

recreate_processes()[source]#

If a turbine is being reset after a tow-to-port repair or replacement, then all processes are assumed to be reset to 0, and not pick back up where they left off.

Return type:

None

interrupt_processes(origin=None, replacement=None)[source]#

Interrupts all of the running processes within the subassembly except for the process associated with failure that triggers the catastrophic failure.

Parameters:
  • origin (Subassembly) -- The subassembly that triggered the request, if the method call is coming from a subassembly shutdown event. If provided, and it is the same as the current subassembly, then a try/except flow is used to ensure the process that initiated the shutdown is not interrupting itself.

  • replacement (bool, optional) -- If a subassebly id is provided, this indicates the interruption is caused by its replacement event. Defaults to None.

Return type:

None

interrupt_all_subassembly_processes()[source]#

Thin wrapper for system.interrupt_all_subassembly_processes.

Return type:

None

trigger_request(action)[source]#

Triggers the actual repair or maintenance logic for a failure or maintenance event, respectively.

Parameters:

action (Maintenance | Failure) -- The maintenance or failure event that triggers a RepairRequest.

run_single_maintenance(maintenance)[source]#

Runs a process to trigger one type of maintenance request throughout the simulation.

Parameters:

maintenance (Maintenance) -- A maintenance category.

Yields:

simpy.events. HOURS_IN_DAY -- Time between maintenance requests.

Return type:

Generator

run_single_failure(failure)[source]#

Runs a process to trigger one type of failure repair request throughout the simulation.

Parameters:

failure (Failure) -- A failure classification.

Yields:

simpy.events. HOURS_IN_DAY -- Time between failure events that need to request a repair.

Return type:

Generator

Cable: Hybrid system and subassembly model#

"Defines the Cable class and cable simulations.

class wombat.windfarm.system.cable.Cable(windfarm, env, connection_type, start_node, end_node, cable_data, name=None)[source]#

The cable system/asset class.

Parameters:
  • windfarm (wombat.windfarm.Windfarm) -- The Windfarm object.

  • env (WombatEnvironment) -- The simulation environment.

  • cable_id (str) -- The unique identifier for the cable.

  • connection_type (str) -- The type of cable. Must be one of "array" or "export".

  • start_node (str) -- The starting point (system.id) (turbine or substation) of the cable segment.

  • cable_data (dict) -- The dictionary defining the cable segment.

  • end_node (str)

  • name (str | None)

set_string_details(start_node, substation)[source]#

Sets the starting turbine for the string to be used for traversing the correct upstream connections when resetting after a failure.

Parameters:
  • start_node (str) -- The System.id for the starting turbine on a string.

  • substation (str) -- The System.id for the string's connecting substation.

finish_setup()[source]#

Creates the upstream_nodes and upstream_cables attributes for use by the cable when triggering usptream failures and resetting them after the repair is complete.

Return type:

None

_create_processes()[source]#

Creates the processes for each of the failure and maintenance types.

Yields:

Tuple[Union[str, int], simpy.events.Process] -- Creates a dictionary to keep track of the running processes within the subassembly.

recreate_processes()[source]#

If a cable is being reset after a replacement, then all processes are assumed to be reset to 0, and not pick back up where they left off.

Return type:

None

interrupt_processes(replacement=None)[source]#

Interrupts all of the running processes within the subassembly except for the process associated with failure that triggers the catastrophic failure.

Parameters:
  • subassembly (Subassembly) -- The subassembly that should have all processes interrupted.

  • replacement (bool, optional) -- If a subassebly id is provided, this indicates the interruption is caused by its replacement event. Defaults to None.

Return type:

None

interrupt_all_subassembly_processes(replacement=None)[source]#

Thin wrapper for interrupt_processes for consistent usage with system.

Parameters:

replacement (bool, optional) -- If a subassebly id is provided, this indicates the interruption is caused by its replacement event. Defaults to None.

Return type:

None

stop_all_upstream_processes(failure)[source]#

Stops all upstream turbines and cables from producing power by creating a env.event() for each System.cable_failure and Cable.downstream_failure, respectively. In the case of an export cable, each string is traversed to stop the substation and upstream turbines and cables.

Parameters:

failure (Failre) -- The Failure that is causing a string shutdown.

Return type:

None

trigger_request(action)[source]#

Triggers the actual repair or maintenance logic for a failure or maintenance event, respectively.

Parameters:

action (Maintenance | Failure) -- The maintenance or failure event that triggers a RepairRequest.

run_single_maintenance(maintenance)[source]#

Runs a process to trigger one type of maintenance request throughout the simulation.

Parameters:

maintenance (Maintenance) -- A maintenance category.

Yields:

simpy.events.Timeout -- Time between maintenance requests.

Return type:

Generator

run_single_failure(failure)[source]#

Runs a process to trigger one type of failure repair request throughout the simulation.

Parameters:

failure (Failure) -- A failure classification.

Yields:

simpy.events.Timeout -- Time between failure events that need to request a repair.

Return type:

Generator