# Cost Analysis and Optimization of Modern Power System Operations
## 2 Mathematical Formulation
The three integer decision variables are governed by the following equations, \[\mathbf{FCi}(\mathbf{Pi}(\mathbf{t}))=\mathbf{Ai}+\mathbf{BiPi}(\mathbf{t})+\mathbf{CiPi}^{2}(\mathbf{t}) \tag{2}\]5 (16) \[\mathbf{FCi}(\mathbf{Pi}(\mathbf{t}))=\mathbf{Ai}+\mathbf{BiPi}(\mathbf{t})+\mathbf{CiPi}^{2}(\mathbf{t}) \tag{2}\]6 (17) \[\mathbf{FCi}(\mathbf{Pi}(\mathbf{t}))=\mathbf{Ai}+\mathbf{BiPi}(\mathbf{t})+\mathbf{CiPi}^{2}(\mathbf{t}) \tag{2}\]7 (18) The minimum up time (\(U\Pi\)) for the \(i\)th unit is given as follows, \[\mathbf{FCi}(\mathbf{Pi}(\mathbf{t}))=\mathbf{Ai}+\mathbf{BiPi}(\mathbf{t})+\mathbf{CiPi}^{2}(\mathbf{t}) \tag{2}\]8 (19) \[\mathbf{FCi}(\mathbf{Pi}(\mathbf{t}))=\mathbf{Ai}+\mathbf{BiPi}(\mathbf{t})+\mathbf{CiPi}^{2}(\mathbf{t}) \tag{2}\]9 (20) \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]0 (21) \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]1 (22) The minimum down time (\(DT\Pi\)) for the \(i\)th unit is given as follows, \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]2 (23) \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]3 (24) \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]4 (25) \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]5 (26)
* Start-Up/Shut-Down Cost: This cost is incurred for starting up and shutting down any generating unit from the system and is modelled by the help of the following equations, \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]6 (27) \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]7 (28)  
The flowchart shown in Figure 1 outlines the coding logic implemented in the GAMS Integrated Development Environment (IDE) for simulating the proposed system [28; 29]. The process begins with defining various input sets such as the time horizon, generator indices, and cost segments. Once these sets are established, technical and economic data for each generator--such as cost coefficients, minimum and maximum generation capacities, and ramp rates--are provided in tabular form. Subsequently, functions are developed to automatically retrieve the required parameters during each simulation cycle. The next step involves inputting hourly load data for the defined time horizon, along with the corresponding electricity prices associated with meeting that load. Following this, various decision variables are declared. Binary variables include \(u\) (\(i\), \(t\)), \(y\) (\(i\), \(t\)), and \(z\) (\(i\), \(t\)), while positive variables represent parameters such as start-up cost, shut-down cost, and generator output levels at each time step t.  
After variable declarations, all operational constraints--such as ramp rate limits, minimum up/down time, generation-load balance, and demand flexibility--are formulated using standard equation syntax supported by GAMS 24.9.1. Once the objective function, variables, and constraints are fully defined, an appropriate solver must be selected. GAMS offers a range of solvers such as ALPHAECP, AMPL, BDML, and LINDOGLOBAL12.0, among others. \[\sum_{i}\mathbf{P}\;\mathbf{i,t}\geq\mathbf{L}\;\mathbf{t} \tag{3}\]8 Flowchart for the proposed code logic. It is crucial to include all relevant equations in the solve command; otherwise, the solver will ignore omitted constraints. Upon execution, the solver iterates through various generator combinations to meet the load demand while minimizing total operating cost. The output includes generator schedules, associated start-up and shut-down costs, and a summary of the total operating cost, typically presented in tabular format.