Wind
The WindPowerModels model the total production of power from wind in percentage of the total wind capacity. That means that all simulated values that will be returned by these models are between 0 and 1.
Instantenous Production Models (Spot Models)
- class rivapy.models.WindPowerModel(deviation_process: object, seasonal_function: object, name: str = 'Wind_Germany')[source]
Bases:
BaseModel
Wind Power Model to model the efficiency of wind power production.
- Parameters:
speed_of_mean_reversion (Union[float, Callable]) – _description_
volatility (Union[float, Callable]) – _description_
mean_level (Union[float, Callable]) – _description_
- static calibrate(deviation_model, capacities: DataFrame, data: DataFrame, seasonality_function, min_efficiency=0.001, max_efficiency=0.99, **kwargs)[source]
- simulate(timegrid: DateTimeGrid, start_value, rnd)[source]
Forecast Models (Forward Models)
WindPowerForecastModel
- class rivapy.models.WindPowerForecastModel(region: str, speed_of_mean_reversion: float, volatility: float, params: WindPowerForecastModelParameter = None)[source]
Bases:
BaseFwdModel
Simple model to simulate forecasts of wind efficiencies (power production by wind as percentage of total wind capacity) based on the Ornstein-Uhlenbeck process.
The base model used within this model is the Ornstein-Uhlenbeck process and uses internally the class
rivapy.models.OrnsteinUhlenbeck
with a mean level of zero to simulate the forecast. Here, the forecast of wind efficiency \(w_{t,T}\) at time \(T\) is computed as the expected value of the standard logistic function (sigmoid) applied to the Ornstein-Uhlenbeck process conditioned on current simulated value, i.e.\[w_{t, T} = \frac{1}{1+e^{-(X_{t,T}+\nu(T))}}\]where \(X_{t,T}:=E[X_T\mid X_t]\) with
\[dX = -\lambda X dt + \sigma dW_t, X(0) = 0\]and \(\nu(T)\) is a correction term to ensure that the initial value of \(w_{t,T}\) is equal to a given initial forecast \(\bar{w}_{0,T}\). It is computed by
\[\nu(T) := \log\frac{\bar{w}_{0,T}}{(1.0-\bar{w}_{0,T})}.\]The sigmoid function is applied to ensure that the forecast is between 0 and 1 (as percentage of total wind capacity)
- Parameters:
speed_of_mean_reversion (float) – The speed of mean reversion of the underlying Ornstein-Uhlenbeck process (
rivapy.models.OrnsteinUhlenbeck
).volatility (float) – The volatility of the underlying Ornstein-Uhlenbeck process (
rivapy.models.OrnsteinUhlenbeck
).region (str) – The name of the respective wind region.
- class ForwardSimulationResult(paths: ndarray, wind_forecast_model, timegrid, expiries, initial_forecasts)[source]
Bases:
ForwardSimulationResult
- simulate(timegrid, rnd: ndarray, expiries: List[float], initial_forecasts: List[float], startvalue=0.0) ForwardSimulationResult [source]
MultiRegionWindForecastModel
- class rivapy.models.MultiRegionWindForecastModel(name: str, region_forecast_models: List[Region])[source]
Bases:
BaseFwdModel
Simple model to simulate power forecasts for more then one wind region and a total efficiency over all regions.
This model relates the wind models for the different regions within the simulation by just using a linear sum of normal random variates, i.e. for a region \(r\) we have weights \(w_{r,i}\), \(1\leq i\leq N\), so that within the simulation based on \(n\) different normal random variates \(X_i\) we compute the random variate for the region by
\[X_{r,i} = \frac{\sum_i w_{r,i} X_i}{\sqrt{\sum_i w_{r,i}^2}}.\]- Parameters:
name (str) – Name of the overall region.
region_forecast_models (List[Region]) – List of regions that will be simulated.
Examples
>>> wind_onshore = WindPowerForecastModel(region='Onshore', speed_of_mean_reversion=0.1, volatility=4.80) >>> wind_offshore = WindPowerForecastModel(region='Offshore', speed_of_mean_reversion=0.5, volatility=4.80) >>> regions = [ MultiRegionWindForecastModel.Region( wind_onshore, capacity=1000.0, rnd_weights=[0.8,0.2] ), MultiRegionWindForecastModel.Region( wind_offshore, capacity=100.0, rnd_weights=[0.2,0.8] ) ] >>> wind = MultiRegionWindForecastModel('Wind_Germany', regions) >>> # after model setup we simulate forecasts >>> days = 10 >>> timegrid = np.linspace(0.0, days*1.0/365.0, days*24) >>> forward_expiries = [timegrid[-1] + i/(365.0*24.0) for i in range(4)] >>> rnd = np.random.normal(size=wind.rnd_shape(n_sims, timegrid.shape[0])) >>> results = wind.simulate(timegrid, rnd, expiries=forward_expiries, initial_forecasts={'Onshore': [0.8, 0.7,0.6,0.5], 'Offshore': [0.6, 0.6, 0.5, 0.5]} )
- class Region(model: WindPowerForecastModel, capacity: float, rnd_weights: List[float])[source]
Bases:
FactoryObject
Solar
SolarPowerModel
- class rivapy.models.SolarPowerModel(daily_maximum_process, profile, mean_level, name: str = 'Solar_Germany')[source]
Bases:
BaseModel
- simulate(timegrid: DateTimeGrid, start_value: float, rnd)[source]
Power
Spot Models
ResidualDemandModel
- class rivapy.models.ResidualDemandModel(wind_model: object, capacity_wind: float, solar_model: object, capacity_solar: float, load_model: object, supply_curve: object, power_name: str)[source]
Bases:
BaseModel
Residual demand model to model power prices.
This model is based on the paper by Wagner[1] and models power (spot) prices \(p_t\) depending (by a deterministic function \(f\)) on the residual demand \(R_t\),
\[p_t = f(R_t) = f(L_t - IC^w\cdot E_t^w - IC_t^s\cdot E_t^s)\]where
\(L_t\) is the demand (load) at time \(t\),
\(IC^w\) denotes the installed capacity of wind (in contrast to the paper this is not time dependent),
\(E_t^w\) is the wind efficiency at time \(t\),
\(IC^s\) denotes the installed capacity of solar (in contrast to the paper this is not time dependent),
\(E_t^s\) is the solar efficiency at time \(t\).
- Parameters:
wind_model (object) – Model for wind efficiency (needs to implement a method simulate in order to work with this model). See
rivapy.models.WindPowerModel()
as an example for a wind model.capacity_wind (object) – The capacity of wind power. This is multiplied with the simulated efficiency to obtain the simulated absolute amount of wind.
solar_model (object) – Model for solar efficiency (needs to implement a method simulate in order to work with this model). See
rivapy.models.SolarPowerModel()
as an example for a solar model.capacity_solar (object) – The capacity of solar power. This is multiplied with the simulated efficiency to obtain the simulated absolute amount of solar.
load_model (object) – Model for load. See
rivapy.models.LoadModel()
as an example for a load model.supply_curve (object) – The total demand, see
rivapy.models.SupplyFunction()
for an example.power_name (str) – Name of the simulated power. This is used within pricing to identify the simulated power.
wind_name (str) – Name of the simulated wind. This is used within pricing to identify the simulated wind.
- simulate(timegrid: DateTimeGrid, start_value_wind: float, start_value_solar: float, start_value_load: float, n_sims: int, rnd_wind: ndarray = None, rnd_solar: ndarray = None, rnd_load: float = None, seed=None)[source]
Simulate the residual demand model on a given datetimegrid.
- Parameters:
timegrid (DateTimeGrid) – _description_
start_value_wind (float) – _description_
start_value_solar (float) – _description_
start_value_load (float) – _description_
n_sims (int) – _description_
rnd_wind (np.ndarray, optional) – _description_. Defaults to None.
rnd_solar (np.ndarray, optional) – _description_. Defaults to None.
rnd_load (float, optional) – _description_. Defaults to None.
rnd_state (_type_, optional) – _description_. Defaults to None.
- Returns:
_description_
- Return type:
_type_
Forward Models
LinearDemandForwardModel
- class rivapy.models.LinearDemandForwardModel(wind_power_forecast: MultiRegionWindForecastModel, x_volatility: float, x_mean_reversion_speed: float, power_name: str = None)[source]
Bases:
BaseFwdModel
- class ForwardSimulationResult(model, highest_price, wind_results, additive_correction)[source]
Bases:
ForwardSimulationResult
- get_technology() str [source]
Return name of the technology modeled.
- Returns:
Name of instrument.
- Return type:
str
ResidualDemandForwardModel
- class rivapy.models.ResidualDemandForwardModel(wind_power_forecast, highest_price_ou_model, supply_curve: Callable[[float], float], max_price: float, power_name: str = None)[source]
Bases:
BaseFwdModel
- class ForwardSimulationResult(model, highest_price, wind_results)[source]
Bases:
ForwardSimulationResult
- get_technology() str [source]
Return name of the technology modeled.
- Returns:
Name of instrument.
- Return type:
str
LoadModel
- class rivapy.models.LoadModel(deviation_process: object, load_profile: object)[source]
Bases:
object
Model the power load.
- Parameters:
deviation_process (object) – _description_
load_profile (object) – _description_
- simulate(timegrid: DateTimeGrid, start_value: float, rnd: ndarray)[source]
SupplyFunction
- class rivapy.models.SupplyFunction(floor: tuple, cap: tuple, peak: tuple, offpeak: tuple, peak_hours: set)[source]
Bases:
object