assetra.simulation¶
- class assetra.simulation.ProbabilisticSimulation(start_hour: datetime, end_hour: datetime, trial_size: int)[source]¶
Class responsible for creating/storing aggregate probabilistic capacity matrices for EnergySystem objects.
- Parameters:
start_hour (datetime) – Starting simulation hour, for example “2016-01-01 00:00:00”
end_hour (datetime) – Ending simulation hour (inclusive).
trial_size (int) – Number of simulation Monte Carlo trials.
- copy() ProbabilisticSimulation[source]¶
Return a probabilistic simulation object with the same underlying parameters but no assigned system
- Returns:
- Simulation with same start hour, end hour,
and trial size as this object.
- Return type:
- assign_energy_system(energy_system: EnergySystem) None[source]¶
Assign an energy system to this probabilistic simulation object. Nullifies the stored capacity matrices
- Parameters:
energy_system (EnergySystem) – Energy system to simulate.
- Raises:
RuntimeWarning – Invalid type assigned to simulation energy system.
- property net_hourly_capacity_matrix: DataArray¶
Return a copy of the most recently evaluated net hourly capacity matrix
- Returns:
- Net hourly capacity matrix with dimensions (trials,
time) and shape (# of trials, # of hours)
- Return type:
xr.DataArray
- Raises:
RuntimeWarning – Net hourly capacity matrix accessed before running simulation
- get_hourly_capacity_matrix_by_type(unit_type: type) DataArray[source]¶
Return the resultant hourly capacity matrix for a unit_type.
Hourly capacity matrices for each unit dataset are evaluated by the energy unit classes. The probabilistic simulation stores a copy of the combined hourly capacity indexed by unit type. It is not possible to get the hourly capacity matrix for each unit of a specific type, only the aggregate.
If the hourly capacity matrix does not exist, trigger a simulation run
- Parameters:
unit_type (_type_) – A valid energy unit type.
- Returns:
- Hourly capacity matrix with dimensions (trials, time)
and shape (# of trials, # of hours)
- Return type:
xr.DataArray
- Raises:
RuntimeWarning – Net hourly capacity matrix accessed before running simulation
- run(net_hourly_capacity_matrix: DataArray = None) None[source]¶
Run the probabilistic simulation. This function evaluates the net hourly capacity matrix and hourly capacity matrix for each unit type. Optionally, provide a pre-existing net hourly capacity matrix to dispatch onto.
An energy system should already be assigned to the simulation object.
- Parameters:
net_hourly_capacity_matrix (xr.DataArray, optional) – A net hourly
start/end (capacity matrix from a similar simulation with the same)
passed (hours and trial size. If)
modified. (the matrix is)
None. (Defaults to)
- Raises:
RuntimeWarning – Energy system not assigned to simulation object.