Devices¶
Device models for dynamic energy management.
Each device has one or more terminals each of which has associated with it a vector representing power consumption or generation. Formally, we denote this power schedule as \(p = (p(1), \ldots, p(T)) \in \mathbb{R}^T\) and devices specify the objective function and constraints imposed by each device over these power flows.
-
class
dem.devices.
Generator
(power_min=0, power_max=0, ramp_min=None, ramp_max=None, power_init=0, alpha=0, beta=0, name=None)¶ Bases:
dem.network.Device
Generator with quadratic cost and optional ramp constraints.
A generator has range and ramp rate constraints defining the operating region, for \(\tau = 1,\ldots,T\)
\[\begin{split}P^{\min} \le -p(\tau) \le P^{\max} \\ R^{\min} \le -(p(\tau) - p(\tau - 1)) \le R^{\max}\end{split}\]where \(p(0)\) is defined to be \(p^\mathrm{init}\) is the initial power produced by the generator. If \(R^{\min}\) or \(R^{\max}\) are unspecified, the minimum or maximum ramp rate is unconstrained, respectively.
The cost function is separable across time periods
\[\sum_{\tau=1}^T \phi(-p(\tau))\]and quadratic, \(\phi(x) = \alpha x^2 + \beta x\), parameterized by \(\alpha, \beta \in \mathbb{R}\).
Parameters: - power_min (float or sequence of float) – Minimum power generation, \(P^\min\)
- power_max (float or sequence of float) – Maximum power generation, \(P^\max\)
- alpha (float or sequence of float) – Quadratic term in cost function, \(\alpha\)
- beta (float or sequence of float) – Linear term in cost function, \(\beta\)
- ramp_min (float or sequence of float) – (optional) Minimum ramp rate, \(R^\min\)
- ramp_max (float or sequence of float) – (optional) Maximum ramp rate, \(R^\max\)
- power_init (float) – (optional) Initial power generation for ramp constraints, \(p^\mathrm{init}\)
- name (string) – (optional) Display name for generator
-
class
dem.devices.
FixedLoad
(power=None, name=None)¶ Bases:
dem.network.Device
Fixed load.
A fixed load has a specified profile \(l \in \mathbb{R}^T\), enforced with constraint
\[p = l.\]Parameters: - power (float or sequence of float) – Load profile, \(l\)
- name (string) – (optional) Display name for load
-
class
dem.devices.
ThermalLoad
(temp_init=None, temp_min=None, temp_max=None, temp_amb=None, power_max=None, amb_conduct_coeff=None, efficiency=None, capacity=None, name=None)¶ Bases:
dem.network.Device
Thermal load.
A thermal load consists of a heat store (e.g. building, refrigerator), with a temperature profile \(\theta \in \mathbb{R}^T\) which must be maintained within \([\theta^\min,\theta^\max]\). The temperature evolves as
\[\theta(\tau + 1) = \theta(\tau) + (\mu/c)(\theta^\mathrm{amb}(\tau) - \theta(\tau)) - (\eta/c)p(\tau)\]for \(\tau = 1,\ldots,T-1\) and \(\theta(1) = \theta^{\mathrm{init}}\), where \(\mu\) is the ambient conduction coefficient, \(\eta\) is the heating/cooling efficiency, \(c\) is the heat capacity of the heat store, \(\theta \in \mathbb{R}^T\) is the ambient temperature profile and \(\theta^{\mathrm{init}}\) is the initial temperature of the heat store.
The power consumption of is constrained by
\[0 \le p \le P^\max.\]Parameters: - temp_init (float) – Initial tempeature, \(\theta^\mathrm{init}\)
- temp_min (float or sequence of floats) – Minimum temperature, \(\theta^\min\)
- temp_max (float or sequence of floats) – Maximum temperature, \(\theta^\max\)
- temp_amb (float or sequence of floats) – Ambient temperature, \(\theta^\mathrm{amb}\)
- power_max (float or sequence of floats) – Maximum power consumption, \(P^\max\)
- amb_conduct_coeff (float or sequence of floats) – Ambient conduction coefficient, \(\mu\)
- efficiency (float or sequence of floats) – Heating/cooling efficiency, \(\eta\)
- capacity (float or sequence of floats) – Heat capacity of the heat store, \(c\)
-
class
dem.devices.
CurtailableLoad
(power=None, alpha=None, name=None)¶ Bases:
dem.network.Device
Curtailable load.
A curtailable load penalizes the shortfall between a desired load profile \(l \in \mathbb{R}^T\) and delivered power with the linear penalty
\[\alpha \sum_{\tau=1}^T (l(\tau) - p(\tau))_+\]where \((z)_+ = \max(0, z)\) and \(\alpha > 0\) is curtailment penalty. Conceptually, the linear curtailment penalty represents the price paid for reducing load.
Parameters: - power (float or sequence of float) – Desired load profile, \(l\)
- alpha (float or sequence of float) – Linear curtailment penalty, \(\alpha\)
- name (string) – (optional) Display name for load
-
class
dem.devices.
DeferrableLoad
(energy=0, power_max=None, time_start=0, time_end=None, name=None)¶ Bases:
dem.network.Device
Deferrable load.
A deferrable load must consume a certain amount of energy \(E\) over a flexible time horizon \(\tau = A,\ldots,D\). This is characterized by the constraint
\[\sum_{\tau=A}^{D} p(\tau) \ge E\]In addition, the power consumption in any interval is bounded by
\[p \le P^\max\]Parameters: - energy (float) – Desired energy consumption, \(E\)
- power_max (float or sequence of float) – Maximum power consumption, \(P^\max\)
- time_start (int) – Starting interval, inclusive, \(A\)
- time_end (int) – Ending interval, inclusive, \(D\)
- name (string) – (optional) Display name for load
-
class
dem.devices.
TransmissionLine
(power_max=None, name=None)¶ Bases:
dem.network.Device
Transmission line.
A lossless transmission line has two terminals with power schedules \(p_1\) and \(p_2\). Conservation of energy across the line is enforced with the constraint
\[p_1 + p_2 = 0,\]and a maximum capacity of \(P^\max\) with
\[|p_1| \le P^\max.\]Parameters: - power_max (float or sequence of floats) – Maximum capacity of the transmission line
- name (string) – (optional) Display name for transmission line
-
class
dem.devices.
Storage
(discharge_max=0, charge_max=None, energy_init=0, energy_max=None, name=None)¶ Bases:
dem.network.Device
Storage device.
A storage device either takes or delivers power with charging and discharging rates specified by the constraints
\[-D^\max \le p \le C^\max\]where \(C^\max\) and \(D^\max\) are the maximum charging and discharging rates. The charge level of the battery is given by
\[q(\tau) = q^\mathrm{init} + \sum_{t=1}^\tau p(t), \quad \tau = 1, \ldots, T,\]which is constrained according to the physical limits of the battery
\[0 \le q \le Q^\max.\]Parameters: - discharge_max (float or sequence of floats) – Maximum discharge rate, \(D^\max\)
- charge_max (float or sequence of floats) – Maximum charge rate, \(C^\max\)
- energy_init (float) – Initial charge, \(q^\mathrm{init}\)
- energy_max (float or sequence of floats) – Maximum battery capacity, \(Q^\max\)
- name (string) – (optional) Display name of storage device
Generators¶
-
class
dem.devices.
Generator
(power_min=0, power_max=0, ramp_min=None, ramp_max=None, power_init=0, alpha=0, beta=0, name=None) Bases:
dem.network.Device
Generator with quadratic cost and optional ramp constraints.
A generator has range and ramp rate constraints defining the operating region, for \(\tau = 1,\ldots,T\)
\[\begin{split}P^{\min} \le -p(\tau) \le P^{\max} \\ R^{\min} \le -(p(\tau) - p(\tau - 1)) \le R^{\max}\end{split}\]where \(p(0)\) is defined to be \(p^\mathrm{init}\) is the initial power produced by the generator. If \(R^{\min}\) or \(R^{\max}\) are unspecified, the minimum or maximum ramp rate is unconstrained, respectively.
The cost function is separable across time periods
\[\sum_{\tau=1}^T \phi(-p(\tau))\]and quadratic, \(\phi(x) = \alpha x^2 + \beta x\), parameterized by \(\alpha, \beta \in \mathbb{R}\).
Parameters: - power_min (float or sequence of float) – Minimum power generation, \(P^\min\)
- power_max (float or sequence of float) – Maximum power generation, \(P^\max\)
- alpha (float or sequence of float) – Quadratic term in cost function, \(\alpha\)
- beta (float or sequence of float) – Linear term in cost function, \(\beta\)
- ramp_min (float or sequence of float) – (optional) Minimum ramp rate, \(R^\min\)
- ramp_max (float or sequence of float) – (optional) Maximum ramp rate, \(R^\max\)
- power_init (float) – (optional) Initial power generation for ramp constraints, \(p^\mathrm{init}\)
- name (string) – (optional) Display name for generator
Loads¶
-
class
dem.devices.
FixedLoad
(power=None, name=None) Bases:
dem.network.Device
Fixed load.
A fixed load has a specified profile \(l \in \mathbb{R}^T\), enforced with constraint
\[p = l.\]Parameters: - power (float or sequence of float) – Load profile, \(l\)
- name (string) – (optional) Display name for load
-
class
dem.devices.
DeferrableLoad
(energy=0, power_max=None, time_start=0, time_end=None, name=None) Bases:
dem.network.Device
Deferrable load.
A deferrable load must consume a certain amount of energy \(E\) over a flexible time horizon \(\tau = A,\ldots,D\). This is characterized by the constraint
\[\sum_{\tau=A}^{D} p(\tau) \ge E\]In addition, the power consumption in any interval is bounded by
\[p \le P^\max\]Parameters: - energy (float) – Desired energy consumption, \(E\)
- power_max (float or sequence of float) – Maximum power consumption, \(P^\max\)
- time_start (int) – Starting interval, inclusive, \(A\)
- time_end (int) – Ending interval, inclusive, \(D\)
- name (string) – (optional) Display name for load
-
class
dem.devices.
CurtailableLoad
(power=None, alpha=None, name=None) Bases:
dem.network.Device
Curtailable load.
A curtailable load penalizes the shortfall between a desired load profile \(l \in \mathbb{R}^T\) and delivered power with the linear penalty
\[\alpha \sum_{\tau=1}^T (l(\tau) - p(\tau))_+\]where \((z)_+ = \max(0, z)\) and \(\alpha > 0\) is curtailment penalty. Conceptually, the linear curtailment penalty represents the price paid for reducing load.
Parameters: - power (float or sequence of float) – Desired load profile, \(l\)
- alpha (float or sequence of float) – Linear curtailment penalty, \(\alpha\)
- name (string) – (optional) Display name for load
-
class
dem.devices.
ThermalLoad
(temp_init=None, temp_min=None, temp_max=None, temp_amb=None, power_max=None, amb_conduct_coeff=None, efficiency=None, capacity=None, name=None) Bases:
dem.network.Device
Thermal load.
A thermal load consists of a heat store (e.g. building, refrigerator), with a temperature profile \(\theta \in \mathbb{R}^T\) which must be maintained within \([\theta^\min,\theta^\max]\). The temperature evolves as
\[\theta(\tau + 1) = \theta(\tau) + (\mu/c)(\theta^\mathrm{amb}(\tau) - \theta(\tau)) - (\eta/c)p(\tau)\]for \(\tau = 1,\ldots,T-1\) and \(\theta(1) = \theta^{\mathrm{init}}\), where \(\mu\) is the ambient conduction coefficient, \(\eta\) is the heating/cooling efficiency, \(c\) is the heat capacity of the heat store, \(\theta \in \mathbb{R}^T\) is the ambient temperature profile and \(\theta^{\mathrm{init}}\) is the initial temperature of the heat store.
The power consumption of is constrained by
\[0 \le p \le P^\max.\]Parameters: - temp_init (float) – Initial tempeature, \(\theta^\mathrm{init}\)
- temp_min (float or sequence of floats) – Minimum temperature, \(\theta^\min\)
- temp_max (float or sequence of floats) – Maximum temperature, \(\theta^\max\)
- temp_amb (float or sequence of floats) – Ambient temperature, \(\theta^\mathrm{amb}\)
- power_max (float or sequence of floats) – Maximum power consumption, \(P^\max\)
- amb_conduct_coeff (float or sequence of floats) – Ambient conduction coefficient, \(\mu\)
- efficiency (float or sequence of floats) – Heating/cooling efficiency, \(\eta\)
- capacity (float or sequence of floats) – Heat capacity of the heat store, \(c\)
Storage devices¶
-
class
dem.devices.
Storage
(discharge_max=0, charge_max=None, energy_init=0, energy_max=None, name=None) Bases:
dem.network.Device
Storage device.
A storage device either takes or delivers power with charging and discharging rates specified by the constraints
\[-D^\max \le p \le C^\max\]where \(C^\max\) and \(D^\max\) are the maximum charging and discharging rates. The charge level of the battery is given by
\[q(\tau) = q^\mathrm{init} + \sum_{t=1}^\tau p(t), \quad \tau = 1, \ldots, T,\]which is constrained according to the physical limits of the battery
\[0 \le q \le Q^\max.\]Parameters: - discharge_max (float or sequence of floats) – Maximum discharge rate, \(D^\max\)
- charge_max (float or sequence of floats) – Maximum charge rate, \(C^\max\)
- energy_init (float) – Initial charge, \(q^\mathrm{init}\)
- energy_max (float or sequence of floats) – Maximum battery capacity, \(Q^\max\)
- name (string) – (optional) Display name of storage device
Transmission lines¶
-
class
dem.devices.
TransmissionLine
(power_max=None, name=None) Bases:
dem.network.Device
Transmission line.
A lossless transmission line has two terminals with power schedules \(p_1\) and \(p_2\). Conservation of energy across the line is enforced with the constraint
\[p_1 + p_2 = 0,\]and a maximum capacity of \(P^\max\) with
\[|p_1| \le P^\max.\]Parameters: - power_max (float or sequence of floats) – Maximum capacity of the transmission line
- name (string) – (optional) Display name for transmission line