# Energy Management of a Multi-Source Power System
## 3 Methodology
### Mathematical Model
#### 3.1.2 Model Formulation  
Objective Function  
\[Min\sum_{k=1}^{N}\left(\sum_{j=1}^{2}w_{B_{j}}P_{k}^{B_{j}}\Big{(}1-ch_{k}^{B_ {j}}\Big{)}\right)+\left(w_{C}P_{k}^{C}\Big{(}1-ch_{k}^{C}\Big{)}\right)+\left( w_{PV}P_{k}^{PV}\right)+\left(w_{FC}P_{k}^{FC}\right) \tag{1}\]  
The objective function (1) is of minimization type based on weights assigned to the different power sources that are utilized by the system. The model will use the sources with lowest weight as the preferred source to meet the needed power while the sources with highest weight will be used as needed to ensure that the duration of usage of the system is extended by considering the demand and its nature. The weights are based on four criteria which are cost of using the source, the ease of charging the source, the duration in which the source is able to supply power, and the discharge speed of the source. The first term in the objective function is for the battery, the second term is for the super capacitor, the third is for the photovoltaic cell, and the last term is for the fuel cell. If the batteries or the super capacitor are being charged, the power used to charge these sources will not be considered in the objective function. For instance, if the first battery is being charged from the photovoltaic cell, the power consumed by the battery and supplied by the photovoltaic cell will not be considered in the objective function. Therefore, the power provided by the batteries and super capacitor is multiplied by a factor, \(\Big{(}1-ch_{k}^{B_{j}}\Big{)}\) and \(\Big{(}1-ch_{k}^{C}\Big{)}\), made equal to zero when one of these sources is being charged, as shown in the objective function above. All of these sources do not behave in the same manner; each has its own unique characteristics and running costs. A weighting system will be used to account for these differences, developed using an analytic hierarchy process (AHP) presented in Section 3.2. The power supplied by each of the sources will be multiplied by the assigned weight to it; \(w_{B_{j}}\), \(w_{C}\), \(w_{PV}\), \(w_{FC}\) as shown in the objective function. As an example, we are considering the weights to be $/W (watt of power), but they can have any monetary/appropriate unit as necessary. Constraints  
All of the below equations are essentially constraints to be obeyed while minimizing (1). Battery Model  
The state-of-charge (SOC) of the battery is calculated continuously as the system is running using the following Equation (2). The current through the battery is calculated using Equation (3). The battery is operated at rated conditions, providing the maximum continuous current the system is designed for, and for which a specific battery is selected. \[SOC_{k}^{B_{j}}=\Delta t\frac{-1}{C_{C}}I_{k}^{B_{j}}\Big{(}S_{k}^{B_{j}}-ch_{ k}^{B_{j}}\Big{)}+\ SOC_{k}^{B_{j}}((k-1))\ \ \forall k \tag{2}\]  
\[I_{k}^{B_{j}}=I_{Brated}\ \ \forall k \tag{3}\]It is assumed that the battery voltage remains constant. The assumption of a constant voltage is valid because a voltage regulator is usually present along with such a battery based supply system. Therefore, the power provided by the battery is calculated using Equation (4). \[P_{k}^{B_{j}}=V_{k}^{B_{j}}l_{k}^{B_{j}}\big{(}S_{k}^{B_{j}}+ch_{k}^{B_{j}}\big{)} \ \ \forall k \tag{4}\]  
Constraint (5) ensures that both batteries are either charging, idle, or supplying at each time step \(k\). Constraint (6) ensures that only one of the batteries is charging at time step \(k\). Constraint (7) ensures that the state of charge of the batteries stays between 30% and 100% to protect the lifetime of the battery. \[S_{k}^{B_{j}}+ch_{k}^{B_{j}}\leq 1\ \ \forall k \tag{5}\]  
\[\sum_{j=1}^{2}ch_{k}^{B_{j}}\leq 1\ \ \forall k \tag{6}\]  
\[30\%\ \leq\ SOC_{k}^{B_{j}}\leq 100\%\ \ \forall k \tag{7}\]  
Super Capacitor Model  
The time constant of the super capacitor is calculated using Equation (8). When the super capacitor is charging, the voltage is calculated using Equation (9).