# The Anatomy of a Model 
## An Introduction to JuMP for Algebraic Modeling

_**[Power Systems Optimization](https://github.com/east-winds/power-systems-optimization)**_

_by Jesse D. Jenkins and Michael R. Davidson (last updated: September 16, 2020)_

This notebook will provide a basic introduction to [algebraic modeling](https://en.wikipedia.org/wiki/Algebraic_modeling_language) for [constrained optimization](https://en.wikipedia.org/wiki/Constrained_optimization) problems using the [Julia](https://julialang.org/) language and [JuMP](http://jump.dev/). The notebook will walk through the main components of an optimization model (decision variables, constraints, expressions, sets, objective function), show how to interface with a solver to find solutions to the model, and how to read solutions outputs back into Julia [DataFrames](https://juliadata.github.io/DataFrames.jl/stable/) and/or [write outputs to .csv files](https://juliadata.github.io/CSV.jl/stable/) for post-processing.

For additional resources, see the collection of notebooks provided at [JuMPTutorials.jl](https://github.com/jump-dev/JuMPTutorials.jl).



### What is JuMP?

[JuMP](http://jump.dev/) ("Julia for Mathematical Programming") is an open-source modeling language and supporting packages for mathematical optimization/algebraic programming in the [Julia](https://julialang.org/) high performance scientific programming language. 

JuMP makes it easy to formulate and solve linear programming, semidefinite programming, integer programming, convex optimization, constrained nonlinear optimization, and related classes of optimization problems, using easy-to-read code with syntax that closely matches the mathematical formulation of optimization problems. 

These problems can then be solved via a variety of open source or commercial optimization solvers, using Julia packages for interfacing with each solver. Thus, the definition of an algebraic model for a constrained optimization problem in JuMP is independent of the choice of solver. 

In this way, JuMP is similar to [AMPL](https://en.wikipedia.org/wiki/AMPL), [AIIMS](https://en.wikipedia.org/wiki/AIMMS) or [GAMS](https://en.wikipedia.org/wiki/General_Algebraic_Modeling_System) -- all specialized languages built for algebraic modeling. However, JuMP offers the advantage of being embeded within a fully functioning, high-level programming language (Julia). In this way, it is similar to the [Pyomo](http://www.pyomo.org/) package for Python, but offers the higher computational performance of Julia (and less verbose syntax). (For a brief [comparison between Julia and Python](https://devathon.com/blog/julia-vs-python-which-programming-language-is-better/), see here).

### Installing JuMP

JuMP is a package for Julia. From Julia, JuMP is installed by using the built-in package manager. [See this guide to installing and setting up Julia and JuMP](http://bit.ly/JuliaSetupGuide) if you've not yet done so. But very briefly, one installs JuMP with the following code:


```julia
# Note, you don't need to run this block if JuMP is already installed
import Pkg
Pkg.add("JuMP")
```

    [32m[1m  Resolving[22m[39m package versions...
    [32m[1mNo Changes[22m[39m to `~/.julia/environments/v1.5/Project.toml`
    [32m[1mNo Changes[22m[39m to `~/.julia/environments/v1.5/Manifest.toml`


### Loading Julia packages

You only need to install JuMP once, but each time you start up Julia, you'll need to load the JuMP package and any other supporting packages you want to make use of. Here we'll load JuMP, [Cbc.jl](https://github.com/jump-dev/Clp.jl), the interface for the open source [COIN-OR Linear Programming solver](https://projects.coin-or.org/Clp).


```julia
# Note, you don't need to run this block if Clp package is already installed
import Pkg
Pkg.add("Clp")
```

    [32m[1m   Updating[22m[39m registry at `~/.julia/registries/General`


    [?25l    

    [32m[1m   Updating[22m[39m git-repo `https://github.com/JuliaRegistries/General.git`


    [2K[?25h[1mFetching:[22m[39m [========================================>]  99.9 % %                             ]  27.2 %                      ]  44.7 %>          ]  73.2 %]  76.1 % [====================================>    ]  89.9 %[36m[1mFetching:[22m[39m [=======================================> ]  95.9 %

    [32m[1m  Resolving[22m[39m package versions...
    [32m[1m  Installed[22m[39m FriBidi_jll ──── v1.0.5+5
    [32m[1m  Installed[22m[39m FFMPEG_jll ───── v4.3.1+2
    [32m[1m  Installed[22m[39m Bzip2_jll ────── v1.0.6+4
    [32m[1m  Installed[22m[39m FreeType2_jll ── v2.10.1+4
    [32m[1m  Installed[22m[39m Zlib_jll ─────── v1.2.11+16
    [32m[1m  Installed[22m[39m CoinUtils_jll ── v2.11.3+3
    [32m[1m  Installed[22m[39m Clp_jll ──────── v1.17.6+6
    [32m[1m  Installed[22m[39m Clp ──────────── v0.8.0
    [32m[1m  Installed[22m[39m OpenBLAS32_jll ─ v0.3.9+4
    [32m[1m  Installed[22m[39m Osi_jll ──────── v0.108.5+3
    [32m[1m  Installed[22m[39m CEnum ────────── v0.3.0
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    ######################################################################### 100.0%
    [32m[1mUpdating[22m[39m `~/.julia/environments/v1.5/Project.toml`
     [90m [e2554f3b] [39m[92m+ Clp v0.8.0[39m
    [32m[1mUpdating[22m[39m `~/.julia/environments/v1.5/Manifest.toml`
     [90m [6e34b625] [39m[93m↑ Bzip2_jll v1.0.6+3 ⇒ v1.0.6+4[39m
     [90m [fa961155] [39m[92m+ CEnum v0.3.0[39m
     [90m [e2554f3b] [39m[92m+ Clp v0.8.0[39m
     [90m [06985876] [39m[92m+ Clp_jll v1.17.6+6[39m
     [90m [be027038] [39m[92m+ CoinUtils_jll v2.11.3+3[39m
     [90m [b22a6f82] [39m[93m↑ FFMPEG_jll v4.3.1+1 ⇒ v4.3.1+2[39m
     [90m [d7e528f0] [39m[93m↑ FreeType2_jll v2.10.1+3 ⇒ v2.10.1+4[39m
     [90m [559328eb] [39m[93m↑ FriBidi_jll v1.0.5+4 ⇒ v1.0.5+5[39m
     [90m [656ef2d0] [39m[92m+ OpenBLAS32_jll v0.3.9+4[39m
     [90m [7da25872] [39m[92m+ Osi_jll v0.108.5+3[39m
     [90m [83775a58] [39m[93m↑ Zlib_jll v1.2.11+15 ⇒ v1.2.11+16[39m
    [32m[1m   Building[22m[39m Clp → `~/.julia/packages/Clp/cX6R7/deps/build.log`



```julia
# Load JuMP and Clp packages for use in this notebook
using JuMP
using Clp
```

## A factory example



Let's start by recalling our simple factory optimization example from the [Constrained Optimization notebook](Notebooks/Constrained-Optimization.ipynb), which seeks to maximize total revenue as a function of how many widgets of type A (decision variable $x$) and type B (decision variable $y$) to produce:

$$
\begin{align}
& \max 150 x + 175 y &\text{Objective function (revenue)}\\ 
& \text{s.t.} & \\
& 10 x + 8 y \leq \ 80 &\text{Time constraint}\\
& 7 x + 11 y \leq \ 77 &\text{Materials constraint}\\
& x \leq 8 &\text{Capacity constraint}\\
& x, y \geq 0 &\text{Non-negativity constraints}\\
\end{align}
$$


```julia
# import Pkg; Pkg.add("Plots") # Uncomment and run this line if you need to install Plots package
using Plots
plotly() # use plotly backend: https://docs.juliaplots.org/latest/generated/plotly/
```

    ┌ Info: For saving to png with the Plotly backend PlotlyBase has to be installed.
    └ @ Plots C:\Users\ccort\.julia\packages\Plots\uCh2y\src\backends.jl:372





    Plots.PlotlyBackend()




```julia
# set up parameters and variables
pa = 150
pb = 175
a = range(0,15,step=0.5)
b = range(0,10,step=0.5)

# define objective function
f(a, b) = begin  (pa*a + pb*b)  end 

contour(a,b,(a,b)->f(a,b),nlevels=10, c=:heat, linewidth=10, colorbar = false, contour_labels = true)
title!("Factory Optimization Problem")
xaxis!("x=Widget A")
yaxis!("y=Widget B")
xticks!(0:maximum(a))
yticks!(0:maximum(b))
areaplot!(a[a.<=11], (77 .- 7*a[a.<=11])./11, legend=false, opacity=0.3)
areaplot!(a[a.<=8], (80 .- 10*a[a.<=8])./8, legend=false, opacity=0.3)
areaplot!(a[a.<=8], repeat([maximum(b)],length(a[a.<=8])), legend=false, opacity=0.15)
#areaplot!([8;0;4.888], [0;7;3.888], legend=false, opacity=1.0)
#scatter!([8 0 4.88],[0 7 3.888])
```









<!DOCTYPE html>
<html>
    <head>
        <title>Plots.jl</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
    </head>
    <body>
            <div id="4fd13f5a-c126-47be-a9d2-8f8ba7dd696c" style="width:600px;height:400px;"></div>
    

    </body>
</html>




JuMP allows us to define an algebraic model that represents this optimization problem, which we'll do in several steps now...

### 1. Define the model

First, we **define the model**. A JuMP model object is a container for variables, constraints, solver options, etc. Models are created with the [Model()](https://jump.dev/JuMP.jl/stable/solvers/#JuMP.Model-Tuple{}) function. 


```julia
factory_model = Model();
```

### 2. Specify the optimization solver

To solve a model, we need to also specify the [optimization solver](https://jump.dev/JuMP.jl/stable/solvers/#) (or "optimizer") for JuMP to use. 

A solver is a software package that incorporates computanionally efficient algorithms for finding solutions to one or more classes of optimization problems -- e.g. [simplex](https://en.wikipedia.org/wiki/Simplex_algorithm) and [interior-point](https://en.wikipedia.org/wiki/Interior-point_method) algorithms for solving linear programming (LP) problems; [branch-and-bound](https://en.wikipedia.org/wiki/Branch_and_bound) and [branch-and-cut](https://en.wikipedia.org/wiki/Branch_and_cut) algorithms for solving mixed-integer linear programming (MILP) problems.

JuMP currently supports a number of open-source and commercial solvers which can be viewed
[here](http://www.juliaopt.org/JuMP.jl/v0.19.1/installation/#Getting-Solvers-1).

We specify the specific solver to use for this model either by using the [set_optimizer()](https://jump.dev/JuMP.jl/stable/solvers/#JuMP.set_optimizer) function or as an argument for the [Model()](https://jump.dev/JuMP.jl/stable/solvers/#JuMP.Model-Tuple{}) function when initially defining the model, as in the following examples...


```julia
set_optimizer(factory_model, Clp.Optimizer)
factory_model = Model(Clp.Optimizer);
```

Above, we specify the Clp solver interface. The argument `Clp.Optimizer` is an example of a JuMP "Optimizer Factory" parameter, a call to create an interface with a specific solver. Other examples include `GLPK.Optimizer`, `CPLEX.Optimizer`, `Gurobi.Optimizer`, etc.

### 3. Define variables

Next, we define our [decision variables](https://jump.dev/JuMP.jl/stable/variables/), using the JuMP [@variable](https://jump.dev/JuMP.jl/stable/variables/#JuMP.@variable) [macro](https://docs.julialang.org/en/v1/manual/metaprogramming/#man-macros). 

The first argument in the `@variable()` macro is a reference to the model object that this decision variable is associated with, in this case `factory_model`. 

We can also pass lower and/or upper bounds on the decision variables at the time they are created using `<=` and `>=` notation...


```julia
@variable(factory_model, 8 >= x >= 0) # How many widgets of type A, including capacity constraint as upper bound
```




$$ x $$




```julia
@variable(factory_model, y >= 0) # How many widgets of type B
```




$$ y $$



...Here we set a lower bound of 0 for both variables (e.g. ```y >= 0```), to reflect the non-negativity constraints in our decision variables (e.g. that we cannot produce a negative amount of widgets), and an upper bound of 8 for variable $x$, to reflect the capacity constraint on production of widget A (```8 >= x >=0```).

You can also specify bounds by using the `lower_bound` and `upper_bound` keyword arguments (as in `@variable(model, x, lower_bound = 0, upper_bound = 8`). 

A variable without bounds is considered a "free variable" and is defined by simply ommitting any bounds (as in `@variable(model, free_x)`).

The name provided for the variable in the `@variable` macro is the "[base name](https://jump.dev/JuMP.jl/stable/variables/#Variable-names-1)" assigned to this variable (e.g. `x` and `y` for our variables above). 

You can use the variable's base name as an argument in other JuMP functions to query attributes of this variable (or to recover a variable's value after solving the model). For example, we can check the upper bound on the `x` variable as follows...


```julia
upper_bound(x)
```




    8.0



Note that JuMP requires unique names for variables, expressions, and constraints. If you try to define the same variable name more than once, JuMP will throw an error to prevent you from accidentally overwriting the same variable (or constraint or expression). 


```julia
@variable(factory_model, x >= 0) # Try defining x for a second time with different bounds
```

You can see that the $x$ variable still has the old upper bound and has not been modified by the above attempt to define it again. 


```julia
upper_bound(x)
```




    8.0



If we'd really wanted to modify the bounds for an existing JuMP variable, we would use the the `set_lower_bound` and `set_upper_bound` functions, or the ` delete_lower_bound` and `delete_upper_bound` functions to remove a previously established bound.

You can check if a name has already been assigned to a valid JuMP object (variable, expression, constraint) with the `is_valid(model_reference, JuMP_base_name)` function, and [delete an existing JuMP object](https://jump.dev/JuMP.jl/dev/variables/#Deleting-variables-1) with the `delete(model_reference, JuMP_base_name)` function.


```julia
is_valid(factory_model, x)
```




    true



You can also use JuMP's `all_variables(model_reference)` function to enumerate a vector of references to all defined JuMP variables


```julia
all_variables(factory_model)
```




    2-element Array{VariableRef,1}:
     x
     y



### 4. Define constraints

Next, we can define our more complicated constraints, which involve multiple variables.

We have two constraints to define in this simple example, our time constraint, $10 x + 8 y \leq \ 80$ and our material constraint, $7 x + 11 y \leq \ 77$.

We define constraints with the JuMP [@constraint](https://jump.dev/JuMP.jl/stable/constraints/#The-@constraint-macro-1) macro.


```julia
@constraint(factory_model, time_constraint, 10x + 8y <= 80) # Time constraint
```




time_constraint : $ 10 x + 8 y \leq 80.0 $




```julia
@constraint(factory_model, materials_constraint, 7x + 11y <= 77) # Materials constraint
```




materials_constraint : $ 7 x + 11 y \leq 77.0 $



We can now call the model object we've been building, and JuMP will helpfully print out the mathematical formulation


```julia
factory_model
```




$$ \begin{alignat*}{1}\text{feasibility}\\
\text{Subject to} \quad & 10 x + 8 y \leq 80.0\\
 & 7 x + 11 y \leq 77.0\\
 & x \geq 0.0\\
 & y \geq 0.0\\
 & x \leq 8.0\\
\end{alignat*}
 $$



As you can see, we've now defined all of the constraints in our simple factory model. But we're missing one very important thing...

### 5. Define objective function

Currently, our model only defines a feasible region (e.g. a set of constraints over the domain of our defined decision variables). But we have not specified what our objective function is: what are we trying to maximize or minimize?

To define our objective function, we use the [@objective](https://jump.dev/JuMP.jl/dev/objective/#JuMP.@objective) macro. We have three arguments for this macro: (1) the model object we are defining the objective for, (2) specify whether this is a maximization (`Max`) or minimization (`Min`) problem, and (3) define the objective function itself.


```julia
@objective(factory_model, Max, 150x + 175y)
```




$$ 150 x + 175 y $$



Now we can see the full model is defined...


```julia
factory_model
```




$$ \begin{alignat*}{1}\max\quad & 150 x + 175 y\\
\text{Subject to} \quad & 10 x + 8 y \leq 80.0\\
 & 7 x + 11 y \leq 77.0\\
 & x \geq 0.0\\
 & y \geq 0.0\\
 & x \leq 8.0\\
\end{alignat*}
 $$



### 6. Alternative ways to define our model

We can define more than one variable at a time using a more compact syntax by using the [@variables](https://jump.dev/JuMP.jl/stable/variables/#variables-1) macro. Here we'll define both x and y variables at the same time...


```julia
factory_model = Model(Clp.Optimizer);
@variables(factory_model, begin
    8 >= x >= 0
    y >= 0
    end)
print(factory_model)
```

    Feasibility
    Subject to
     x ≥ 0.0
     y ≥ 0.0
     x ≤ 8.0


Note that the @variables macro does not automatically print the variable bounds, so we use the `print(model_name)` function above to print out the newly defined variables and their bounds.

We can also use the [@constraints](https://jump.dev/JuMP.jl/stable/constraints/#The-@constraints-macro-1) macro in a similar manner to define multiple constraints in a more compact syntax, if preferred...


```julia
@constraints(factory_model, begin
    time_constraint, 10x + 8y <= 80
    materials_constraint, 7x + 11y <= 77    
    end)
print(factory_model)
```

    Feasibility
    Subject to
     time_constraint : 10 x + 8 y ≤ 80.0
     materials_constraint : 7 x + 11 y ≤ 77.0
     x ≥ 0.0
     y ≥ 0.0
     x ≤ 8.0


Sometimes it is useful to define an algebraic [expression](https://jump.dev/JuMP.jl/stable/expressions/#) that may be insert in constraints, objective functions, or other expressions (e.g. to build up more complex expressions or to define an expression used repeatedly in multiple constraints). 

The recommended way to create an expression is via the [@expression](https://jump.dev/JuMP.jl/stable/expressions/#JuMP.@expression) macro, which is syntactically similar to the definition fo a constraint. The difference is that an expression is not directly part of the optimization problem definition. It only becomes incorporated into the model definition if you subsequently use a defined expression to define part of a constraint or objective function. As an example, let's use an expression here to define our objective function...


```julia
@expression(factory_model, objective, 150x + 175y)
@objective(factory_model, Max, objective)
print(factory_model)
```

    Max 150 x + 175 y
    Subject to
     time_constraint : 10 x + 8 y ≤ 80.0
     materials_constraint : 7 x + 11 y ≤ 77.0
     x ≥ 0.0
     y ≥ 0.0
     x ≤ 8.0


### 7. Solve the model

Now that we've defined our factory model, let's solve it to find the optimal values $(x^*, y^*)$ that maximizes our objective function. 

To optimize a defined JuMP model for which a solver has been previously specified, use the [optimize!](https://jump.dev/JuMP.jl/stable/solvers/#JuMP.optimize!) function, supplying the model name as an argument...


```julia
optimize!(factory_model)
```

    Coin0506I Presolve 2 (0) rows, 2 (0) columns and 4 (0) elements
    Clp0006I 0  Obj 0 Dual inf 325 (2)
    Clp0006I 2  Obj 1413.8889
    Clp0000I Optimal - objective value 1413.8889
    Clp0032I Optimal objective 1413.888889 - 2 iterations time 0.002


We see that the solver (Clp) solved our optimization problem and found the optimal objective function value of 1413.888889. 

### 8. Query the optimal solution

But what are the optimal decision variable values $(x^*, y^*)$? Now that the model has been solved to optimality, we can query the values of JuMP variables by using JuMP's [value()](https://jump.dev/JuMP.jl/stable/solutions/#JuMP.value) function


```julia
value(x)
```




    4.888888888888888




```julia
value(y)
```




    3.8888888888888897



Quick note: because JuMP uses [different containers](https://jump.dev/JuMP.jl/dev/containers/) depending on whether we've defined a single variable, a vector or square array of variables, or an array of variables with differing dimension lengths, they [recommend](https://jump.dev/JuMP.jl/dev/solutions/#Obtaining-solutions-1) using the [vectorized syntax or "dot syntax"](https://docs.julialang.org/en/v1/manual/functions/#man-vectorized) for the `value()` function, `value.(ref)`, rather than the `value(ref)` syntax used above. 

The `value.(ref)` syntax will work with any vector or array of variables and also with single variables (which can be treated as a vector of length 1), while the `value(ref)` syntax will only work when called for single variables. In this case, since we have a single variable only, we can use either syntax. We'll see an example of a vector of variables in the next section of this notebook...


```julia
value.(x)
```




    4.888888888888888




```julia
value.(y)
```




    3.8888888888888897



We can now see the optimal solution to our simple factory optimization model is $(x^*, y^*) = (4.8889, 3.8889)$, just as we determined in the [Constrained Optimization notebook](Notebooks/Constrained-Optimization.ipynb) via linear algebra.


```julia
contour(a,b,(a,b)->f(a,b),nlevels=10, c=:heat, linewidth=10, colorbar = false, contour_labels = true)
title!("Factory Optimization Problem")
xaxis!("x=Widget A")
yaxis!("y=Widget B")
xticks!(0:maximum(a))
yticks!(0:maximum(b))
areaplot!(a[a.<=11], (77 .- 7*a[a.<=11])./11, legend=false, opacity=0.3)
areaplot!(a[a.<=8], (80 .- 10*a[a.<=8])./8, legend=false, opacity=0.3)
areaplot!(a[a.<=8], repeat([maximum(b)],length(a[a.<=8])), legend=false, opacity=0.15)
scatter!([value.(x)],[value.(y)], markercolor="blue")
```




<!DOCTYPE html>
<html>
    <head>
        <title>Plots.jl</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
    </head>
    <body>
            <div id="94c559e2-aa76-4b12-9589-2608f41a8712" style="width:600px;height:400px;"></div>
    

    </body>
</html>




We can also use the `value()` function to evaluate the value of named expressions and constraints we've previously defined and associated with the solved model. (Again, vectorized dot syntax is recommended, but both forms work for single constraints).


```julia
value.(time_constraint)
```




    80.0



We can see that this is the same value as we'd get by evaluating the time constraint at the optimal values $(x^*, y^*)$


```julia
10*value.(x) + 8*value.(y)
```




    80.0



We can also evaluate the `objective` expression we defined previously, $150x + 175y$, and save this to a variable names `optimal_revenue` (e.g. for use later).


```julia
optimal_revenue = value(objective)
```




    1413.888888888889



Or we can directly query the objective function value associated with our `factory_model` JuMP model object by using JuMP's `objective_value()` function and passing a reference to the model as follows. Since we don't always define an expression for our objective function, this is the typical way to access the objective function value for our optimal solution.


```julia
optimal_revenue = objective_value(factory_model)
```




    1413.888888888889



Note that if there are certain expressions that you want to be able to quickly extract from the model's results, it can make sense to define an expression prior to solving the model, even if you do not use the expression to build a constraint or define the objective function that makes up the actual constrained optimization problem. 

For example, if we wanted to quickly extract the sum of widgets produced $(x+y)$ without individually querying each decision variable value, we could define an expression `@expression(factory_model, total_widgets, x+y)`, and then simply use `value(total_widgets)` to get this sum. 

Obviously, this is a pretty simple expression, but for more complex models, this can be a handy approach to make it easy to extract results of interest.


```julia
@expression(factory_model, total_widgets, x+y)
```




$$ x + y $$




```julia
value.(total_widgets)
```




    8.777777777777779



## A More Complex Model: Optimal Solar + Battery Storage Operations

The factory example above is a pretty simple problem. Useful for introducing the basic anatomy of a JuMP model, but hardly worth relying on algebraic programming to find the solution (as it can be obtained analytically without much trouble). So let's now turn to a more complex example...



Assume you are a renewable energy company and you own a 50 megawatt (MW) utility-scale solar PV system and recently installed a 10 MW / 40 megawatt-hours (MWh) Lithium-ion battery system at the same site. Both solar and battery systems take advantage of the same DC-AC inverters (solar PV and batteries are both direct current devices) and transmission grid connection (substation).

Given a series of electricity prices, how should you operate your solar PV and storage system to maximize revenue? When do you charge, and when do you discharge? Should you buy extra power from the grid when it's cheap and store it for later when prices are high, or just make use of your solar PV system to charge the battery? What's the best operational plan to maximize revenue over the next 24 hours?

Sounds like a good optimization problem!

### 1. Load data and define parameters

Before we get started defining our model, we need to load some useful data and define a set of **parameters** or constant values used in our optimization problem.

For purposes of this example, we will use **time series data** for a single day of 15-minute [real-time electricity market prices](http://mis.ercot.com/misapp/GetReports.do?reportTypeId=13061&reportTitle=Historical%20RTM%20Load%20Zone%20and%20Hub%20Prices&showHTMLView=&mimicKey) from the Western Hub of the Electricity Reliability Council of Texas (ERCOT) electricity market, along with simulated solar PV output from [Renewables.Ninja](https://www.renewables.ninja/), which we'll load in from a .csv file with help from Julia's [CSV](https://juliadata.github.io/CSV.jl/stable/) and [DataFrames](https://juliadata.github.io/DataFrames.jl/stable/) packages.


```julia
# Note, you don't need to run this block if CSV and DataFrames packages are already installed
import Pkg
Pkg.add("CSV")
Pkg.add("DataFrames")
```

    [32m[1m   Updating[22m[39m registry at `~/.julia/registries/General`


    [?25l    

    [32m[1m   Updating[22m[39m git-repo `https://github.com/JuliaRegistries/General.git`


    [2K[?25h[1mFetching:[22m[39m [========================================>]  99.9 %[36m[1mFetching:[22m[39m [======>                                  ]  14.0 %>                             ]  26.8 %>                     ]  46.5 %[36m[1mFetching:[22m[39m [========================>                ]  58.2 %           ]  71.0 % [==================================>      ]  83.9 %[36m[1mFetching:[22m[39m [=====================================>   ]  90.6 %

    [32m[1m  Resolving[22m[39m package versions...
    [32m[1mNo Changes[22m[39m to `~/.julia/environments/v1.5/Project.toml`
    [32m[1mNo Changes[22m[39m to `~/.julia/environments/v1.5/Manifest.toml`
    [32m[1m  Resolving[22m[39m package versions...
    [32m[1mNo Changes[22m[39m to `~/.julia/environments/v1.5/Project.toml`
    [32m[1mNo Changes[22m[39m to `~/.julia/environments/v1.5/Manifest.toml`



```julia
using CSV
using DataFrames
time_series = DataFrame(CSV.File("anatomy_data/solar_battery_data.csv"))
```




<table class="data-frame"><thead><tr><th></th><th>T</th><th>Hour</th><th>Interval</th><th>Price</th><th>Solar</th></tr><tr><th></th><th>Int64</th><th>Int64</th><th>Int64</th><th>Float64</th><th>Float64</th></tr></thead><tbody><p>96 rows × 5 columns</p><tr><th>1</th><td>1</td><td>1</td><td>1</td><td>12.77</td><td>0.0</td></tr><tr><th>2</th><td>2</td><td>1</td><td>2</td><td>11.82</td><td>0.0</td></tr><tr><th>3</th><td>3</td><td>1</td><td>3</td><td>12.39</td><td>0.0</td></tr><tr><th>4</th><td>4</td><td>1</td><td>4</td><td>10.17</td><td>0.0</td></tr><tr><th>5</th><td>5</td><td>2</td><td>1</td><td>5.86</td><td>0.0</td></tr><tr><th>6</th><td>6</td><td>2</td><td>2</td><td>2.69</td><td>0.0</td></tr><tr><th>7</th><td>7</td><td>2</td><td>3</td><td>1.46</td><td>0.0</td></tr><tr><th>8</th><td>8</td><td>2</td><td>4</td><td>1.41</td><td>0.0</td></tr><tr><th>9</th><td>9</td><td>3</td><td>1</td><td>0.03</td><td>0.0</td></tr><tr><th>10</th><td>10</td><td>3</td><td>2</td><td>-0.19</td><td>0.0</td></tr><tr><th>11</th><td>11</td><td>3</td><td>3</td><td>-0.72</td><td>0.0</td></tr><tr><th>12</th><td>12</td><td>3</td><td>4</td><td>-0.54</td><td>0.0</td></tr><tr><th>13</th><td>13</td><td>4</td><td>1</td><td>-0.45</td><td>0.0</td></tr><tr><th>14</th><td>14</td><td>4</td><td>2</td><td>-0.6</td><td>0.0</td></tr><tr><th>15</th><td>15</td><td>4</td><td>3</td><td>-0.72</td><td>0.0</td></tr><tr><th>16</th><td>16</td><td>4</td><td>4</td><td>-0.63</td><td>0.0</td></tr><tr><th>17</th><td>17</td><td>5</td><td>1</td><td>-0.72</td><td>0.0</td></tr><tr><th>18</th><td>18</td><td>5</td><td>2</td><td>-1.19</td><td>0.0</td></tr><tr><th>19</th><td>19</td><td>5</td><td>3</td><td>-1.04</td><td>0.0</td></tr><tr><th>20</th><td>20</td><td>5</td><td>4</td><td>-0.76</td><td>0.0</td></tr><tr><th>21</th><td>21</td><td>6</td><td>1</td><td>-0.47</td><td>0.0</td></tr><tr><th>22</th><td>22</td><td>6</td><td>2</td><td>0.68</td><td>0.0</td></tr><tr><th>23</th><td>23</td><td>6</td><td>3</td><td>0.78</td><td>0.0</td></tr><tr><th>24</th><td>24</td><td>6</td><td>4</td><td>0.09</td><td>0.0</td></tr><tr><th>25</th><td>25</td><td>7</td><td>1</td><td>5.51</td><td>0.0</td></tr><tr><th>26</th><td>26</td><td>7</td><td>2</td><td>4.66</td><td>0.077</td></tr><tr><th>27</th><td>27</td><td>7</td><td>3</td><td>4.52</td><td>0.154</td></tr><tr><th>28</th><td>28</td><td>7</td><td>4</td><td>5.89</td><td>0.232</td></tr><tr><th>29</th><td>29</td><td>8</td><td>1</td><td>8.83</td><td>0.309</td></tr><tr><th>30</th><td>30</td><td>8</td><td>2</td><td>8.83</td><td>7.94</td></tr><tr><th>&vellip;</th><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td></tr></tbody></table>




```julia
using Plots
plotly() # use plotly backend: https://docs.juliaplots.org/latest/generated/plotly/
```

    ┌ Info: For saving to png with the Plotly backend ORCA has to be installed.
    └ @ Plots /Users/jdj2/.julia/packages/Plots/M1wcx/src/backends.jl:373





    Plots.PlotlyBackend()




```julia
plot(time_series.Price, label="Price (\$/MWh)")
plot!(time_series.Solar, label="Solar PV (MW-dc)")
title!("Price and Solar PV time series")
xaxis!("Time Interval (15 mins)")
yaxis!("")
```









<!DOCTYPE html>
<html>
    <head>
        <title>Plots.jl</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
    </head>
    <body>
            <div id="5e5eed53-37c1-4e2f-b4f9-a096c37cca98" style="width:600px;height:400px;"></div>
    

    </body>
</html>




Additionally, we'll define the following **capacity parameters** for each of the major subcomponents of our solar + battery system...


```julia
solar_cap   = 50      # Solar PV capacity in DC MW
battery_cap = 10      # Lithium ion battery power (charge/discharge) capacity in DC MW
energy_cap  = 40      # Lithium ion battery energy capacity (in MWh)
grid_cap    = 40      # DC-AC inverter and grid connection capacity (rated in AC MW)
@show solar_cap
@show battery_cap
@show energy_cap
@show grid_cap
```

    solar_cap = 50
    battery_cap = 10
    energy_cap = 40
    grid_cap = 40





    40



Next, we will define a set of **efficiency parameters**, which help govern the flow of electricity through our solar + storage system.


```julia
battery_eff = 0.95    # 'Single-trip' charge or discharge efficiency for the Lithium ion battery
inverter_eff = 0.9    # Efficiency of DC-AC or AC-DC conversion at inverter
@show battery_eff
@show inverter_eff
```

    battery_eff = 0.95
    inverter_eff = 0.9





    0.9



Finally, we set the **starting state of charge** of the battery at the beginning of the simulation day, which we'll assume is half full.


```julia
start_charge = 0.5*energy_cap
```




    20.0



### 2. Define the model

Now that we have our parameters set, let's define a new optimization model, a linear programming problem using the Clp open source solver.


```julia
PV_model = Model(Clp.Optimizer)
```




$$ \begin{alignat*}{1}\text{feasibility}\\
\text{Subject to} \quad\end{alignat*}
 $$



### 3. Define decision variables

Now we have to define our decision variables. For each of our time intervals, we have five important **operating decisions** to make:

1. How much DC power to produce (or curtail) from our solar PV system
2. How much DC power to charge the battery
3. How much DC power to discharge from the battery
4. How much AC power to export to the grid
5. How much AC power to import from the grid (e.g. to charge the battery)

For the purposes of this optimization problem, we will consider these discrete time decisions taken every 15 minutes. 

Additionally, we will define a final variable:

6. How much energy is stored in the battery (storage state of charge)

While this state of charge variable is technically defined as a decision variable, it is actually completely constrained by the other variables, as we'll see below. This is an example of a [state variable](https://en.wikipedia.org/wiki/State_variable). We'll come back to state variables in dynamical systems when we introduce time coupling constraints in more depth in the Economic Dispatch notebook... 

Since we take the same kinds of decisions in each 15 minute time interval, we will thus define **an array of decision variables** for each type of decision, indexed across all time periods `t` in the set `T` as defined by our time series data `time_series.T`. 

This is our first example of creating an array of variables and **indexing across sets**. In practice, you'll frequently define arrays of variables and constraints that repeat across various sets or dimensions of your data (e.g. time periods, generators, regions, transmission lines). Note that variables can be indexed across multiple dimensions in N-dimensional containers (although here we will only index across the single dimension: time periods). [Read more on variable containers here](https://jump.dev/JuMP.jl/dev/variables/#Variable-containers-1).

Additionally, we will define bounds for each decision variable based on the capacity parameters set previously. We'll set solar's upper bounds later, as these vary by time interval depending on the availability of solar insolation at the time.

Note: by convention, and to make it easy to spot a decision variable in future expressions, we'll use the convention that all decision variable names will follow the format `UPPERCASE`. (This is an optional convention, and you can feel free to adopt your own, but we recommend adopting a consistent convention for naming variables, constraints, expressions, parameters, etc.)


```julia
# Decision variables and bounds:

@variables(PV_model, begin
                          SOLAR[t in time_series.T]      >= 0
        battery_cap    >= CHARGE[t in time_series.T]     >= 0
        battery_cap    >= DISCHARGE[t in time_series.T]  >= 0
        grid_cap       >= GRIDEXPORT[t in time_series.T] >= 0
        grid_cap       >= GRIDIMPORT[t in time_series.T] >= 0
        energy_cap     >= SOC[t in time_series.T]        >= 0
                          
end)
PV_model
```




$$ \begin{alignat*}{1}\text{feasibility}\\
\text{Subject to} \quad & SOLAR_{1} \geq 0.0\\
 & SOLAR_{2} \geq 0.0\\
 & SOLAR_{3} \geq 0.0\\
 & SOLAR_{4} \geq 0.0\\
 & SOLAR_{5} \geq 0.0\\
 & SOLAR_{6} \geq 0.0\\
 & SOLAR_{7} \geq 0.0\\
 & SOLAR_{8} \geq 0.0\\
 & SOLAR_{9} \geq 0.0\\
 & SOLAR_{10} \geq 0.0\\
 & SOLAR_{11} \geq 0.0\\
 & SOLAR_{12} \geq 0.0\\
 & SOLAR_{13} \geq 0.0\\
 & SOLAR_{14} \geq 0.0\\
 & SOLAR_{15} \geq 0.0\\
 & SOLAR_{16} \geq 0.0\\
 & SOLAR_{17} \geq 0.0\\
 & SOLAR_{18} \geq 0.0\\
 & SOLAR_{19} \geq 0.0\\
 & SOLAR_{20} \geq 0.0\\
 & SOLAR_{21} \geq 0.0\\
 & SOLAR_{22} \geq 0.0\\
 & SOLAR_{23} \geq 0.0\\
 & SOLAR_{24} \geq 0.0\\
 & SOLAR_{25} \geq 0.0\\
 & SOLAR_{26} \geq 0.0\\
 & SOLAR_{27} \geq 0.0\\
 & SOLAR_{28} \geq 0.0\\
 & SOLAR_{29} \geq 0.0\\
 & SOLAR_{30} \geq 0.0\\
 & SOLAR_{31} \geq 0.0\\
 & SOLAR_{32} \geq 0.0\\
 & SOLAR_{33} \geq 0.0\\
 & SOLAR_{34} \geq 0.0\\
 & SOLAR_{35} \geq 0.0\\
 & SOLAR_{36} \geq 0.0\\
 & SOLAR_{37} \geq 0.0\\
 & SOLAR_{38} \geq 0.0\\
 & SOLAR_{39} \geq 0.0\\
 & SOLAR_{40} \geq 0.0\\
 & SOLAR_{41} \geq 0.0\\
 & SOLAR_{42} \geq 0.0\\
 & SOLAR_{43} \geq 0.0\\
 & SOLAR_{44} \geq 0.0\\
 & SOLAR_{45} \geq 0.0\\
 & SOLAR_{46} \geq 0.0\\
 & SOLAR_{47} \geq 0.0\\
 & SOLAR_{48} \geq 0.0\\
 & SOLAR_{49} \geq 0.0\\
 & SOLAR_{50} \geq 0.0\\
 & SOLAR_{51} \geq 0.0\\
 & SOLAR_{52} \geq 0.0\\
 & SOLAR_{53} \geq 0.0\\
 & SOLAR_{54} \geq 0.0\\
 & SOLAR_{55} \geq 0.0\\
 & SOLAR_{56} \geq 0.0\\
 & SOLAR_{57} \geq 0.0\\
 & SOLAR_{58} \geq 0.0\\
 & SOLAR_{59} \geq 0.0\\
 & SOLAR_{60} \geq 0.0\\
 & SOLAR_{61} \geq 0.0\\
 & SOLAR_{62} \geq 0.0\\
 & SOLAR_{63} \geq 0.0\\
 & SOLAR_{64} \geq 0.0\\
 & SOLAR_{65} \geq 0.0\\
 & SOLAR_{66} \geq 0.0\\
 & SOLAR_{67} \geq 0.0\\
 & SOLAR_{68} \geq 0.0\\
 & SOLAR_{69} \geq 0.0\\
 & SOLAR_{70} \geq 0.0\\
 & SOLAR_{71} \geq 0.0\\
 & SOLAR_{72} \geq 0.0\\
 & SOLAR_{73} \geq 0.0\\
 & SOLAR_{74} \geq 0.0\\
 & SOLAR_{75} \geq 0.0\\
 & SOLAR_{76} \geq 0.0\\
 & SOLAR_{77} \geq 0.0\\
 & SOLAR_{78} \geq 0.0\\
 & SOLAR_{79} \geq 0.0\\
 & SOLAR_{80} \geq 0.0\\
 & SOLAR_{81} \geq 0.0\\
 & SOLAR_{82} \geq 0.0\\
 & SOLAR_{83} \geq 0.0\\
 & SOLAR_{84} \geq 0.0\\
 & SOLAR_{85} \geq 0.0\\
 & SOLAR_{86} \geq 0.0\\
 & SOLAR_{87} \geq 0.0\\
 & SOLAR_{88} \geq 0.0\\
 & SOLAR_{89} \geq 0.0\\
 & SOLAR_{90} \geq 0.0\\
 & SOLAR_{91} \geq 0.0\\
 & SOLAR_{92} \geq 0.0\\
 & SOLAR_{93} \geq 0.0\\
 & SOLAR_{94} \geq 0.0\\
 & SOLAR_{95} \geq 0.0\\
 & SOLAR_{96} \geq 0.0\\
 & CHARGE_{1} \geq 0.0\\
 & CHARGE_{2} \geq 0.0\\
 & CHARGE_{3} \geq 0.0\\
 & CHARGE_{4} \geq 0.0\\
 & CHARGE_{5} \geq 0.0\\
 & CHARGE_{6} \geq 0.0\\
 & CHARGE_{7} \geq 0.0\\
 & CHARGE_{8} \geq 0.0\\
 & CHARGE_{9} \geq 0.0\\
 & CHARGE_{10} \geq 0.0\\
 & CHARGE_{11} \geq 0.0\\
 & CHARGE_{12} \geq 0.0\\
 & CHARGE_{13} \geq 0.0\\
 & CHARGE_{14} \geq 0.0\\
 & CHARGE_{15} \geq 0.0\\
 & CHARGE_{16} \geq 0.0\\
 & CHARGE_{17} \geq 0.0\\
 & CHARGE_{18} \geq 0.0\\
 & CHARGE_{19} \geq 0.0\\
 & CHARGE_{20} \geq 0.0\\
 & CHARGE_{21} \geq 0.0\\
 & CHARGE_{22} \geq 0.0\\
 & CHARGE_{23} \geq 0.0\\
 & CHARGE_{24} \geq 0.0\\
 & CHARGE_{25} \geq 0.0\\
 & CHARGE_{26} \geq 0.0\\
 & CHARGE_{27} \geq 0.0\\
 & CHARGE_{28} \geq 0.0\\
 & CHARGE_{29} \geq 0.0\\
 & CHARGE_{30} \geq 0.0\\
 & CHARGE_{31} \geq 0.0\\
 & CHARGE_{32} \geq 0.0\\
 & CHARGE_{33} \geq 0.0\\
 & CHARGE_{34} \geq 0.0\\
 & CHARGE_{35} \geq 0.0\\
 & CHARGE_{36} \geq 0.0\\
 & CHARGE_{37} \geq 0.0\\
 & CHARGE_{38} \geq 0.0\\
 & CHARGE_{39} \geq 0.0\\
 & CHARGE_{40} \geq 0.0\\
 & CHARGE_{41} \geq 0.0\\
 & CHARGE_{42} \geq 0.0\\
 & CHARGE_{43} \geq 0.0\\
 & CHARGE_{44} \geq 0.0\\
 & CHARGE_{45} \geq 0.0\\
 & CHARGE_{46} \geq 0.0\\
 & CHARGE_{47} \geq 0.0\\
 & CHARGE_{48} \geq 0.0\\
 & CHARGE_{49} \geq 0.0\\
 & CHARGE_{50} \geq 0.0\\
 & CHARGE_{51} \geq 0.0\\
 & CHARGE_{52} \geq 0.0\\
 & CHARGE_{53} \geq 0.0\\
 & CHARGE_{54} \geq 0.0\\
 & CHARGE_{55} \geq 0.0\\
 & CHARGE_{56} \geq 0.0\\
 & CHARGE_{57} \geq 0.0\\
 & CHARGE_{58} \geq 0.0\\
 & CHARGE_{59} \geq 0.0\\
 & CHARGE_{60} \geq 0.0\\
 & CHARGE_{61} \geq 0.0\\
 & CHARGE_{62} \geq 0.0\\
 & CHARGE_{63} \geq 0.0\\
 & CHARGE_{64} \geq 0.0\\
 & CHARGE_{65} \geq 0.0\\
 & CHARGE_{66} \geq 0.0\\
 & CHARGE_{67} \geq 0.0\\
 & CHARGE_{68} \geq 0.0\\
 & CHARGE_{69} \geq 0.0\\
 & CHARGE_{70} \geq 0.0\\
 & CHARGE_{71} \geq 0.0\\
 & CHARGE_{72} \geq 0.0\\
 & CHARGE_{73} \geq 0.0\\
 & CHARGE_{74} \geq 0.0\\
 & CHARGE_{75} \geq 0.0\\
 & CHARGE_{76} \geq 0.0\\
 & CHARGE_{77} \geq 0.0\\
 & CHARGE_{78} \geq 0.0\\
 & CHARGE_{79} \geq 0.0\\
 & CHARGE_{80} \geq 0.0\\
 & CHARGE_{81} \geq 0.0\\
 & CHARGE_{82} \geq 0.0\\
 & CHARGE_{83} \geq 0.0\\
 & CHARGE_{84} \geq 0.0\\
 & CHARGE_{85} \geq 0.0\\
 & CHARGE_{86} \geq 0.0\\
 & CHARGE_{87} \geq 0.0\\
 & CHARGE_{88} \geq 0.0\\
 & CHARGE_{89} \geq 0.0\\
 & CHARGE_{90} \geq 0.0\\
 & CHARGE_{91} \geq 0.0\\
 & CHARGE_{92} \geq 0.0\\
 & CHARGE_{93} \geq 0.0\\
 & CHARGE_{94} \geq 0.0\\
 & CHARGE_{95} \geq 0.0\\
 & CHARGE_{96} \geq 0.0\\
 & DISCHARGE_{1} \geq 0.0\\
 & DISCHARGE_{2} \geq 0.0\\
 & DISCHARGE_{3} \geq 0.0\\
 & DISCHARGE_{4} \geq 0.0\\
 & DISCHARGE_{5} \geq 0.0\\
 & DISCHARGE_{6} \geq 0.0\\
 & DISCHARGE_{7} \geq 0.0\\
 & DISCHARGE_{8} \geq 0.0\\
 & DISCHARGE_{9} \geq 0.0\\
 & DISCHARGE_{10} \geq 0.0\\
 & DISCHARGE_{11} \geq 0.0\\
 & DISCHARGE_{12} \geq 0.0\\
 & DISCHARGE_{13} \geq 0.0\\
 & DISCHARGE_{14} \geq 0.0\\
 & DISCHARGE_{15} \geq 0.0\\
 & DISCHARGE_{16} \geq 0.0\\
 & DISCHARGE_{17} \geq 0.0\\
 & DISCHARGE_{18} \geq 0.0\\
 & DISCHARGE_{19} \geq 0.0\\
 & DISCHARGE_{20} \geq 0.0\\
 & DISCHARGE_{21} \geq 0.0\\
 & DISCHARGE_{22} \geq 0.0\\
 & DISCHARGE_{23} \geq 0.0\\
 & DISCHARGE_{24} \geq 0.0\\
 & DISCHARGE_{25} \geq 0.0\\
 & DISCHARGE_{26} \geq 0.0\\
 & DISCHARGE_{27} \geq 0.0\\
 & DISCHARGE_{28} \geq 0.0\\
 & DISCHARGE_{29} \geq 0.0\\
 & DISCHARGE_{30} \geq 0.0\\
 & DISCHARGE_{31} \geq 0.0\\
 & DISCHARGE_{32} \geq 0.0\\
 & DISCHARGE_{33} \geq 0.0\\
 & DISCHARGE_{34} \geq 0.0\\
 & DISCHARGE_{35} \geq 0.0\\
 & DISCHARGE_{36} \geq 0.0\\
 & DISCHARGE_{37} \geq 0.0\\
 & DISCHARGE_{38} \geq 0.0\\
 & DISCHARGE_{39} \geq 0.0\\
 & DISCHARGE_{40} \geq 0.0\\
 & DISCHARGE_{41} \geq 0.0\\
 & DISCHARGE_{42} \geq 0.0\\
 & DISCHARGE_{43} \geq 0.0\\
 & DISCHARGE_{44} \geq 0.0\\
 & DISCHARGE_{45} \geq 0.0\\
 & DISCHARGE_{46} \geq 0.0\\
 & DISCHARGE_{47} \geq 0.0\\
 & DISCHARGE_{48} \geq 0.0\\
 & DISCHARGE_{49} \geq 0.0\\
 & DISCHARGE_{50} \geq 0.0\\
 & DISCHARGE_{51} \geq 0.0\\
 & DISCHARGE_{52} \geq 0.0\\
 & DISCHARGE_{53} \geq 0.0\\
 & DISCHARGE_{54} \geq 0.0\\
 & DISCHARGE_{55} \geq 0.0\\
 & DISCHARGE_{56} \geq 0.0\\
 & DISCHARGE_{57} \geq 0.0\\
 & DISCHARGE_{58} \geq 0.0\\
 & DISCHARGE_{59} \geq 0.0\\
 & DISCHARGE_{60} \geq 0.0\\
 & DISCHARGE_{61} \geq 0.0\\
 & DISCHARGE_{62} \geq 0.0\\
 & DISCHARGE_{63} \geq 0.0\\
 & DISCHARGE_{64} \geq 0.0\\
 & DISCHARGE_{65} \geq 0.0\\
 & DISCHARGE_{66} \geq 0.0\\
 & DISCHARGE_{67} \geq 0.0\\
 & DISCHARGE_{68} \geq 0.0\\
 & DISCHARGE_{69} \geq 0.0\\
 & DISCHARGE_{70} \geq 0.0\\
 & DISCHARGE_{71} \geq 0.0\\
 & DISCHARGE_{72} \geq 0.0\\
 & DISCHARGE_{73} \geq 0.0\\
 & DISCHARGE_{74} \geq 0.0\\
 & DISCHARGE_{75} \geq 0.0\\
 & DISCHARGE_{76} \geq 0.0\\
 & DISCHARGE_{77} \geq 0.0\\
 & DISCHARGE_{78} \geq 0.0\\
 & DISCHARGE_{79} \geq 0.0\\
 & DISCHARGE_{80} \geq 0.0\\
 & DISCHARGE_{81} \geq 0.0\\
 & DISCHARGE_{82} \geq 0.0\\
 & DISCHARGE_{83} \geq 0.0\\
 & DISCHARGE_{84} \geq 0.0\\
 & DISCHARGE_{85} \geq 0.0\\
 & DISCHARGE_{86} \geq 0.0\\
 & DISCHARGE_{87} \geq 0.0\\
 & DISCHARGE_{88} \geq 0.0\\
 & DISCHARGE_{89} \geq 0.0\\
 & DISCHARGE_{90} \geq 0.0\\
 & DISCHARGE_{91} \geq 0.0\\
 & DISCHARGE_{92} \geq 0.0\\
 & DISCHARGE_{93} \geq 0.0\\
 & DISCHARGE_{94} \geq 0.0\\
 & DISCHARGE_{95} \geq 0.0\\
 & DISCHARGE_{96} \geq 0.0\\
 & GRIDEXPORT_{1} \geq 0.0\\
 & GRIDEXPORT_{2} \geq 0.0\\
 & GRIDEXPORT_{3} \geq 0.0\\
 & GRIDEXPORT_{4} \geq 0.0\\
 & GRIDEXPORT_{5} \geq 0.0\\
 & GRIDEXPORT_{6} \geq 0.0\\
 & GRIDEXPORT_{7} \geq 0.0\\
 & GRIDEXPORT_{8} \geq 0.0\\
 & GRIDEXPORT_{9} \geq 0.0\\
 & GRIDEXPORT_{10} \geq 0.0\\
 & GRIDEXPORT_{11} \geq 0.0\\
 & GRIDEXPORT_{12} \geq 0.0\\
 & GRIDEXPORT_{13} \geq 0.0\\
 & GRIDEXPORT_{14} \geq 0.0\\
 & GRIDEXPORT_{15} \geq 0.0\\
 & GRIDEXPORT_{16} \geq 0.0\\
 & GRIDEXPORT_{17} \geq 0.0\\
 & GRIDEXPORT_{18} \geq 0.0\\
 & GRIDEXPORT_{19} \geq 0.0\\
 & GRIDEXPORT_{20} \geq 0.0\\
 & GRIDEXPORT_{21} \geq 0.0\\
 & GRIDEXPORT_{22} \geq 0.0\\
 & GRIDEXPORT_{23} \geq 0.0\\
 & GRIDEXPORT_{24} \geq 0.0\\
 & GRIDEXPORT_{25} \geq 0.0\\
 & GRIDEXPORT_{26} \geq 0.0\\
 & GRIDEXPORT_{27} \geq 0.0\\
 & GRIDEXPORT_{28} \geq 0.0\\
 & GRIDEXPORT_{29} \geq 0.0\\
 & GRIDEXPORT_{30} \geq 0.0\\
 & GRIDEXPORT_{31} \geq 0.0\\
 & GRIDEXPORT_{32} \geq 0.0\\
 & GRIDEXPORT_{33} \geq 0.0\\
 & GRIDEXPORT_{34} \geq 0.0\\
 & GRIDEXPORT_{35} \geq 0.0\\
 & GRIDEXPORT_{36} \geq 0.0\\
 & GRIDEXPORT_{37} \geq 0.0\\
 & GRIDEXPORT_{38} \geq 0.0\\
 & GRIDEXPORT_{39} \geq 0.0\\
 & GRIDEXPORT_{40} \geq 0.0\\
 & GRIDEXPORT_{41} \geq 0.0\\
 & GRIDEXPORT_{42} \geq 0.0\\
 & GRIDEXPORT_{43} \geq 0.0\\
 & GRIDEXPORT_{44} \geq 0.0\\
 & GRIDEXPORT_{45} \geq 0.0\\
 & GRIDEXPORT_{46} \geq 0.0\\
 & GRIDEXPORT_{47} \geq 0.0\\
 & GRIDEXPORT_{48} \geq 0.0\\
 & GRIDEXPORT_{49} \geq 0.0\\
 & GRIDEXPORT_{50} \geq 0.0\\
 & GRIDEXPORT_{51} \geq 0.0\\
 & GRIDEXPORT_{52} \geq 0.0\\
 & GRIDEXPORT_{53} \geq 0.0\\
 & GRIDEXPORT_{54} \geq 0.0\\
 & GRIDEXPORT_{55} \geq 0.0\\
 & GRIDEXPORT_{56} \geq 0.0\\
 & GRIDEXPORT_{57} \geq 0.0\\
 & GRIDEXPORT_{58} \geq 0.0\\
 & GRIDEXPORT_{59} \geq 0.0\\
 & GRIDEXPORT_{60} \geq 0.0\\
 & GRIDEXPORT_{61} \geq 0.0\\
 & GRIDEXPORT_{62} \geq 0.0\\
 & GRIDEXPORT_{63} \geq 0.0\\
 & GRIDEXPORT_{64} \geq 0.0\\
 & GRIDEXPORT_{65} \geq 0.0\\
 & GRIDEXPORT_{66} \geq 0.0\\
 & GRIDEXPORT_{67} \geq 0.0\\
 & GRIDEXPORT_{68} \geq 0.0\\
 & GRIDEXPORT_{69} \geq 0.0\\
 & GRIDEXPORT_{70} \geq 0.0\\
 & GRIDEXPORT_{71} \geq 0.0\\
 & GRIDEXPORT_{72} \geq 0.0\\
 & GRIDEXPORT_{73} \geq 0.0\\
 & GRIDEXPORT_{74} \geq 0.0\\
 & GRIDEXPORT_{75} \geq 0.0\\
 & GRIDEXPORT_{76} \geq 0.0\\
 & GRIDEXPORT_{77} \geq 0.0\\
 & GRIDEXPORT_{78} \geq 0.0\\
 & GRIDEXPORT_{79} \geq 0.0\\
 & GRIDEXPORT_{80} \geq 0.0\\
 & GRIDEXPORT_{81} \geq 0.0\\
 & GRIDEXPORT_{82} \geq 0.0\\
 & GRIDEXPORT_{83} \geq 0.0\\
 & GRIDEXPORT_{84} \geq 0.0\\
 & GRIDEXPORT_{85} \geq 0.0\\
 & GRIDEXPORT_{86} \geq 0.0\\
 & GRIDEXPORT_{87} \geq 0.0\\
 & GRIDEXPORT_{88} \geq 0.0\\
 & GRIDEXPORT_{89} \geq 0.0\\
 & GRIDEXPORT_{90} \geq 0.0\\
 & GRIDEXPORT_{91} \geq 0.0\\
 & GRIDEXPORT_{92} \geq 0.0\\
 & GRIDEXPORT_{93} \geq 0.0\\
 & GRIDEXPORT_{94} \geq 0.0\\
 & GRIDEXPORT_{95} \geq 0.0\\
 & GRIDEXPORT_{96} \geq 0.0\\
 & GRIDIMPORT_{1} \geq 0.0\\
 & GRIDIMPORT_{2} \geq 0.0\\
 & GRIDIMPORT_{3} \geq 0.0\\
 & GRIDIMPORT_{4} \geq 0.0\\
 & GRIDIMPORT_{5} \geq 0.0\\
 & GRIDIMPORT_{6} \geq 0.0\\
 & GRIDIMPORT_{7} \geq 0.0\\
 & GRIDIMPORT_{8} \geq 0.0\\
 & GRIDIMPORT_{9} \geq 0.0\\
 & GRIDIMPORT_{10} \geq 0.0\\
 & GRIDIMPORT_{11} \geq 0.0\\
 & GRIDIMPORT_{12} \geq 0.0\\
 & GRIDIMPORT_{13} \geq 0.0\\
 & GRIDIMPORT_{14} \geq 0.0\\
 & GRIDIMPORT_{15} \geq 0.0\\
 & GRIDIMPORT_{16} \geq 0.0\\
 & GRIDIMPORT_{17} \geq 0.0\\
 & GRIDIMPORT_{18} \geq 0.0\\
 & GRIDIMPORT_{19} \geq 0.0\\
 & GRIDIMPORT_{20} \geq 0.0\\
 & GRIDIMPORT_{21} \geq 0.0\\
 & GRIDIMPORT_{22} \geq 0.0\\
 & GRIDIMPORT_{23} \geq 0.0\\
 & GRIDIMPORT_{24} \geq 0.0\\
 & GRIDIMPORT_{25} \geq 0.0\\
 & GRIDIMPORT_{26} \geq 0.0\\
 & GRIDIMPORT_{27} \geq 0.0\\
 & GRIDIMPORT_{28} \geq 0.0\\
 & GRIDIMPORT_{29} \geq 0.0\\
 & GRIDIMPORT_{30} \geq 0.0\\
 & GRIDIMPORT_{31} \geq 0.0\\
 & GRIDIMPORT_{32} \geq 0.0\\
 & GRIDIMPORT_{33} \geq 0.0\\
 & GRIDIMPORT_{34} \geq 0.0\\
 & GRIDIMPORT_{35} \geq 0.0\\
 & GRIDIMPORT_{36} \geq 0.0\\
 & GRIDIMPORT_{37} \geq 0.0\\
 & GRIDIMPORT_{38} \geq 0.0\\
 & GRIDIMPORT_{39} \geq 0.0\\
 & GRIDIMPORT_{40} \geq 0.0\\
 & GRIDIMPORT_{41} \geq 0.0\\
 & GRIDIMPORT_{42} \geq 0.0\\
 & GRIDIMPORT_{43} \geq 0.0\\
 & GRIDIMPORT_{44} \geq 0.0\\
 & GRIDIMPORT_{45} \geq 0.0\\
 & GRIDIMPORT_{46} \geq 0.0\\
 & GRIDIMPORT_{47} \geq 0.0\\
 & GRIDIMPORT_{48} \geq 0.0\\
 & GRIDIMPORT_{49} \geq 0.0\\
 & GRIDIMPORT_{50} \geq 0.0\\
 & GRIDIMPORT_{51} \geq 0.0\\
 & GRIDIMPORT_{52} \geq 0.0\\
 & GRIDIMPORT_{53} \geq 0.0\\
 & GRIDIMPORT_{54} \geq 0.0\\
 & GRIDIMPORT_{55} \geq 0.0\\
 & GRIDIMPORT_{56} \geq 0.0\\
 & GRIDIMPORT_{57} \geq 0.0\\
 & GRIDIMPORT_{58} \geq 0.0\\
 & GRIDIMPORT_{59} \geq 0.0\\
 & GRIDIMPORT_{60} \geq 0.0\\
 & GRIDIMPORT_{61} \geq 0.0\\
 & GRIDIMPORT_{62} \geq 0.0\\
 & GRIDIMPORT_{63} \geq 0.0\\
 & GRIDIMPORT_{64} \geq 0.0\\
 & GRIDIMPORT_{65} \geq 0.0\\
 & GRIDIMPORT_{66} \geq 0.0\\
 & GRIDIMPORT_{67} \geq 0.0\\
 & GRIDIMPORT_{68} \geq 0.0\\
 & GRIDIMPORT_{69} \geq 0.0\\
 & GRIDIMPORT_{70} \geq 0.0\\
 & GRIDIMPORT_{71} \geq 0.0\\
 & GRIDIMPORT_{72} \geq 0.0\\
 & GRIDIMPORT_{73} \geq 0.0\\
 & GRIDIMPORT_{74} \geq 0.0\\
 & GRIDIMPORT_{75} \geq 0.0\\
 & GRIDIMPORT_{76} \geq 0.0\\
 & GRIDIMPORT_{77} \geq 0.0\\
 & GRIDIMPORT_{78} \geq 0.0\\
 & GRIDIMPORT_{79} \geq 0.0\\
 & GRIDIMPORT_{80} \geq 0.0\\
 & GRIDIMPORT_{81} \geq 0.0\\
 & GRIDIMPORT_{82} \geq 0.0\\
 & GRIDIMPORT_{83} \geq 0.0\\
 & GRIDIMPORT_{84} \geq 0.0\\
 & GRIDIMPORT_{85} \geq 0.0\\
 & GRIDIMPORT_{86} \geq 0.0\\
 & GRIDIMPORT_{87} \geq 0.0\\
 & GRIDIMPORT_{88} \geq 0.0\\
 & GRIDIMPORT_{89} \geq 0.0\\
 & GRIDIMPORT_{90} \geq 0.0\\
 & GRIDIMPORT_{91} \geq 0.0\\
 & GRIDIMPORT_{92} \geq 0.0\\
 & GRIDIMPORT_{93} \geq 0.0\\
 & GRIDIMPORT_{94} \geq 0.0\\
 & GRIDIMPORT_{95} \geq 0.0\\
 & GRIDIMPORT_{96} \geq 0.0\\
 & SOC_{1} \geq 0.0\\
 & SOC_{2} \geq 0.0\\
 & SOC_{3} \geq 0.0\\
 & SOC_{4} \geq 0.0\\
 & SOC_{5} \geq 0.0\\
 & SOC_{6} \geq 0.0\\
 & SOC_{7} \geq 0.0\\
 & SOC_{8} \geq 0.0\\
 & SOC_{9} \geq 0.0\\
 & SOC_{10} \geq 0.0\\
 & SOC_{11} \geq 0.0\\
 & SOC_{12} \geq 0.0\\
 & SOC_{13} \geq 0.0\\
 & SOC_{14} \geq 0.0\\
 & SOC_{15} \geq 0.0\\
 & SOC_{16} \geq 0.0\\
 & SOC_{17} \geq 0.0\\
 & SOC_{18} \geq 0.0\\
 & SOC_{19} \geq 0.0\\
 & SOC_{20} \geq 0.0\\
 & SOC_{21} \geq 0.0\\
 & SOC_{22} \geq 0.0\\
 & SOC_{23} \geq 0.0\\
 & SOC_{24} \geq 0.0\\
 & SOC_{25} \geq 0.0\\
 & SOC_{26} \geq 0.0\\
 & SOC_{27} \geq 0.0\\
 & SOC_{28} \geq 0.0\\
 & SOC_{29} \geq 0.0\\
 & SOC_{30} \geq 0.0\\
 & SOC_{31} \geq 0.0\\
 & SOC_{32} \geq 0.0\\
 & SOC_{33} \geq 0.0\\
 & SOC_{34} \geq 0.0\\
 & SOC_{35} \geq 0.0\\
 & SOC_{36} \geq 0.0\\
 & SOC_{37} \geq 0.0\\
 & SOC_{38} \geq 0.0\\
 & SOC_{39} \geq 0.0\\
 & SOC_{40} \geq 0.0\\
 & SOC_{41} \geq 0.0\\
 & SOC_{42} \geq 0.0\\
 & SOC_{43} \geq 0.0\\
 & SOC_{44} \geq 0.0\\
 & SOC_{45} \geq 0.0\\
 & SOC_{46} \geq 0.0\\
 & SOC_{47} \geq 0.0\\
 & SOC_{48} \geq 0.0\\
 & SOC_{49} \geq 0.0\\
 & SOC_{50} \geq 0.0\\
 & SOC_{51} \geq 0.0\\
 & SOC_{52} \geq 0.0\\
 & SOC_{53} \geq 0.0\\
 & SOC_{54} \geq 0.0\\
 & SOC_{55} \geq 0.0\\
 & SOC_{56} \geq 0.0\\
 & SOC_{57} \geq 0.0\\
 & SOC_{58} \geq 0.0\\
 & SOC_{59} \geq 0.0\\
 & SOC_{60} \geq 0.0\\
 & SOC_{61} \geq 0.0\\
 & SOC_{62} \geq 0.0\\
 & SOC_{63} \geq 0.0\\
 & SOC_{64} \geq 0.0\\
 & SOC_{65} \geq 0.0\\
 & SOC_{66} \geq 0.0\\
 & SOC_{67} \geq 0.0\\
 & SOC_{68} \geq 0.0\\
 & SOC_{69} \geq 0.0\\
 & SOC_{70} \geq 0.0\\
 & SOC_{71} \geq 0.0\\
 & SOC_{72} \geq 0.0\\
 & SOC_{73} \geq 0.0\\
 & SOC_{74} \geq 0.0\\
 & SOC_{75} \geq 0.0\\
 & SOC_{76} \geq 0.0\\
 & SOC_{77} \geq 0.0\\
 & SOC_{78} \geq 0.0\\
 & SOC_{79} \geq 0.0\\
 & SOC_{80} \geq 0.0\\
 & SOC_{81} \geq 0.0\\
 & SOC_{82} \geq 0.0\\
 & SOC_{83} \geq 0.0\\
 & SOC_{84} \geq 0.0\\
 & SOC_{85} \geq 0.0\\
 & SOC_{86} \geq 0.0\\
 & SOC_{87} \geq 0.0\\
 & SOC_{88} \geq 0.0\\
 & SOC_{89} \geq 0.0\\
 & SOC_{90} \geq 0.0\\
 & SOC_{91} \geq 0.0\\
 & SOC_{92} \geq 0.0\\
 & SOC_{93} \geq 0.0\\
 & SOC_{94} \geq 0.0\\
 & SOC_{95} \geq 0.0\\
 & SOC_{96} \geq 0.0\\
 & CHARGE_{1} \leq 10.0\\
 & CHARGE_{2} \leq 10.0\\
 & CHARGE_{3} \leq 10.0\\
 & CHARGE_{4} \leq 10.0\\
 & CHARGE_{5} \leq 10.0\\
 & CHARGE_{6} \leq 10.0\\
 & CHARGE_{7} \leq 10.0\\
 & CHARGE_{8} \leq 10.0\\
 & CHARGE_{9} \leq 10.0\\
 & CHARGE_{10} \leq 10.0\\
 & CHARGE_{11} \leq 10.0\\
 & CHARGE_{12} \leq 10.0\\
 & CHARGE_{13} \leq 10.0\\
 & CHARGE_{14} \leq 10.0\\
 & CHARGE_{15} \leq 10.0\\
 & CHARGE_{16} \leq 10.0\\
 & CHARGE_{17} \leq 10.0\\
 & CHARGE_{18} \leq 10.0\\
 & CHARGE_{19} \leq 10.0\\
 & CHARGE_{20} \leq 10.0\\
 & CHARGE_{21} \leq 10.0\\
 & CHARGE_{22} \leq 10.0\\
 & CHARGE_{23} \leq 10.0\\
 & CHARGE_{24} \leq 10.0\\
 & CHARGE_{25} \leq 10.0\\
 & CHARGE_{26} \leq 10.0\\
 & CHARGE_{27} \leq 10.0\\
 & CHARGE_{28} \leq 10.0\\
 & CHARGE_{29} \leq 10.0\\
 & CHARGE_{30} \leq 10.0\\
 & CHARGE_{31} \leq 10.0\\
 & CHARGE_{32} \leq 10.0\\
 & CHARGE_{33} \leq 10.0\\
 & CHARGE_{34} \leq 10.0\\
 & CHARGE_{35} \leq 10.0\\
 & CHARGE_{36} \leq 10.0\\
 & CHARGE_{37} \leq 10.0\\
 & CHARGE_{38} \leq 10.0\\
 & CHARGE_{39} \leq 10.0\\
 & CHARGE_{40} \leq 10.0\\
 & CHARGE_{41} \leq 10.0\\
 & CHARGE_{42} \leq 10.0\\
 & CHARGE_{43} \leq 10.0\\
 & CHARGE_{44} \leq 10.0\\
 & CHARGE_{45} \leq 10.0\\
 & CHARGE_{46} \leq 10.0\\
 & CHARGE_{47} \leq 10.0\\
 & CHARGE_{48} \leq 10.0\\
 & CHARGE_{49} \leq 10.0\\
 & CHARGE_{50} \leq 10.0\\
 & CHARGE_{51} \leq 10.0\\
 & CHARGE_{52} \leq 10.0\\
 & CHARGE_{53} \leq 10.0\\
 & CHARGE_{54} \leq 10.0\\
 & CHARGE_{55} \leq 10.0\\
 & CHARGE_{56} \leq 10.0\\
 & CHARGE_{57} \leq 10.0\\
 & CHARGE_{58} \leq 10.0\\
 & CHARGE_{59} \leq 10.0\\
 & CHARGE_{60} \leq 10.0\\
 & CHARGE_{61} \leq 10.0\\
 & CHARGE_{62} \leq 10.0\\
 & CHARGE_{63} \leq 10.0\\
 & CHARGE_{64} \leq 10.0\\
 & CHARGE_{65} \leq 10.0\\
 & CHARGE_{66} \leq 10.0\\
 & CHARGE_{67} \leq 10.0\\
 & CHARGE_{68} \leq 10.0\\
 & CHARGE_{69} \leq 10.0\\
 & CHARGE_{70} \leq 10.0\\
 & CHARGE_{71} \leq 10.0\\
 & CHARGE_{72} \leq 10.0\\
 & CHARGE_{73} \leq 10.0\\
 & CHARGE_{74} \leq 10.0\\
 & CHARGE_{75} \leq 10.0\\
 & CHARGE_{76} \leq 10.0\\
 & CHARGE_{77} \leq 10.0\\
 & CHARGE_{78} \leq 10.0\\
 & CHARGE_{79} \leq 10.0\\
 & CHARGE_{80} \leq 10.0\\
 & CHARGE_{81} \leq 10.0\\
 & CHARGE_{82} \leq 10.0\\
 & CHARGE_{83} \leq 10.0\\
 & CHARGE_{84} \leq 10.0\\
 & CHARGE_{85} \leq 10.0\\
 & CHARGE_{86} \leq 10.0\\
 & CHARGE_{87} \leq 10.0\\
 & CHARGE_{88} \leq 10.0\\
 & CHARGE_{89} \leq 10.0\\
 & CHARGE_{90} \leq 10.0\\
 & CHARGE_{91} \leq 10.0\\
 & CHARGE_{92} \leq 10.0\\
 & CHARGE_{93} \leq 10.0\\
 & CHARGE_{94} \leq 10.0\\
 & CHARGE_{95} \leq 10.0\\
 & CHARGE_{96} \leq 10.0\\
 & DISCHARGE_{1} \leq 10.0\\
 & DISCHARGE_{2} \leq 10.0\\
 & DISCHARGE_{3} \leq 10.0\\
 & DISCHARGE_{4} \leq 10.0\\
 & DISCHARGE_{5} \leq 10.0\\
 & DISCHARGE_{6} \leq 10.0\\
 & DISCHARGE_{7} \leq 10.0\\
 & DISCHARGE_{8} \leq 10.0\\
 & DISCHARGE_{9} \leq 10.0\\
 & DISCHARGE_{10} \leq 10.0\\
 & DISCHARGE_{11} \leq 10.0\\
 & DISCHARGE_{12} \leq 10.0\\
 & DISCHARGE_{13} \leq 10.0\\
 & DISCHARGE_{14} \leq 10.0\\
 & DISCHARGE_{15} \leq 10.0\\
 & DISCHARGE_{16} \leq 10.0\\
 & DISCHARGE_{17} \leq 10.0\\
 & DISCHARGE_{18} \leq 10.0\\
 & DISCHARGE_{19} \leq 10.0\\
 & DISCHARGE_{20} \leq 10.0\\
 & DISCHARGE_{21} \leq 10.0\\
 & DISCHARGE_{22} \leq 10.0\\
 & DISCHARGE_{23} \leq 10.0\\
 & DISCHARGE_{24} \leq 10.0\\
 & DISCHARGE_{25} \leq 10.0\\
 & DISCHARGE_{26} \leq 10.0\\
 & DISCHARGE_{27} \leq 10.0\\
 & DISCHARGE_{28} \leq 10.0\\
 & DISCHARGE_{29} \leq 10.0\\
 & DISCHARGE_{30} \leq 10.0\\
 & DISCHARGE_{31} \leq 10.0\\
 & DISCHARGE_{32} \leq 10.0\\
 & DISCHARGE_{33} \leq 10.0\\
 & DISCHARGE_{34} \leq 10.0\\
 & DISCHARGE_{35} \leq 10.0\\
 & DISCHARGE_{36} \leq 10.0\\
 & DISCHARGE_{37} \leq 10.0\\
 & DISCHARGE_{38} \leq 10.0\\
 & DISCHARGE_{39} \leq 10.0\\
 & DISCHARGE_{40} \leq 10.0\\
 & DISCHARGE_{41} \leq 10.0\\
 & DISCHARGE_{42} \leq 10.0\\
 & DISCHARGE_{43} \leq 10.0\\
 & DISCHARGE_{44} \leq 10.0\\
 & DISCHARGE_{45} \leq 10.0\\
 & DISCHARGE_{46} \leq 10.0\\
 & DISCHARGE_{47} \leq 10.0\\
 & DISCHARGE_{48} \leq 10.0\\
 & DISCHARGE_{49} \leq 10.0\\
 & DISCHARGE_{50} \leq 10.0\\
 & DISCHARGE_{51} \leq 10.0\\
 & DISCHARGE_{52} \leq 10.0\\
 & DISCHARGE_{53} \leq 10.0\\
 & DISCHARGE_{54} \leq 10.0\\
 & DISCHARGE_{55} \leq 10.0\\
 & DISCHARGE_{56} \leq 10.0\\
 & DISCHARGE_{57} \leq 10.0\\
 & DISCHARGE_{58} \leq 10.0\\
 & DISCHARGE_{59} \leq 10.0\\
 & DISCHARGE_{60} \leq 10.0\\
 & DISCHARGE_{61} \leq 10.0\\
 & DISCHARGE_{62} \leq 10.0\\
 & DISCHARGE_{63} \leq 10.0\\
 & DISCHARGE_{64} \leq 10.0\\
 & DISCHARGE_{65} \leq 10.0\\
 & DISCHARGE_{66} \leq 10.0\\
 & DISCHARGE_{67} \leq 10.0\\
 & DISCHARGE_{68} \leq 10.0\\
 & DISCHARGE_{69} \leq 10.0\\
 & DISCHARGE_{70} \leq 10.0\\
 & DISCHARGE_{71} \leq 10.0\\
 & DISCHARGE_{72} \leq 10.0\\
 & DISCHARGE_{73} \leq 10.0\\
 & DISCHARGE_{74} \leq 10.0\\
 & DISCHARGE_{75} \leq 10.0\\
 & DISCHARGE_{76} \leq 10.0\\
 & DISCHARGE_{77} \leq 10.0\\
 & DISCHARGE_{78} \leq 10.0\\
 & DISCHARGE_{79} \leq 10.0\\
 & DISCHARGE_{80} \leq 10.0\\
 & DISCHARGE_{81} \leq 10.0\\
 & DISCHARGE_{82} \leq 10.0\\
 & DISCHARGE_{83} \leq 10.0\\
 & DISCHARGE_{84} \leq 10.0\\
 & DISCHARGE_{85} \leq 10.0\\
 & DISCHARGE_{86} \leq 10.0\\
 & DISCHARGE_{87} \leq 10.0\\
 & DISCHARGE_{88} \leq 10.0\\
 & DISCHARGE_{89} \leq 10.0\\
 & DISCHARGE_{90} \leq 10.0\\
 & DISCHARGE_{91} \leq 10.0\\
 & DISCHARGE_{92} \leq 10.0\\
 & DISCHARGE_{93} \leq 10.0\\
 & DISCHARGE_{94} \leq 10.0\\
 & DISCHARGE_{95} \leq 10.0\\
 & DISCHARGE_{96} \leq 10.0\\
 & GRIDEXPORT_{1} \leq 40.0\\
 & GRIDEXPORT_{2} \leq 40.0\\
 & GRIDEXPORT_{3} \leq 40.0\\
 & GRIDEXPORT_{4} \leq 40.0\\
 & GRIDEXPORT_{5} \leq 40.0\\
 & GRIDEXPORT_{6} \leq 40.0\\
 & GRIDEXPORT_{7} \leq 40.0\\
 & GRIDEXPORT_{8} \leq 40.0\\
 & GRIDEXPORT_{9} \leq 40.0\\
 & GRIDEXPORT_{10} \leq 40.0\\
 & GRIDEXPORT_{11} \leq 40.0\\
 & GRIDEXPORT_{12} \leq 40.0\\
 & GRIDEXPORT_{13} \leq 40.0\\
 & GRIDEXPORT_{14} \leq 40.0\\
 & GRIDEXPORT_{15} \leq 40.0\\
 & GRIDEXPORT_{16} \leq 40.0\\
 & GRIDEXPORT_{17} \leq 40.0\\
 & GRIDEXPORT_{18} \leq 40.0\\
 & GRIDEXPORT_{19} \leq 40.0\\
 & GRIDEXPORT_{20} \leq 40.0\\
 & GRIDEXPORT_{21} \leq 40.0\\
 & GRIDEXPORT_{22} \leq 40.0\\
 & GRIDEXPORT_{23} \leq 40.0\\
 & GRIDEXPORT_{24} \leq 40.0\\
 & GRIDEXPORT_{25} \leq 40.0\\
 & GRIDEXPORT_{26} \leq 40.0\\
 & GRIDEXPORT_{27} \leq 40.0\\
 & GRIDEXPORT_{28} \leq 40.0\\
 & GRIDEXPORT_{29} \leq 40.0\\
 & GRIDEXPORT_{30} \leq 40.0\\
 & GRIDEXPORT_{31} \leq 40.0\\
 & GRIDEXPORT_{32} \leq 40.0\\
 & GRIDEXPORT_{33} \leq 40.0\\
 & GRIDEXPORT_{34} \leq 40.0\\
 & GRIDEXPORT_{35} \leq 40.0\\
 & GRIDEXPORT_{36} \leq 40.0\\
 & GRIDEXPORT_{37} \leq 40.0\\
 & GRIDEXPORT_{38} \leq 40.0\\
 & GRIDEXPORT_{39} \leq 40.0\\
 & GRIDEXPORT_{40} \leq 40.0\\
 & GRIDEXPORT_{41} \leq 40.0\\
 & GRIDEXPORT_{42} \leq 40.0\\
 & GRIDEXPORT_{43} \leq 40.0\\
 & GRIDEXPORT_{44} \leq 40.0\\
 & GRIDEXPORT_{45} \leq 40.0\\
 & GRIDEXPORT_{46} \leq 40.0\\
 & GRIDEXPORT_{47} \leq 40.0\\
 & GRIDEXPORT_{48} \leq 40.0\\
 & GRIDEXPORT_{49} \leq 40.0\\
 & GRIDEXPORT_{50} \leq 40.0\\
 & GRIDEXPORT_{51} \leq 40.0\\
 & GRIDEXPORT_{52} \leq 40.0\\
 & GRIDEXPORT_{53} \leq 40.0\\
 & GRIDEXPORT_{54} \leq 40.0\\
 & GRIDEXPORT_{55} \leq 40.0\\
 & GRIDEXPORT_{56} \leq 40.0\\
 & GRIDEXPORT_{57} \leq 40.0\\
 & GRIDEXPORT_{58} \leq 40.0\\
 & GRIDEXPORT_{59} \leq 40.0\\
 & GRIDEXPORT_{60} \leq 40.0\\
 & GRIDEXPORT_{61} \leq 40.0\\
 & GRIDEXPORT_{62} \leq 40.0\\
 & GRIDEXPORT_{63} \leq 40.0\\
 & GRIDEXPORT_{64} \leq 40.0\\
 & GRIDEXPORT_{65} \leq 40.0\\
 & GRIDEXPORT_{66} \leq 40.0\\
 & GRIDEXPORT_{67} \leq 40.0\\
 & GRIDEXPORT_{68} \leq 40.0\\
 & GRIDEXPORT_{69} \leq 40.0\\
 & GRIDEXPORT_{70} \leq 40.0\\
 & GRIDEXPORT_{71} \leq 40.0\\
 & GRIDEXPORT_{72} \leq 40.0\\
 & GRIDEXPORT_{73} \leq 40.0\\
 & GRIDEXPORT_{74} \leq 40.0\\
 & GRIDEXPORT_{75} \leq 40.0\\
 & GRIDEXPORT_{76} \leq 40.0\\
 & GRIDEXPORT_{77} \leq 40.0\\
 & GRIDEXPORT_{78} \leq 40.0\\
 & GRIDEXPORT_{79} \leq 40.0\\
 & GRIDEXPORT_{80} \leq 40.0\\
 & GRIDEXPORT_{81} \leq 40.0\\
 & GRIDEXPORT_{82} \leq 40.0\\
 & GRIDEXPORT_{83} \leq 40.0\\
 & GRIDEXPORT_{84} \leq 40.0\\
 & GRIDEXPORT_{85} \leq 40.0\\
 & GRIDEXPORT_{86} \leq 40.0\\
 & GRIDEXPORT_{87} \leq 40.0\\
 & GRIDEXPORT_{88} \leq 40.0\\
 & GRIDEXPORT_{89} \leq 40.0\\
 & GRIDEXPORT_{90} \leq 40.0\\
 & GRIDEXPORT_{91} \leq 40.0\\
 & GRIDEXPORT_{92} \leq 40.0\\
 & GRIDEXPORT_{93} \leq 40.0\\
 & GRIDEXPORT_{94} \leq 40.0\\
 & GRIDEXPORT_{95} \leq 40.0\\
 & GRIDEXPORT_{96} \leq 40.0\\
 & GRIDIMPORT_{1} \leq 40.0\\
 & GRIDIMPORT_{2} \leq 40.0\\
 & GRIDIMPORT_{3} \leq 40.0\\
 & GRIDIMPORT_{4} \leq 40.0\\
 & GRIDIMPORT_{5} \leq 40.0\\
 & GRIDIMPORT_{6} \leq 40.0\\
 & GRIDIMPORT_{7} \leq 40.0\\
 & GRIDIMPORT_{8} \leq 40.0\\
 & GRIDIMPORT_{9} \leq 40.0\\
 & GRIDIMPORT_{10} \leq 40.0\\
 & GRIDIMPORT_{11} \leq 40.0\\
 & GRIDIMPORT_{12} \leq 40.0\\
 & GRIDIMPORT_{13} \leq 40.0\\
 & GRIDIMPORT_{14} \leq 40.0\\
 & GRIDIMPORT_{15} \leq 40.0\\
 & GRIDIMPORT_{16} \leq 40.0\\
 & GRIDIMPORT_{17} \leq 40.0\\
 & GRIDIMPORT_{18} \leq 40.0\\
 & GRIDIMPORT_{19} \leq 40.0\\
 & GRIDIMPORT_{20} \leq 40.0\\
 & GRIDIMPORT_{21} \leq 40.0\\
 & GRIDIMPORT_{22} \leq 40.0\\
 & GRIDIMPORT_{23} \leq 40.0\\
 & GRIDIMPORT_{24} \leq 40.0\\
 & GRIDIMPORT_{25} \leq 40.0\\
 & GRIDIMPORT_{26} \leq 40.0\\
 & GRIDIMPORT_{27} \leq 40.0\\
 & GRIDIMPORT_{28} \leq 40.0\\
 & GRIDIMPORT_{29} \leq 40.0\\
 & GRIDIMPORT_{30} \leq 40.0\\
 & GRIDIMPORT_{31} \leq 40.0\\
 & GRIDIMPORT_{32} \leq 40.0\\
 & GRIDIMPORT_{33} \leq 40.0\\
 & GRIDIMPORT_{34} \leq 40.0\\
 & GRIDIMPORT_{35} \leq 40.0\\
 & GRIDIMPORT_{36} \leq 40.0\\
 & GRIDIMPORT_{37} \leq 40.0\\
 & GRIDIMPORT_{38} \leq 40.0\\
 & GRIDIMPORT_{39} \leq 40.0\\
 & GRIDIMPORT_{40} \leq 40.0\\
 & GRIDIMPORT_{41} \leq 40.0\\
 & GRIDIMPORT_{42} \leq 40.0\\
 & GRIDIMPORT_{43} \leq 40.0\\
 & GRIDIMPORT_{44} \leq 40.0\\
 & GRIDIMPORT_{45} \leq 40.0\\
 & GRIDIMPORT_{46} \leq 40.0\\
 & GRIDIMPORT_{47} \leq 40.0\\
 & GRIDIMPORT_{48} \leq 40.0\\
 & GRIDIMPORT_{49} \leq 40.0\\
 & GRIDIMPORT_{50} \leq 40.0\\
 & GRIDIMPORT_{51} \leq 40.0\\
 & GRIDIMPORT_{52} \leq 40.0\\
 & GRIDIMPORT_{53} \leq 40.0\\
 & GRIDIMPORT_{54} \leq 40.0\\
 & GRIDIMPORT_{55} \leq 40.0\\
 & GRIDIMPORT_{56} \leq 40.0\\
 & GRIDIMPORT_{57} \leq 40.0\\
 & GRIDIMPORT_{58} \leq 40.0\\
 & GRIDIMPORT_{59} \leq 40.0\\
 & GRIDIMPORT_{60} \leq 40.0\\
 & GRIDIMPORT_{61} \leq 40.0\\
 & GRIDIMPORT_{62} \leq 40.0\\
 & GRIDIMPORT_{63} \leq 40.0\\
 & GRIDIMPORT_{64} \leq 40.0\\
 & GRIDIMPORT_{65} \leq 40.0\\
 & GRIDIMPORT_{66} \leq 40.0\\
 & GRIDIMPORT_{67} \leq 40.0\\
 & GRIDIMPORT_{68} \leq 40.0\\
 & GRIDIMPORT_{69} \leq 40.0\\
 & GRIDIMPORT_{70} \leq 40.0\\
 & GRIDIMPORT_{71} \leq 40.0\\
 & GRIDIMPORT_{72} \leq 40.0\\
 & GRIDIMPORT_{73} \leq 40.0\\
 & GRIDIMPORT_{74} \leq 40.0\\
 & GRIDIMPORT_{75} \leq 40.0\\
 & GRIDIMPORT_{76} \leq 40.0\\
 & GRIDIMPORT_{77} \leq 40.0\\
 & GRIDIMPORT_{78} \leq 40.0\\
 & GRIDIMPORT_{79} \leq 40.0\\
 & GRIDIMPORT_{80} \leq 40.0\\
 & GRIDIMPORT_{81} \leq 40.0\\
 & GRIDIMPORT_{82} \leq 40.0\\
 & GRIDIMPORT_{83} \leq 40.0\\
 & GRIDIMPORT_{84} \leq 40.0\\
 & GRIDIMPORT_{85} \leq 40.0\\
 & GRIDIMPORT_{86} \leq 40.0\\
 & GRIDIMPORT_{87} \leq 40.0\\
 & GRIDIMPORT_{88} \leq 40.0\\
 & GRIDIMPORT_{89} \leq 40.0\\
 & GRIDIMPORT_{90} \leq 40.0\\
 & GRIDIMPORT_{91} \leq 40.0\\
 & GRIDIMPORT_{92} \leq 40.0\\
 & GRIDIMPORT_{93} \leq 40.0\\
 & GRIDIMPORT_{94} \leq 40.0\\
 & GRIDIMPORT_{95} \leq 40.0\\
 & GRIDIMPORT_{96} \leq 40.0\\
 & SOC_{1} \leq 40.0\\
 & SOC_{2} \leq 40.0\\
 & SOC_{3} \leq 40.0\\
 & SOC_{4} \leq 40.0\\
 & SOC_{5} \leq 40.0\\
 & SOC_{6} \leq 40.0\\
 & SOC_{7} \leq 40.0\\
 & SOC_{8} \leq 40.0\\
 & SOC_{9} \leq 40.0\\
 & SOC_{10} \leq 40.0\\
 & SOC_{11} \leq 40.0\\
 & SOC_{12} \leq 40.0\\
 & SOC_{13} \leq 40.0\\
 & SOC_{14} \leq 40.0\\
 & SOC_{15} \leq 40.0\\
 & SOC_{16} \leq 40.0\\
 & SOC_{17} \leq 40.0\\
 & SOC_{18} \leq 40.0\\
 & SOC_{19} \leq 40.0\\
 & SOC_{20} \leq 40.0\\
 & SOC_{21} \leq 40.0\\
 & SOC_{22} \leq 40.0\\
 & SOC_{23} \leq 40.0\\
 & SOC_{24} \leq 40.0\\
 & SOC_{25} \leq 40.0\\
 & SOC_{26} \leq 40.0\\
 & SOC_{27} \leq 40.0\\
 & SOC_{28} \leq 40.0\\
 & SOC_{29} \leq 40.0\\
 & SOC_{30} \leq 40.0\\
 & SOC_{31} \leq 40.0\\
 & SOC_{32} \leq 40.0\\
 & SOC_{33} \leq 40.0\\
 & SOC_{34} \leq 40.0\\
 & SOC_{35} \leq 40.0\\
 & SOC_{36} \leq 40.0\\
 & SOC_{37} \leq 40.0\\
 & SOC_{38} \leq 40.0\\
 & SOC_{39} \leq 40.0\\
 & SOC_{40} \leq 40.0\\
 & SOC_{41} \leq 40.0\\
 & SOC_{42} \leq 40.0\\
 & SOC_{43} \leq 40.0\\
 & SOC_{44} \leq 40.0\\
 & SOC_{45} \leq 40.0\\
 & SOC_{46} \leq 40.0\\
 & SOC_{47} \leq 40.0\\
 & SOC_{48} \leq 40.0\\
 & SOC_{49} \leq 40.0\\
 & SOC_{50} \leq 40.0\\
 & SOC_{51} \leq 40.0\\
 & SOC_{52} \leq 40.0\\
 & SOC_{53} \leq 40.0\\
 & SOC_{54} \leq 40.0\\
 & SOC_{55} \leq 40.0\\
 & SOC_{56} \leq 40.0\\
 & SOC_{57} \leq 40.0\\
 & SOC_{58} \leq 40.0\\
 & SOC_{59} \leq 40.0\\
 & SOC_{60} \leq 40.0\\
 & SOC_{61} \leq 40.0\\
 & SOC_{62} \leq 40.0\\
 & SOC_{63} \leq 40.0\\
 & SOC_{64} \leq 40.0\\
 & SOC_{65} \leq 40.0\\
 & SOC_{66} \leq 40.0\\
 & SOC_{67} \leq 40.0\\
 & SOC_{68} \leq 40.0\\
 & SOC_{69} \leq 40.0\\
 & SOC_{70} \leq 40.0\\
 & SOC_{71} \leq 40.0\\
 & SOC_{72} \leq 40.0\\
 & SOC_{73} \leq 40.0\\
 & SOC_{74} \leq 40.0\\
 & SOC_{75} \leq 40.0\\
 & SOC_{76} \leq 40.0\\
 & SOC_{77} \leq 40.0\\
 & SOC_{78} \leq 40.0\\
 & SOC_{79} \leq 40.0\\
 & SOC_{80} \leq 40.0\\
 & SOC_{81} \leq 40.0\\
 & SOC_{82} \leq 40.0\\
 & SOC_{83} \leq 40.0\\
 & SOC_{84} \leq 40.0\\
 & SOC_{85} \leq 40.0\\
 & SOC_{86} \leq 40.0\\
 & SOC_{87} \leq 40.0\\
 & SOC_{88} \leq 40.0\\
 & SOC_{89} \leq 40.0\\
 & SOC_{90} \leq 40.0\\
 & SOC_{91} \leq 40.0\\
 & SOC_{92} \leq 40.0\\
 & SOC_{93} \leq 40.0\\
 & SOC_{94} \leq 40.0\\
 & SOC_{95} \leq 40.0\\
 & SOC_{96} \leq 40.0\\
\end{alignat*}
 $$



### 4. Define expressions

Now we define an  expressions that relate the flow of electricity within our solar + storage system. 

Note that by convention, and to distinguish expression names from decision variable names and constraint names, we will use the convention that all expression names take the format `eExpressionName`. (This is an optional convention, and you can feel free to adopt your own, but we recommend adopting a consistent convention for naming variables, constraints, expressions, parameters, etc.)

1. First, the net solar + storage DC power production or consumption can be expressed by the sum of solar PV and battery discharge less battery charging in each time period `t`. 

$\begin{align*} 
eNetSolarStorage_t = SOLAR_t + DISCHARGE_t - CHARGE_t \quad \forall t \in T
\end{align*}$

We next combine grid exports, $GRIDEXPORT$, and grid imports, $GRIDIMPORT$, to form a "net grid export" expression representing the net interchange of power with the grid in DC terms, after accounting for conversion losses from DC to AC power for exports and AC to DC power for imports.

$\begin{align*} 
eNetExport_t = \frac{GRIDEXPORT_t}{inverter\_eff} - GRIDIMPORT_t \times inverter\_eff \quad \forall t \in T
\end{align*}$


As with our variables, we will define this expression as an array indexed across the set of time periods `t` in the time series `T`, since this holds for all time periods...


```julia
# System production and grid export/import flow
@expression(PV_model, eNetSolarStorage[t in time_series.T], 
    SOLAR[t] + DISCHARGE[t] - CHARGE[t])
@expression(PV_model, eNetExport[t in time_series.T], 
    GRIDEXPORT[t]/inverter_eff - GRIDIMPORT[t]*inverter_eff);
```


```julia
@show(eNetSolarStorage)
@show(eNetExport)
```

    eNetSolarStorage = 1-dimensional DenseAxisArray{GenericAffExpr{Float64,VariableRef},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{GenericAffExpr{Float64,VariableRef},1}:
     SOLAR[1] + DISCHARGE[1] - CHARGE[1]
     SOLAR[2] + DISCHARGE[2] - CHARGE[2]
     SOLAR[3] + DISCHARGE[3] - CHARGE[3]
     SOLAR[4] + DISCHARGE[4] - CHARGE[4]
     SOLAR[5] + DISCHARGE[5] - CHARGE[5]
     SOLAR[6] + DISCHARGE[6] - CHARGE[6]
     SOLAR[7] + DISCHARGE[7] - CHARGE[7]
     SOLAR[8] + DISCHARGE[8] - CHARGE[8]
     SOLAR[9] + DISCHARGE[9] - CHARGE[9]
     SOLAR[10] + DISCHARGE[10] - CHARGE[10]
     SOLAR[11] + DISCHARGE[11] - CHARGE[11]
     SOLAR[12] + DISCHARGE[12] - CHARGE[12]
     SOLAR[13] + DISCHARGE[13] - CHARGE[13]
     SOLAR[14] + DISCHARGE[14] - CHARGE[14]
     SOLAR[15] + DISCHARGE[15] - CHARGE[15]
     SOLAR[16] + DISCHARGE[16] - CHARGE[16]
     SOLAR[17] + DISCHARGE[17] - CHARGE[17]
     SOLAR[18] + DISCHARGE[18] - CHARGE[18]
     SOLAR[19] + DISCHARGE[19] - CHARGE[19]
     SOLAR[20] + DISCHARGE[20] - CHARGE[20]
     SOLAR[21] + DISCHARGE[21] - CHARGE[21]
     SOLAR[22] + DISCHARGE[22] - CHARGE[22]
     SOLAR[23] + DISCHARGE[23] - CHARGE[23]
     SOLAR[24] + DISCHARGE[24] - CHARGE[24]
     SOLAR[25] + DISCHARGE[25] - CHARGE[25]
     SOLAR[26] + DISCHARGE[26] - CHARGE[26]
     SOLAR[27] + DISCHARGE[27] - CHARGE[27]
     SOLAR[28] + DISCHARGE[28] - CHARGE[28]
     SOLAR[29] + DISCHARGE[29] - CHARGE[29]
     SOLAR[30] + DISCHARGE[30] - CHARGE[30]
     SOLAR[31] + DISCHARGE[31] - CHARGE[31]
     SOLAR[32] + DISCHARGE[32] - CHARGE[32]
     SOLAR[33] + DISCHARGE[33] - CHARGE[33]
     SOLAR[34] + DISCHARGE[34] - CHARGE[34]
     SOLAR[35] + DISCHARGE[35] - CHARGE[35]
     SOLAR[36] + DISCHARGE[36] - CHARGE[36]
     SOLAR[37] + DISCHARGE[37] - CHARGE[37]
     SOLAR[38] + DISCHARGE[38] - CHARGE[38]
     SOLAR[39] + DISCHARGE[39] - CHARGE[39]
     SOLAR[40] + DISCHARGE[40] - CHARGE[40]
     SOLAR[41] + DISCHARGE[41] - CHARGE[41]
     SOLAR[42] + DISCHARGE[42] - CHARGE[42]
     SOLAR[43] + DISCHARGE[43] - CHARGE[43]
     SOLAR[44] + DISCHARGE[44] - CHARGE[44]
     SOLAR[45] + DISCHARGE[45] - CHARGE[45]
     SOLAR[46] + DISCHARGE[46] - CHARGE[46]
     SOLAR[47] + DISCHARGE[47] - CHARGE[47]
     SOLAR[48] + DISCHARGE[48] - CHARGE[48]
     SOLAR[49] + DISCHARGE[49] - CHARGE[49]
     SOLAR[50] + DISCHARGE[50] - CHARGE[50]
     SOLAR[51] + DISCHARGE[51] - CHARGE[51]
     SOLAR[52] + DISCHARGE[52] - CHARGE[52]
     SOLAR[53] + DISCHARGE[53] - CHARGE[53]
     SOLAR[54] + DISCHARGE[54] - CHARGE[54]
     SOLAR[55] + DISCHARGE[55] - CHARGE[55]
     SOLAR[56] + DISCHARGE[56] - CHARGE[56]
     SOLAR[57] + DISCHARGE[57] - CHARGE[57]
     SOLAR[58] + DISCHARGE[58] - CHARGE[58]
     SOLAR[59] + DISCHARGE[59] - CHARGE[59]
     SOLAR[60] + DISCHARGE[60] - CHARGE[60]
     SOLAR[61] + DISCHARGE[61] - CHARGE[61]
     SOLAR[62] + DISCHARGE[62] - CHARGE[62]
     SOLAR[63] + DISCHARGE[63] - CHARGE[63]
     SOLAR[64] + DISCHARGE[64] - CHARGE[64]
     SOLAR[65] + DISCHARGE[65] - CHARGE[65]
     SOLAR[66] + DISCHARGE[66] - CHARGE[66]
     SOLAR[67] + DISCHARGE[67] - CHARGE[67]
     SOLAR[68] + DISCHARGE[68] - CHARGE[68]
     SOLAR[69] + DISCHARGE[69] - CHARGE[69]
     SOLAR[70] + DISCHARGE[70] - CHARGE[70]
     SOLAR[71] + DISCHARGE[71] - CHARGE[71]
     SOLAR[72] + DISCHARGE[72] - CHARGE[72]
     SOLAR[73] + DISCHARGE[73] - CHARGE[73]
     SOLAR[74] + DISCHARGE[74] - CHARGE[74]
     SOLAR[75] + DISCHARGE[75] - CHARGE[75]
     SOLAR[76] + DISCHARGE[76] - CHARGE[76]
     SOLAR[77] + DISCHARGE[77] - CHARGE[77]
     SOLAR[78] + DISCHARGE[78] - CHARGE[78]
     SOLAR[79] + DISCHARGE[79] - CHARGE[79]
     SOLAR[80] + DISCHARGE[80] - CHARGE[80]
     SOLAR[81] + DISCHARGE[81] - CHARGE[81]
     SOLAR[82] + DISCHARGE[82] - CHARGE[82]
     SOLAR[83] + DISCHARGE[83] - CHARGE[83]
     SOLAR[84] + DISCHARGE[84] - CHARGE[84]
     SOLAR[85] + DISCHARGE[85] - CHARGE[85]
     SOLAR[86] + DISCHARGE[86] - CHARGE[86]
     SOLAR[87] + DISCHARGE[87] - CHARGE[87]
     SOLAR[88] + DISCHARGE[88] - CHARGE[88]
     SOLAR[89] + DISCHARGE[89] - CHARGE[89]
     SOLAR[90] + DISCHARGE[90] - CHARGE[90]
     SOLAR[91] + DISCHARGE[91] - CHARGE[91]
     SOLAR[92] + DISCHARGE[92] - CHARGE[92]
     SOLAR[93] + DISCHARGE[93] - CHARGE[93]
     SOLAR[94] + DISCHARGE[94] - CHARGE[94]
     SOLAR[95] + DISCHARGE[95] - CHARGE[95]
     SOLAR[96] + DISCHARGE[96] - CHARGE[96]
    eNetExport = 1-dimensional DenseAxisArray{GenericAffExpr{Float64,VariableRef},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{GenericAffExpr{Float64,VariableRef},1}:
     1.1111111111111112 GRIDEXPORT[1] - 0.9 GRIDIMPORT[1]
     1.1111111111111112 GRIDEXPORT[2] - 0.9 GRIDIMPORT[2]
     1.1111111111111112 GRIDEXPORT[3] - 0.9 GRIDIMPORT[3]
     1.1111111111111112 GRIDEXPORT[4] - 0.9 GRIDIMPORT[4]
     1.1111111111111112 GRIDEXPORT[5] - 0.9 GRIDIMPORT[5]
     1.1111111111111112 GRIDEXPORT[6] - 0.9 GRIDIMPORT[6]
     1.1111111111111112 GRIDEXPORT[7] - 0.9 GRIDIMPORT[7]
     1.1111111111111112 GRIDEXPORT[8] - 0.9 GRIDIMPORT[8]
     1.1111111111111112 GRIDEXPORT[9] - 0.9 GRIDIMPORT[9]
     1.1111111111111112 GRIDEXPORT[10] - 0.9 GRIDIMPORT[10]
     1.1111111111111112 GRIDEXPORT[11] - 0.9 GRIDIMPORT[11]
     1.1111111111111112 GRIDEXPORT[12] - 0.9 GRIDIMPORT[12]
     1.1111111111111112 GRIDEXPORT[13] - 0.9 GRIDIMPORT[13]
     1.1111111111111112 GRIDEXPORT[14] - 0.9 GRIDIMPORT[14]
     1.1111111111111112 GRIDEXPORT[15] - 0.9 GRIDIMPORT[15]
     1.1111111111111112 GRIDEXPORT[16] - 0.9 GRIDIMPORT[16]
     1.1111111111111112 GRIDEXPORT[17] - 0.9 GRIDIMPORT[17]
     1.1111111111111112 GRIDEXPORT[18] - 0.9 GRIDIMPORT[18]
     1.1111111111111112 GRIDEXPORT[19] - 0.9 GRIDIMPORT[19]
     1.1111111111111112 GRIDEXPORT[20] - 0.9 GRIDIMPORT[20]
     1.1111111111111112 GRIDEXPORT[21] - 0.9 GRIDIMPORT[21]
     1.1111111111111112 GRIDEXPORT[22] - 0.9 GRIDIMPORT[22]
     1.1111111111111112 GRIDEXPORT[23] - 0.9 GRIDIMPORT[23]
     1.1111111111111112 GRIDEXPORT[24] - 0.9 GRIDIMPORT[24]
     1.1111111111111112 GRIDEXPORT[25] - 0.9 GRIDIMPORT[25]
     1.1111111111111112 GRIDEXPORT[26] - 0.9 GRIDIMPORT[26]
     1.1111111111111112 GRIDEXPORT[27] - 0.9 GRIDIMPORT[27]
     1.1111111111111112 GRIDEXPORT[28] - 0.9 GRIDIMPORT[28]
     1.1111111111111112 GRIDEXPORT[29] - 0.9 GRIDIMPORT[29]
     1.1111111111111112 GRIDEXPORT[30] - 0.9 GRIDIMPORT[30]
     1.1111111111111112 GRIDEXPORT[31] - 0.9 GRIDIMPORT[31]
     1.1111111111111112 GRIDEXPORT[32] - 0.9 GRIDIMPORT[32]
     1.1111111111111112 GRIDEXPORT[33] - 0.9 GRIDIMPORT[33]
     1.1111111111111112 GRIDEXPORT[34] - 0.9 GRIDIMPORT[34]
     1.1111111111111112 GRIDEXPORT[35] - 0.9 GRIDIMPORT[35]
     1.1111111111111112 GRIDEXPORT[36] - 0.9 GRIDIMPORT[36]
     1.1111111111111112 GRIDEXPORT[37] - 0.9 GRIDIMPORT[37]
     1.1111111111111112 GRIDEXPORT[38] - 0.9 GRIDIMPORT[38]
     1.1111111111111112 GRIDEXPORT[39] - 0.9 GRIDIMPORT[39]
     1.1111111111111112 GRIDEXPORT[40] - 0.9 GRIDIMPORT[40]
     1.1111111111111112 GRIDEXPORT[41] - 0.9 GRIDIMPORT[41]
     1.1111111111111112 GRIDEXPORT[42] - 0.9 GRIDIMPORT[42]
     1.1111111111111112 GRIDEXPORT[43] - 0.9 GRIDIMPORT[43]
     1.1111111111111112 GRIDEXPORT[44] - 0.9 GRIDIMPORT[44]
     1.1111111111111112 GRIDEXPORT[45] - 0.9 GRIDIMPORT[45]
     1.1111111111111112 GRIDEXPORT[46] - 0.9 GRIDIMPORT[46]
     1.1111111111111112 GRIDEXPORT[47] - 0.9 GRIDIMPORT[47]
     1.1111111111111112 GRIDEXPORT[48] - 0.9 GRIDIMPORT[48]
     1.1111111111111112 GRIDEXPORT[49] - 0.9 GRIDIMPORT[49]
     1.1111111111111112 GRIDEXPORT[50] - 0.9 GRIDIMPORT[50]
     1.1111111111111112 GRIDEXPORT[51] - 0.9 GRIDIMPORT[51]
     1.1111111111111112 GRIDEXPORT[52] - 0.9 GRIDIMPORT[52]
     1.1111111111111112 GRIDEXPORT[53] - 0.9 GRIDIMPORT[53]
     1.1111111111111112 GRIDEXPORT[54] - 0.9 GRIDIMPORT[54]
     1.1111111111111112 GRIDEXPORT[55] - 0.9 GRIDIMPORT[55]
     1.1111111111111112 GRIDEXPORT[56] - 0.9 GRIDIMPORT[56]
     1.1111111111111112 GRIDEXPORT[57] - 0.9 GRIDIMPORT[57]
     1.1111111111111112 GRIDEXPORT[58] - 0.9 GRIDIMPORT[58]
     1.1111111111111112 GRIDEXPORT[59] - 0.9 GRIDIMPORT[59]
     1.1111111111111112 GRIDEXPORT[60] - 0.9 GRIDIMPORT[60]
     1.1111111111111112 GRIDEXPORT[61] - 0.9 GRIDIMPORT[61]
     1.1111111111111112 GRIDEXPORT[62] - 0.9 GRIDIMPORT[62]
     1.1111111111111112 GRIDEXPORT[63] - 0.9 GRIDIMPORT[63]
     1.1111111111111112 GRIDEXPORT[64] - 0.9 GRIDIMPORT[64]
     1.1111111111111112 GRIDEXPORT[65] - 0.9 GRIDIMPORT[65]
     1.1111111111111112 GRIDEXPORT[66] - 0.9 GRIDIMPORT[66]
     1.1111111111111112 GRIDEXPORT[67] - 0.9 GRIDIMPORT[67]
     1.1111111111111112 GRIDEXPORT[68] - 0.9 GRIDIMPORT[68]
     1.1111111111111112 GRIDEXPORT[69] - 0.9 GRIDIMPORT[69]
     1.1111111111111112 GRIDEXPORT[70] - 0.9 GRIDIMPORT[70]
     1.1111111111111112 GRIDEXPORT[71] - 0.9 GRIDIMPORT[71]
     1.1111111111111112 GRIDEXPORT[72] - 0.9 GRIDIMPORT[72]
     1.1111111111111112 GRIDEXPORT[73] - 0.9 GRIDIMPORT[73]
     1.1111111111111112 GRIDEXPORT[74] - 0.9 GRIDIMPORT[74]
     1.1111111111111112 GRIDEXPORT[75] - 0.9 GRIDIMPORT[75]
     1.1111111111111112 GRIDEXPORT[76] - 0.9 GRIDIMPORT[76]
     1.1111111111111112 GRIDEXPORT[77] - 0.9 GRIDIMPORT[77]
     1.1111111111111112 GRIDEXPORT[78] - 0.9 GRIDIMPORT[78]
     1.1111111111111112 GRIDEXPORT[79] - 0.9 GRIDIMPORT[79]
     1.1111111111111112 GRIDEXPORT[80] - 0.9 GRIDIMPORT[80]
     1.1111111111111112 GRIDEXPORT[81] - 0.9 GRIDIMPORT[81]
     1.1111111111111112 GRIDEXPORT[82] - 0.9 GRIDIMPORT[82]
     1.1111111111111112 GRIDEXPORT[83] - 0.9 GRIDIMPORT[83]
     1.1111111111111112 GRIDEXPORT[84] - 0.9 GRIDIMPORT[84]
     1.1111111111111112 GRIDEXPORT[85] - 0.9 GRIDIMPORT[85]
     1.1111111111111112 GRIDEXPORT[86] - 0.9 GRIDIMPORT[86]
     1.1111111111111112 GRIDEXPORT[87] - 0.9 GRIDIMPORT[87]
     1.1111111111111112 GRIDEXPORT[88] - 0.9 GRIDIMPORT[88]
     1.1111111111111112 GRIDEXPORT[89] - 0.9 GRIDIMPORT[89]
     1.1111111111111112 GRIDEXPORT[90] - 0.9 GRIDIMPORT[90]
     1.1111111111111112 GRIDEXPORT[91] - 0.9 GRIDIMPORT[91]
     1.1111111111111112 GRIDEXPORT[92] - 0.9 GRIDIMPORT[92]
     1.1111111111111112 GRIDEXPORT[93] - 0.9 GRIDIMPORT[93]
     1.1111111111111112 GRIDEXPORT[94] - 0.9 GRIDIMPORT[94]
     1.1111111111111112 GRIDEXPORT[95] - 0.9 GRIDIMPORT[95]
     1.1111111111111112 GRIDEXPORT[96] - 0.9 GRIDIMPORT[96]





    1-dimensional DenseAxisArray{GenericAffExpr{Float64,VariableRef},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{GenericAffExpr{Float64,VariableRef},1}:
     1.1111111111111112 GRIDEXPORT[1] - 0.9 GRIDIMPORT[1]
     1.1111111111111112 GRIDEXPORT[2] - 0.9 GRIDIMPORT[2]
     1.1111111111111112 GRIDEXPORT[3] - 0.9 GRIDIMPORT[3]
     1.1111111111111112 GRIDEXPORT[4] - 0.9 GRIDIMPORT[4]
     1.1111111111111112 GRIDEXPORT[5] - 0.9 GRIDIMPORT[5]
     1.1111111111111112 GRIDEXPORT[6] - 0.9 GRIDIMPORT[6]
     1.1111111111111112 GRIDEXPORT[7] - 0.9 GRIDIMPORT[7]
     1.1111111111111112 GRIDEXPORT[8] - 0.9 GRIDIMPORT[8]
     1.1111111111111112 GRIDEXPORT[9] - 0.9 GRIDIMPORT[9]
     1.1111111111111112 GRIDEXPORT[10] - 0.9 GRIDIMPORT[10]
     1.1111111111111112 GRIDEXPORT[11] - 0.9 GRIDIMPORT[11]
     1.1111111111111112 GRIDEXPORT[12] - 0.9 GRIDIMPORT[12]
     1.1111111111111112 GRIDEXPORT[13] - 0.9 GRIDIMPORT[13]
     ⋮
     1.1111111111111112 GRIDEXPORT[85] - 0.9 GRIDIMPORT[85]
     1.1111111111111112 GRIDEXPORT[86] - 0.9 GRIDIMPORT[86]
     1.1111111111111112 GRIDEXPORT[87] - 0.9 GRIDIMPORT[87]
     1.1111111111111112 GRIDEXPORT[88] - 0.9 GRIDIMPORT[88]
     1.1111111111111112 GRIDEXPORT[89] - 0.9 GRIDIMPORT[89]
     1.1111111111111112 GRIDEXPORT[90] - 0.9 GRIDIMPORT[90]
     1.1111111111111112 GRIDEXPORT[91] - 0.9 GRIDIMPORT[91]
     1.1111111111111112 GRIDEXPORT[92] - 0.9 GRIDIMPORT[92]
     1.1111111111111112 GRIDEXPORT[93] - 0.9 GRIDIMPORT[93]
     1.1111111111111112 GRIDEXPORT[94] - 0.9 GRIDIMPORT[94]
     1.1111111111111112 GRIDEXPORT[95] - 0.9 GRIDIMPORT[95]
     1.1111111111111112 GRIDEXPORT[96] - 0.9 GRIDIMPORT[96]



2. Second, the **total revenue** from sale or purchase of electricity in each time period is expressed by the sum product of prices in each interval times the net AC energy exported (or imported) to (or from) the grid (using the $GRIDEXPORT$ and $GRIDIMPORT$ decision variables). Since prices are expressed per whole MWh and our time intervals are 15 minutes, we multiply the net flow of AC power by 0.25 to determine the total energy sold/purchased.

$\begin{align*} 
&eRevenue = \sum_{t \in T} (GRIDEXPORT_t - GRIDIMPORT_t) \times Price_t \times 0.25
\end{align*}$

Here we see our first example of the syntax for a sum expression.


```julia
@expression(PV_model, eRevenue, sum((GRIDEXPORT[t]-GRIDIMPORT[t])*time_series.Price[t]*0.25 
        for t in time_series.T));
```


```julia
@show(eRevenue)
```

    eRevenue = 3.1925 GRIDEXPORT[1] - 3.1925 GRIDIMPORT[1] + 2.955 GRIDEXPORT[2] - 2.955 GRIDIMPORT[2] + 3.0975 GRIDEXPORT[3] - 3.0975 GRIDIMPORT[3] + 2.5425 GRIDEXPORT[4] - 2.5425 GRIDIMPORT[4] + 1.465 GRIDEXPORT[5] - 1.465 GRIDIMPORT[5] + 0.6725 GRIDEXPORT[6] - 0.6725 GRIDIMPORT[6] + 0.365 GRIDEXPORT[7] - 0.365 GRIDIMPORT[7] + 0.3525 GRIDEXPORT[8] - 0.3525 GRIDIMPORT[8] + 0.0075 GRIDEXPORT[9] - 0.0075 GRIDIMPORT[9] - 0.0475 GRIDEXPORT[10] + 0.0475 GRIDIMPORT[10] - 0.18 GRIDEXPORT[11] + 0.18 GRIDIMPORT[11] - 0.135 GRIDEXPORT[12] + 0.135 GRIDIMPORT[12] - 0.1125 GRIDEXPORT[13] + 0.1125 GRIDIMPORT[13] - 0.15 GRIDEXPORT[14] + 0.15 GRIDIMPORT[14] - 0.18 GRIDEXPORT[15] + 0.18 GRIDIMPORT[15] - 0.1575 GRIDEXPORT[16] + 0.1575 GRIDIMPORT[16] - 0.18 GRIDEXPORT[17] + 0.18 GRIDIMPORT[17] - 0.2975 GRIDEXPORT[18] + 0.2975 GRIDIMPORT[18] - 0.26 GRIDEXPORT[19] + 0.26 GRIDIMPORT[19] - 0.19 GRIDEXPORT[20] + 0.19 GRIDIMPORT[20] - 0.1175 GRIDEXPORT[21] + 0.1175 GRIDIMPORT[21] + 0.17 GRIDEXPORT[22] - 0.17 GRIDIMPORT[22] + 0.195 GRIDEXPORT[23] - 0.195 GRIDIMPORT[23] + 0.0225 GRIDEXPORT[24] - 0.0225 GRIDIMPORT[24] + 1.3775 GRIDEXPORT[25] - 1.3775 GRIDIMPORT[25] + 1.165 GRIDEXPORT[26] - 1.165 GRIDIMPORT[26] + 1.13 GRIDEXPORT[27] - 1.13 GRIDIMPORT[27] + 1.4725 GRIDEXPORT[28] - 1.4725 GRIDIMPORT[28] + 2.2075 GRIDEXPORT[29] - 2.2075 GRIDIMPORT[29] + 2.2075 GRIDEXPORT[30] - 2.2075 GRIDIMPORT[30] + 2.6175 GRIDEXPORT[31] - 2.6175 GRIDIMPORT[31] + 2.7425 GRIDEXPORT[32] - 2.7425 GRIDIMPORT[32] + 3.1125 GRIDEXPORT[33] - 3.1125 GRIDIMPORT[33] + 3.36 GRIDEXPORT[34] - 3.36 GRIDIMPORT[34] + 3.3775 GRIDEXPORT[35] - 3.3775 GRIDIMPORT[35] + 3.2975 GRIDEXPORT[36] - 3.2975 GRIDIMPORT[36] + 3.1925 GRIDEXPORT[37] - 3.1925 GRIDIMPORT[37] + 3.1625 GRIDEXPORT[38] - 3.1625 GRIDIMPORT[38] + 3.045 GRIDEXPORT[39] - 3.045 GRIDIMPORT[39] + 3.1125 GRIDEXPORT[40] - 3.1125 GRIDIMPORT[40] + 3.105 GRIDEXPORT[41] - 3.105 GRIDIMPORT[41] + 3.3125 GRIDEXPORT[42] - 3.3125 GRIDIMPORT[42] + 3.4025 GRIDEXPORT[43] - 3.4025 GRIDIMPORT[43] + 3.4625 GRIDEXPORT[44] - 3.4625 GRIDIMPORT[44] + 3.7975 GRIDEXPORT[45] - 3.7975 GRIDIMPORT[45] + 4.1375 GRIDEXPORT[46] - 4.1375 GRIDIMPORT[46] + 4.3125 GRIDEXPORT[47] - 4.3125 GRIDIMPORT[47] + 4.3 GRIDEXPORT[48] - 4.3 GRIDIMPORT[48] + 4.4925 GRIDEXPORT[49] - 4.4925 GRIDIMPORT[49] + 4.49 GRIDEXPORT[50] - 4.49 GRIDIMPORT[50] + 4.475 GRIDEXPORT[51] - 4.475 GRIDIMPORT[51] + 4.53 GRIDEXPORT[52] - 4.53 GRIDIMPORT[52] + 4.5175 GRIDEXPORT[53] - 4.5175 GRIDIMPORT[53] + 4.5525 GRIDEXPORT[54] - 4.5525 GRIDIMPORT[54] + 4.52 GRIDEXPORT[55] - 4.52 GRIDIMPORT[55] + 4.525 GRIDEXPORT[56] - 4.525 GRIDIMPORT[56] + 4.495 GRIDEXPORT[57] - 4.495 GRIDIMPORT[57] + 4.5875 GRIDEXPORT[58] - 4.5875 GRIDIMPORT[58] + 4.5125 GRIDEXPORT[59] - 4.5125 GRIDIMPORT[59] + 4.58 GRIDEXPORT[60] - 4.58 GRIDIMPORT[60] + 4.49 GRIDEXPORT[61] - 4.49 GRIDIMPORT[61] + 4.53 GRIDEXPORT[62] - 4.53 GRIDIMPORT[62] + 4.545 GRIDEXPORT[63] - 4.545 GRIDIMPORT[63] + 4.4925 GRIDEXPORT[64] - 4.4925 GRIDIMPORT[64] + 4.61 GRIDEXPORT[65] - 4.61 GRIDIMPORT[65] + 4.6875 GRIDEXPORT[66] - 4.6875 GRIDIMPORT[66] + 4.4 GRIDEXPORT[67] - 4.4 GRIDIMPORT[67] + 4.55 GRIDEXPORT[68] - 4.55 GRIDIMPORT[68] + 4.855 GRIDEXPORT[69] - 4.855 GRIDIMPORT[69] + 5.1125 GRIDEXPORT[70] - 5.1125 GRIDIMPORT[70] + 8.9475 GRIDEXPORT[71] - 8.9475 GRIDIMPORT[71] + 9.375 GRIDEXPORT[72] - 9.375 GRIDIMPORT[72] + 17.755 GRIDEXPORT[73] - 17.755 GRIDIMPORT[73] + 18.465 GRIDEXPORT[74] - 18.465 GRIDIMPORT[74] + 8.8375 GRIDEXPORT[75] - 8.8375 GRIDIMPORT[75] + 7.85 GRIDEXPORT[76] - 7.85 GRIDIMPORT[76] + 7.7225 GRIDEXPORT[77] - 7.7225 GRIDIMPORT[77] + 9.395 GRIDEXPORT[78] - 9.395 GRIDIMPORT[78] + 19.4625 GRIDEXPORT[79] - 19.4625 GRIDIMPORT[79] + 17.88 GRIDEXPORT[80] - 17.88 GRIDIMPORT[80] + 5.81 GRIDEXPORT[81] - 5.81 GRIDIMPORT[81] + 3.88 GRIDEXPORT[82] - 3.88 GRIDIMPORT[82] + 4.1575 GRIDEXPORT[83] - 4.1575 GRIDIMPORT[83] + 4.035 GRIDEXPORT[84] - 4.035 GRIDIMPORT[84] + 4.215 GRIDEXPORT[85] - 4.215 GRIDIMPORT[85] + 3.6075 GRIDEXPORT[86] - 3.6075 GRIDIMPORT[86] + 3.1175 GRIDEXPORT[87] - 3.1175 GRIDIMPORT[87] + 3.2775 GRIDEXPORT[88] - 3.2775 GRIDIMPORT[88] + 4.4025 GRIDEXPORT[89] - 4.4025 GRIDIMPORT[89] + 4.04 GRIDEXPORT[90] - 4.04 GRIDIMPORT[90] + 3.825 GRIDEXPORT[91] - 3.825 GRIDIMPORT[91] + 3.795 GRIDEXPORT[92] - 3.795 GRIDIMPORT[92] + 3.4025 GRIDEXPORT[93] - 3.4025 GRIDIMPORT[93] + 2.9725 GRIDEXPORT[94] - 2.9725 GRIDIMPORT[94] + 3.5575 GRIDEXPORT[95] - 3.5575 GRIDIMPORT[95] + 3.5225 GRIDEXPORT[96] - 3.5225 GRIDIMPORT[96]





$$ 3.1925 GRIDEXPORT_{1} - 3.1925 GRIDIMPORT_{1} + 2.955 GRIDEXPORT_{2} - 2.955 GRIDIMPORT_{2} + 3.0975 GRIDEXPORT_{3} - 3.0975 GRIDIMPORT_{3} + 2.5425 GRIDEXPORT_{4} - 2.5425 GRIDIMPORT_{4} + 1.465 GRIDEXPORT_{5} - 1.465 GRIDIMPORT_{5} + 0.6725 GRIDEXPORT_{6} - 0.6725 GRIDIMPORT_{6} + 0.365 GRIDEXPORT_{7} - 0.365 GRIDIMPORT_{7} + 0.3525 GRIDEXPORT_{8} - 0.3525 GRIDIMPORT_{8} + 0.0075 GRIDEXPORT_{9} - 0.0075 GRIDIMPORT_{9} - 0.0475 GRIDEXPORT_{10} + 0.0475 GRIDIMPORT_{10} - 0.18 GRIDEXPORT_{11} + 0.18 GRIDIMPORT_{11} - 0.135 GRIDEXPORT_{12} + 0.135 GRIDIMPORT_{12} - 0.1125 GRIDEXPORT_{13} + 0.1125 GRIDIMPORT_{13} - 0.15 GRIDEXPORT_{14} + 0.15 GRIDIMPORT_{14} - 0.18 GRIDEXPORT_{15} + 0.18 GRIDIMPORT_{15} - 0.1575 GRIDEXPORT_{16} + 0.1575 GRIDIMPORT_{16} - 0.18 GRIDEXPORT_{17} + 0.18 GRIDIMPORT_{17} - 0.2975 GRIDEXPORT_{18} + 0.2975 GRIDIMPORT_{18} - 0.26 GRIDEXPORT_{19} + 0.26 GRIDIMPORT_{19} - 0.19 GRIDEXPORT_{20} + 0.19 GRIDIMPORT_{20} - 0.1175 GRIDEXPORT_{21} + 0.1175 GRIDIMPORT_{21} + 0.17 GRIDEXPORT_{22} - 0.17 GRIDIMPORT_{22} + 0.195 GRIDEXPORT_{23} - 0.195 GRIDIMPORT_{23} + 0.0225 GRIDEXPORT_{24} - 0.0225 GRIDIMPORT_{24} + 1.3775 GRIDEXPORT_{25} - 1.3775 GRIDIMPORT_{25} + 1.165 GRIDEXPORT_{26} - 1.165 GRIDIMPORT_{26} + 1.13 GRIDEXPORT_{27} - 1.13 GRIDIMPORT_{27} + 1.4725 GRIDEXPORT_{28} - 1.4725 GRIDIMPORT_{28} + 2.2075 GRIDEXPORT_{29} - 2.2075 GRIDIMPORT_{29} + 2.2075 GRIDEXPORT_{30} - 2.2075 GRIDIMPORT_{30} + 2.6175 GRIDEXPORT_{31} - 2.6175 GRIDIMPORT_{31} + 2.7425 GRIDEXPORT_{32} - 2.7425 GRIDIMPORT_{32} + 3.1125 GRIDEXPORT_{33} - 3.1125 GRIDIMPORT_{33} + 3.36 GRIDEXPORT_{34} - 3.36 GRIDIMPORT_{34} + 3.3775 GRIDEXPORT_{35} - 3.3775 GRIDIMPORT_{35} + 3.2975 GRIDEXPORT_{36} - 3.2975 GRIDIMPORT_{36} + 3.1925 GRIDEXPORT_{37} - 3.1925 GRIDIMPORT_{37} + 3.1625 GRIDEXPORT_{38} - 3.1625 GRIDIMPORT_{38} + 3.045 GRIDEXPORT_{39} - 3.045 GRIDIMPORT_{39} + 3.1125 GRIDEXPORT_{40} - 3.1125 GRIDIMPORT_{40} + 3.105 GRIDEXPORT_{41} - 3.105 GRIDIMPORT_{41} + 3.3125 GRIDEXPORT_{42} - 3.3125 GRIDIMPORT_{42} + 3.4025 GRIDEXPORT_{43} - 3.4025 GRIDIMPORT_{43} + 3.4625 GRIDEXPORT_{44} - 3.4625 GRIDIMPORT_{44} + 3.7975 GRIDEXPORT_{45} - 3.7975 GRIDIMPORT_{45} + 4.1375 GRIDEXPORT_{46} - 4.1375 GRIDIMPORT_{46} + 4.3125 GRIDEXPORT_{47} - 4.3125 GRIDIMPORT_{47} + 4.3 GRIDEXPORT_{48} - 4.3 GRIDIMPORT_{48} + 4.4925 GRIDEXPORT_{49} - 4.4925 GRIDIMPORT_{49} + 4.49 GRIDEXPORT_{50} - 4.49 GRIDIMPORT_{50} + 4.475 GRIDEXPORT_{51} - 4.475 GRIDIMPORT_{51} + 4.53 GRIDEXPORT_{52} - 4.53 GRIDIMPORT_{52} + 4.5175 GRIDEXPORT_{53} - 4.5175 GRIDIMPORT_{53} + 4.5525 GRIDEXPORT_{54} - 4.5525 GRIDIMPORT_{54} + 4.52 GRIDEXPORT_{55} - 4.52 GRIDIMPORT_{55} + 4.525 GRIDEXPORT_{56} - 4.525 GRIDIMPORT_{56} + 4.495 GRIDEXPORT_{57} - 4.495 GRIDIMPORT_{57} + 4.5875 GRIDEXPORT_{58} - 4.5875 GRIDIMPORT_{58} + 4.5125 GRIDEXPORT_{59} - 4.5125 GRIDIMPORT_{59} + 4.58 GRIDEXPORT_{60} - 4.58 GRIDIMPORT_{60} + 4.49 GRIDEXPORT_{61} - 4.49 GRIDIMPORT_{61} + 4.53 GRIDEXPORT_{62} - 4.53 GRIDIMPORT_{62} + 4.545 GRIDEXPORT_{63} - 4.545 GRIDIMPORT_{63} + 4.4925 GRIDEXPORT_{64} - 4.4925 GRIDIMPORT_{64} + 4.61 GRIDEXPORT_{65} - 4.61 GRIDIMPORT_{65} + 4.6875 GRIDEXPORT_{66} - 4.6875 GRIDIMPORT_{66} + 4.4 GRIDEXPORT_{67} - 4.4 GRIDIMPORT_{67} + 4.55 GRIDEXPORT_{68} - 4.55 GRIDIMPORT_{68} + 4.855 GRIDEXPORT_{69} - 4.855 GRIDIMPORT_{69} + 5.1125 GRIDEXPORT_{70} - 5.1125 GRIDIMPORT_{70} + 8.9475 GRIDEXPORT_{71} - 8.9475 GRIDIMPORT_{71} + 9.375 GRIDEXPORT_{72} - 9.375 GRIDIMPORT_{72} + 17.755 GRIDEXPORT_{73} - 17.755 GRIDIMPORT_{73} + 18.465 GRIDEXPORT_{74} - 18.465 GRIDIMPORT_{74} + 8.8375 GRIDEXPORT_{75} - 8.8375 GRIDIMPORT_{75} + 7.85 GRIDEXPORT_{76} - 7.85 GRIDIMPORT_{76} + 7.7225 GRIDEXPORT_{77} - 7.7225 GRIDIMPORT_{77} + 9.395 GRIDEXPORT_{78} - 9.395 GRIDIMPORT_{78} + 19.4625 GRIDEXPORT_{79} - 19.4625 GRIDIMPORT_{79} + 17.88 GRIDEXPORT_{80} - 17.88 GRIDIMPORT_{80} + 5.81 GRIDEXPORT_{81} - 5.81 GRIDIMPORT_{81} + 3.88 GRIDEXPORT_{82} - 3.88 GRIDIMPORT_{82} + 4.1575 GRIDEXPORT_{83} - 4.1575 GRIDIMPORT_{83} + 4.035 GRIDEXPORT_{84} - 4.035 GRIDIMPORT_{84} + 4.215 GRIDEXPORT_{85} - 4.215 GRIDIMPORT_{85} + 3.6075 GRIDEXPORT_{86} - 3.6075 GRIDIMPORT_{86} + 3.1175 GRIDEXPORT_{87} - 3.1175 GRIDIMPORT_{87} + 3.2775 GRIDEXPORT_{88} - 3.2775 GRIDIMPORT_{88} + 4.4025 GRIDEXPORT_{89} - 4.4025 GRIDIMPORT_{89} + 4.04 GRIDEXPORT_{90} - 4.04 GRIDIMPORT_{90} + 3.825 GRIDEXPORT_{91} - 3.825 GRIDIMPORT_{91} + 3.795 GRIDEXPORT_{92} - 3.795 GRIDIMPORT_{92} + 3.4025 GRIDEXPORT_{93} - 3.4025 GRIDIMPORT_{93} + 2.9725 GRIDEXPORT_{94} - 2.9725 GRIDIMPORT_{94} + 3.5575 GRIDEXPORT_{95} - 3.5575 GRIDIMPORT_{95} + 3.5225 GRIDEXPORT_{96} - 3.5225 GRIDIMPORT_{96} $$



Note that JuMP automatically interprets our expression definitions by converting the parameter references to constants and distributing terms into [linear combination](https://en.wikipedia.org/wiki/Linear_combination) of coefficients and decision variabes, as per the displayed text above. So feel free to define these expressions however you'd like, and JuMP will take care of the math...

### 5. Constraints

Now we define a set of constraints that define the feasible region for our decision variables, based on the engineering constraints for our solar and storage system.

Note that by convention, and to distinguish constraint names from decision variable names and expression names, we will use the convention that all constraint names take the format `cExpressionName`. (This is an optional convention, and you can feel free to adopt your own, but we recommend adopting a consistent convention for naming variables, constraints, expressions, parameters, etc.)

1. First, we must conserve energy in each time interval. Power produced in the system over each 15 minute interval must match the net power injected into the grid, accounting for losses from converting DC to AC power and vice versa at the inverter ($inverter\_eff$). This is what is known as an **energy balance constraint**. We'll make use of our previously defined expression for net DC power produced/consumed by our solar+storage system ($eNetSolarStorage$) and our expression for net DC exports/imports ($eNetExports$) here, and ensure that the two expressions always always equal -- no free energy here! 

$\begin{align*} 
\quad eNetSolarStorage = eNetExport \quad \forall t \in T
\end{align*}$


```julia
@constraint(PV_model, 
    cEnergyBalance[t in time_series.T], # Named array of constraints indexed across all times t in T
    eNetSolarStorage[t] == eNetExport[t]  # Constraint definition
);
```


```julia
@show(cEnergyBalance)
```

    cEnergyBalance = 1-dimensional DenseAxisArray{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}},ScalarShape},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}},ScalarShape},1}:
     cEnergyBalance[1] : SOLAR[1] + DISCHARGE[1] - CHARGE[1] - 1.1111111111111112 GRIDEXPORT[1] + 0.9 GRIDIMPORT[1] = 0.0
     cEnergyBalance[2] : SOLAR[2] + DISCHARGE[2] - CHARGE[2] - 1.1111111111111112 GRIDEXPORT[2] + 0.9 GRIDIMPORT[2] = 0.0
     cEnergyBalance[3] : SOLAR[3] + DISCHARGE[3] - CHARGE[3] - 1.1111111111111112 GRIDEXPORT[3] + 0.9 GRIDIMPORT[3] = 0.0
     cEnergyBalance[4] : SOLAR[4] + DISCHARGE[4] - CHARGE[4] - 1.1111111111111112 GRIDEXPORT[4] + 0.9 GRIDIMPORT[4] = 0.0
     cEnergyBalance[5] : SOLAR[5] + DISCHARGE[5] - CHARGE[5] - 1.1111111111111112 GRIDEXPORT[5] + 0.9 GRIDIMPORT[5] = 0.0
     cEnergyBalance[6] : SOLAR[6] + DISCHARGE[6] - CHARGE[6] - 1.1111111111111112 GRIDEXPORT[6] + 0.9 GRIDIMPORT[6] = 0.0
     cEnergyBalance[7] : SOLAR[7] + DISCHARGE[7] - CHARGE[7] - 1.1111111111111112 GRIDEXPORT[7] + 0.9 GRIDIMPORT[7] = 0.0
     cEnergyBalance[8] : SOLAR[8] + DISCHARGE[8] - CHARGE[8] - 1.1111111111111112 GRIDEXPORT[8] + 0.9 GRIDIMPORT[8] = 0.0
     cEnergyBalance[9] : SOLAR[9] + DISCHARGE[9] - CHARGE[9] - 1.1111111111111112 GRIDEXPORT[9] + 0.9 GRIDIMPORT[9] = 0.0
     cEnergyBalance[10] : SOLAR[10] + DISCHARGE[10] - CHARGE[10] - 1.1111111111111112 GRIDEXPORT[10] + 0.9 GRIDIMPORT[10] = 0.0
     cEnergyBalance[11] : SOLAR[11] + DISCHARGE[11] - CHARGE[11] - 1.1111111111111112 GRIDEXPORT[11] + 0.9 GRIDIMPORT[11] = 0.0
     cEnergyBalance[12] : SOLAR[12] + DISCHARGE[12] - CHARGE[12] - 1.1111111111111112 GRIDEXPORT[12] + 0.9 GRIDIMPORT[12] = 0.0
     cEnergyBalance[13] : SOLAR[13] + DISCHARGE[13] - CHARGE[13] - 1.1111111111111112 GRIDEXPORT[13] + 0.9 GRIDIMPORT[13] = 0.0
     cEnergyBalance[14] : SOLAR[14] + DISCHARGE[14] - CHARGE[14] - 1.1111111111111112 GRIDEXPORT[14] + 0.9 GRIDIMPORT[14] = 0.0
     cEnergyBalance[15] : SOLAR[15] + DISCHARGE[15] - CHARGE[15] - 1.1111111111111112 GRIDEXPORT[15] + 0.9 GRIDIMPORT[15] = 0.0
     cEnergyBalance[16] : SOLAR[16] + DISCHARGE[16] - CHARGE[16] - 1.1111111111111112 GRIDEXPORT[16] + 0.9 GRIDIMPORT[16] = 0.0
     cEnergyBalance[17] : SOLAR[17] + DISCHARGE[17] - CHARGE[17] - 1.1111111111111112 GRIDEXPORT[17] + 0.9 GRIDIMPORT[17] = 0.0
     cEnergyBalance[18] : SOLAR[18] + DISCHARGE[18] - CHARGE[18] - 1.1111111111111112 GRIDEXPORT[18] + 0.9 GRIDIMPORT[18] = 0.0
     cEnergyBalance[19] : SOLAR[19] + DISCHARGE[19] - CHARGE[19] - 1.1111111111111112 GRIDEXPORT[19] + 0.9 GRIDIMPORT[19] = 0.0
     cEnergyBalance[20] : SOLAR[20] + DISCHARGE[20] - CHARGE[20] - 1.1111111111111112 GRIDEXPORT[20] + 0.9 GRIDIMPORT[20] = 0.0
     cEnergyBalance[21] : SOLAR[21] + DISCHARGE[21] - CHARGE[21] - 1.1111111111111112 GRIDEXPORT[21] + 0.9 GRIDIMPORT[21] = 0.0
     cEnergyBalance[22] : SOLAR[22] + DISCHARGE[22] - CHARGE[22] - 1.1111111111111112 GRIDEXPORT[22] + 0.9 GRIDIMPORT[22] = 0.0
     cEnergyBalance[23] : SOLAR[23] + DISCHARGE[23] - CHARGE[23] - 1.1111111111111112 GRIDEXPORT[23] + 0.9 GRIDIMPORT[23] = 0.0
     cEnergyBalance[24] : SOLAR[24] + DISCHARGE[24] - CHARGE[24] - 1.1111111111111112 GRIDEXPORT[24] + 0.9 GRIDIMPORT[24] = 0.0
     cEnergyBalance[25] : SOLAR[25] + DISCHARGE[25] - CHARGE[25] - 1.1111111111111112 GRIDEXPORT[25] + 0.9 GRIDIMPORT[25] = 0.0
     cEnergyBalance[26] : SOLAR[26] + DISCHARGE[26] - CHARGE[26] - 1.1111111111111112 GRIDEXPORT[26] + 0.9 GRIDIMPORT[26] = 0.0
     cEnergyBalance[27] : SOLAR[27] + DISCHARGE[27] - CHARGE[27] - 1.1111111111111112 GRIDEXPORT[27] + 0.9 GRIDIMPORT[27] = 0.0
     cEnergyBalance[28] : SOLAR[28] + DISCHARGE[28] - CHARGE[28] - 1.1111111111111112 GRIDEXPORT[28] + 0.9 GRIDIMPORT[28] = 0.0
     cEnergyBalance[29] : SOLAR[29] + DISCHARGE[29] - CHARGE[29] - 1.1111111111111112 GRIDEXPORT[29] + 0.9 GRIDIMPORT[29] = 0.0
     cEnergyBalance[30] : SOLAR[30] + DISCHARGE[30] - CHARGE[30] - 1.1111111111111112 GRIDEXPORT[30] + 0.9 GRIDIMPORT[30] = 0.0
     cEnergyBalance[31] : SOLAR[31] + DISCHARGE[31] - CHARGE[31] - 1.1111111111111112 GRIDEXPORT[31] + 0.9 GRIDIMPORT[31] = 0.0
     cEnergyBalance[32] : SOLAR[32] + DISCHARGE[32] - CHARGE[32] - 1.1111111111111112 GRIDEXPORT[32] + 0.9 GRIDIMPORT[32] = 0.0
     cEnergyBalance[33] : SOLAR[33] + DISCHARGE[33] - CHARGE[33] - 1.1111111111111112 GRIDEXPORT[33] + 0.9 GRIDIMPORT[33] = 0.0
     cEnergyBalance[34] : SOLAR[34] + DISCHARGE[34] - CHARGE[34] - 1.1111111111111112 GRIDEXPORT[34] + 0.9 GRIDIMPORT[34] = 0.0
     cEnergyBalance[35] : SOLAR[35] + DISCHARGE[35] - CHARGE[35] - 1.1111111111111112 GRIDEXPORT[35] + 0.9 GRIDIMPORT[35] = 0.0
     cEnergyBalance[36] : SOLAR[36] + DISCHARGE[36] - CHARGE[36] - 1.1111111111111112 GRIDEXPORT[36] + 0.9 GRIDIMPORT[36] = 0.0
     cEnergyBalance[37] : SOLAR[37] + DISCHARGE[37] - CHARGE[37] - 1.1111111111111112 GRIDEXPORT[37] + 0.9 GRIDIMPORT[37] = 0.0
     cEnergyBalance[38] : SOLAR[38] + DISCHARGE[38] - CHARGE[38] - 1.1111111111111112 GRIDEXPORT[38] + 0.9 GRIDIMPORT[38] = 0.0
     cEnergyBalance[39] : SOLAR[39] + DISCHARGE[39] - CHARGE[39] - 1.1111111111111112 GRIDEXPORT[39] + 0.9 GRIDIMPORT[39] = 0.0
     cEnergyBalance[40] : SOLAR[40] + DISCHARGE[40] - CHARGE[40] - 1.1111111111111112 GRIDEXPORT[40] + 0.9 GRIDIMPORT[40] = 0.0
     cEnergyBalance[41] : SOLAR[41] + DISCHARGE[41] - CHARGE[41] - 1.1111111111111112 GRIDEXPORT[41] + 0.9 GRIDIMPORT[41] = 0.0
     cEnergyBalance[42] : SOLAR[42] + DISCHARGE[42] - CHARGE[42] - 1.1111111111111112 GRIDEXPORT[42] + 0.9 GRIDIMPORT[42] = 0.0
     cEnergyBalance[43] : SOLAR[43] + DISCHARGE[43] - CHARGE[43] - 1.1111111111111112 GRIDEXPORT[43] + 0.9 GRIDIMPORT[43] = 0.0
     cEnergyBalance[44] : SOLAR[44] + DISCHARGE[44] - CHARGE[44] - 1.1111111111111112 GRIDEXPORT[44] + 0.9 GRIDIMPORT[44] = 0.0
     cEnergyBalance[45] : SOLAR[45] + DISCHARGE[45] - CHARGE[45] - 1.1111111111111112 GRIDEXPORT[45] + 0.9 GRIDIMPORT[45] = 0.0
     cEnergyBalance[46] : SOLAR[46] + DISCHARGE[46] - CHARGE[46] - 1.1111111111111112 GRIDEXPORT[46] + 0.9 GRIDIMPORT[46] = 0.0
     cEnergyBalance[47] : SOLAR[47] + DISCHARGE[47] - CHARGE[47] - 1.1111111111111112 GRIDEXPORT[47] + 0.9 GRIDIMPORT[47] = 0.0
     cEnergyBalance[48] : SOLAR[48] + DISCHARGE[48] - CHARGE[48] - 1.1111111111111112 GRIDEXPORT[48] + 0.9 GRIDIMPORT[48] = 0.0
     cEnergyBalance[49] : SOLAR[49] + DISCHARGE[49] - CHARGE[49] - 1.1111111111111112 GRIDEXPORT[49] + 0.9 GRIDIMPORT[49] = 0.0
     cEnergyBalance[50] : SOLAR[50] + DISCHARGE[50] - CHARGE[50] - 1.1111111111111112 GRIDEXPORT[50] + 0.9 GRIDIMPORT[50] = 0.0
     cEnergyBalance[51] : SOLAR[51] + DISCHARGE[51] - CHARGE[51] - 1.1111111111111112 GRIDEXPORT[51] + 0.9 GRIDIMPORT[51] = 0.0
     cEnergyBalance[52] : SOLAR[52] + DISCHARGE[52] - CHARGE[52] - 1.1111111111111112 GRIDEXPORT[52] + 0.9 GRIDIMPORT[52] = 0.0
     cEnergyBalance[53] : SOLAR[53] + DISCHARGE[53] - CHARGE[53] - 1.1111111111111112 GRIDEXPORT[53] + 0.9 GRIDIMPORT[53] = 0.0
     cEnergyBalance[54] : SOLAR[54] + DISCHARGE[54] - CHARGE[54] - 1.1111111111111112 GRIDEXPORT[54] + 0.9 GRIDIMPORT[54] = 0.0
     cEnergyBalance[55] : SOLAR[55] + DISCHARGE[55] - CHARGE[55] - 1.1111111111111112 GRIDEXPORT[55] + 0.9 GRIDIMPORT[55] = 0.0
     cEnergyBalance[56] : SOLAR[56] + DISCHARGE[56] - CHARGE[56] - 1.1111111111111112 GRIDEXPORT[56] + 0.9 GRIDIMPORT[56] = 0.0
     cEnergyBalance[57] : SOLAR[57] + DISCHARGE[57] - CHARGE[57] - 1.1111111111111112 GRIDEXPORT[57] + 0.9 GRIDIMPORT[57] = 0.0
     cEnergyBalance[58] : SOLAR[58] + DISCHARGE[58] - CHARGE[58] - 1.1111111111111112 GRIDEXPORT[58] + 0.9 GRIDIMPORT[58] = 0.0
     cEnergyBalance[59] : SOLAR[59] + DISCHARGE[59] - CHARGE[59] - 1.1111111111111112 GRIDEXPORT[59] + 0.9 GRIDIMPORT[59] = 0.0
     cEnergyBalance[60] : SOLAR[60] + DISCHARGE[60] - CHARGE[60] - 1.1111111111111112 GRIDEXPORT[60] + 0.9 GRIDIMPORT[60] = 0.0
     cEnergyBalance[61] : SOLAR[61] + DISCHARGE[61] - CHARGE[61] - 1.1111111111111112 GRIDEXPORT[61] + 0.9 GRIDIMPORT[61] = 0.0
     cEnergyBalance[62] : SOLAR[62] + DISCHARGE[62] - CHARGE[62] - 1.1111111111111112 GRIDEXPORT[62] + 0.9 GRIDIMPORT[62] = 0.0
     cEnergyBalance[63] : SOLAR[63] + DISCHARGE[63] - CHARGE[63] - 1.1111111111111112 GRIDEXPORT[63] + 0.9 GRIDIMPORT[63] = 0.0
     cEnergyBalance[64] : SOLAR[64] + DISCHARGE[64] - CHARGE[64] - 1.1111111111111112 GRIDEXPORT[64] + 0.9 GRIDIMPORT[64] = 0.0
     cEnergyBalance[65] : SOLAR[65] + DISCHARGE[65] - CHARGE[65] - 1.1111111111111112 GRIDEXPORT[65] + 0.9 GRIDIMPORT[65] = 0.0
     cEnergyBalance[66] : SOLAR[66] + DISCHARGE[66] - CHARGE[66] - 1.1111111111111112 GRIDEXPORT[66] + 0.9 GRIDIMPORT[66] = 0.0
     cEnergyBalance[67] : SOLAR[67] + DISCHARGE[67] - CHARGE[67] - 1.1111111111111112 GRIDEXPORT[67] + 0.9 GRIDIMPORT[67] = 0.0
     cEnergyBalance[68] : SOLAR[68] + DISCHARGE[68] - CHARGE[68] - 1.1111111111111112 GRIDEXPORT[68] + 0.9 GRIDIMPORT[68] = 0.0
     cEnergyBalance[69] : SOLAR[69] + DISCHARGE[69] - CHARGE[69] - 1.1111111111111112 GRIDEXPORT[69] + 0.9 GRIDIMPORT[69] = 0.0
     cEnergyBalance[70] : SOLAR[70] + DISCHARGE[70] - CHARGE[70] - 1.1111111111111112 GRIDEXPORT[70] + 0.9 GRIDIMPORT[70] = 0.0
     cEnergyBalance[71] : SOLAR[71] + DISCHARGE[71] - CHARGE[71] - 1.1111111111111112 GRIDEXPORT[71] + 0.9 GRIDIMPORT[71] = 0.0
     cEnergyBalance[72] : SOLAR[72] + DISCHARGE[72] - CHARGE[72] - 1.1111111111111112 GRIDEXPORT[72] + 0.9 GRIDIMPORT[72] = 0.0
     cEnergyBalance[73] : SOLAR[73] + DISCHARGE[73] - CHARGE[73] - 1.1111111111111112 GRIDEXPORT[73] + 0.9 GRIDIMPORT[73] = 0.0
     cEnergyBalance[74] : SOLAR[74] + DISCHARGE[74] - CHARGE[74] - 1.1111111111111112 GRIDEXPORT[74] + 0.9 GRIDIMPORT[74] = 0.0
     cEnergyBalance[75] : SOLAR[75] + DISCHARGE[75] - CHARGE[75] - 1.1111111111111112 GRIDEXPORT[75] + 0.9 GRIDIMPORT[75] = 0.0
     cEnergyBalance[76] : SOLAR[76] + DISCHARGE[76] - CHARGE[76] - 1.1111111111111112 GRIDEXPORT[76] + 0.9 GRIDIMPORT[76] = 0.0
     cEnergyBalance[77] : SOLAR[77] + DISCHARGE[77] - CHARGE[77] - 1.1111111111111112 GRIDEXPORT[77] + 0.9 GRIDIMPORT[77] = 0.0
     cEnergyBalance[78] : SOLAR[78] + DISCHARGE[78] - CHARGE[78] - 1.1111111111111112 GRIDEXPORT[78] + 0.9 GRIDIMPORT[78] = 0.0
     cEnergyBalance[79] : SOLAR[79] + DISCHARGE[79] - CHARGE[79] - 1.1111111111111112 GRIDEXPORT[79] + 0.9 GRIDIMPORT[79] = 0.0
     cEnergyBalance[80] : SOLAR[80] + DISCHARGE[80] - CHARGE[80] - 1.1111111111111112 GRIDEXPORT[80] + 0.9 GRIDIMPORT[80] = 0.0
     cEnergyBalance[81] : SOLAR[81] + DISCHARGE[81] - CHARGE[81] - 1.1111111111111112 GRIDEXPORT[81] + 0.9 GRIDIMPORT[81] = 0.0
     cEnergyBalance[82] : SOLAR[82] + DISCHARGE[82] - CHARGE[82] - 1.1111111111111112 GRIDEXPORT[82] + 0.9 GRIDIMPORT[82] = 0.0
     cEnergyBalance[83] : SOLAR[83] + DISCHARGE[83] - CHARGE[83] - 1.1111111111111112 GRIDEXPORT[83] + 0.9 GRIDIMPORT[83] = 0.0
     cEnergyBalance[84] : SOLAR[84] + DISCHARGE[84] - CHARGE[84] - 1.1111111111111112 GRIDEXPORT[84] + 0.9 GRIDIMPORT[84] = 0.0
     cEnergyBalance[85] : SOLAR[85] + DISCHARGE[85] - CHARGE[85] - 1.1111111111111112 GRIDEXPORT[85] + 0.9 GRIDIMPORT[85] = 0.0
     cEnergyBalance[86] : SOLAR[86] + DISCHARGE[86] - CHARGE[86] - 1.1111111111111112 GRIDEXPORT[86] + 0.9 GRIDIMPORT[86] = 0.0
     cEnergyBalance[87] : SOLAR[87] + DISCHARGE[87] - CHARGE[87] - 1.1111111111111112 GRIDEXPORT[87] + 0.9 GRIDIMPORT[87] = 0.0
     cEnergyBalance[88] : SOLAR[88] + DISCHARGE[88] - CHARGE[88] - 1.1111111111111112 GRIDEXPORT[88] + 0.9 GRIDIMPORT[88] = 0.0
     cEnergyBalance[89] : SOLAR[89] + DISCHARGE[89] - CHARGE[89] - 1.1111111111111112 GRIDEXPORT[89] + 0.9 GRIDIMPORT[89] = 0.0
     cEnergyBalance[90] : SOLAR[90] + DISCHARGE[90] - CHARGE[90] - 1.1111111111111112 GRIDEXPORT[90] + 0.9 GRIDIMPORT[90] = 0.0
     cEnergyBalance[91] : SOLAR[91] + DISCHARGE[91] - CHARGE[91] - 1.1111111111111112 GRIDEXPORT[91] + 0.9 GRIDIMPORT[91] = 0.0
     cEnergyBalance[92] : SOLAR[92] + DISCHARGE[92] - CHARGE[92] - 1.1111111111111112 GRIDEXPORT[92] + 0.9 GRIDIMPORT[92] = 0.0
     cEnergyBalance[93] : SOLAR[93] + DISCHARGE[93] - CHARGE[93] - 1.1111111111111112 GRIDEXPORT[93] + 0.9 GRIDIMPORT[93] = 0.0
     cEnergyBalance[94] : SOLAR[94] + DISCHARGE[94] - CHARGE[94] - 1.1111111111111112 GRIDEXPORT[94] + 0.9 GRIDIMPORT[94] = 0.0
     cEnergyBalance[95] : SOLAR[95] + DISCHARGE[95] - CHARGE[95] - 1.1111111111111112 GRIDEXPORT[95] + 0.9 GRIDIMPORT[95] = 0.0
     cEnergyBalance[96] : SOLAR[96] + DISCHARGE[96] - CHARGE[96] - 1.1111111111111112 GRIDEXPORT[96] + 0.9 GRIDIMPORT[96] = 0.0





    1-dimensional DenseAxisArray{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}},ScalarShape},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}},ScalarShape},1}:
     cEnergyBalance[1] : SOLAR[1] + DISCHARGE[1] - CHARGE[1] - 1.1111111111111112 GRIDEXPORT[1] + 0.9 GRIDIMPORT[1] = 0.0
     cEnergyBalance[2] : SOLAR[2] + DISCHARGE[2] - CHARGE[2] - 1.1111111111111112 GRIDEXPORT[2] + 0.9 GRIDIMPORT[2] = 0.0
     cEnergyBalance[3] : SOLAR[3] + DISCHARGE[3] - CHARGE[3] - 1.1111111111111112 GRIDEXPORT[3] + 0.9 GRIDIMPORT[3] = 0.0
     cEnergyBalance[4] : SOLAR[4] + DISCHARGE[4] - CHARGE[4] - 1.1111111111111112 GRIDEXPORT[4] + 0.9 GRIDIMPORT[4] = 0.0
     cEnergyBalance[5] : SOLAR[5] + DISCHARGE[5] - CHARGE[5] - 1.1111111111111112 GRIDEXPORT[5] + 0.9 GRIDIMPORT[5] = 0.0
     cEnergyBalance[6] : SOLAR[6] + DISCHARGE[6] - CHARGE[6] - 1.1111111111111112 GRIDEXPORT[6] + 0.9 GRIDIMPORT[6] = 0.0
     cEnergyBalance[7] : SOLAR[7] + DISCHARGE[7] - CHARGE[7] - 1.1111111111111112 GRIDEXPORT[7] + 0.9 GRIDIMPORT[7] = 0.0
     cEnergyBalance[8] : SOLAR[8] + DISCHARGE[8] - CHARGE[8] - 1.1111111111111112 GRIDEXPORT[8] + 0.9 GRIDIMPORT[8] = 0.0
     cEnergyBalance[9] : SOLAR[9] + DISCHARGE[9] - CHARGE[9] - 1.1111111111111112 GRIDEXPORT[9] + 0.9 GRIDIMPORT[9] = 0.0
     cEnergyBalance[10] : SOLAR[10] + DISCHARGE[10] - CHARGE[10] - 1.1111111111111112 GRIDEXPORT[10] + 0.9 GRIDIMPORT[10] = 0.0
     cEnergyBalance[11] : SOLAR[11] + DISCHARGE[11] - CHARGE[11] - 1.1111111111111112 GRIDEXPORT[11] + 0.9 GRIDIMPORT[11] = 0.0
     cEnergyBalance[12] : SOLAR[12] + DISCHARGE[12] - CHARGE[12] - 1.1111111111111112 GRIDEXPORT[12] + 0.9 GRIDIMPORT[12] = 0.0
     cEnergyBalance[13] : SOLAR[13] + DISCHARGE[13] - CHARGE[13] - 1.1111111111111112 GRIDEXPORT[13] + 0.9 GRIDIMPORT[13] = 0.0
     ⋮
     cEnergyBalance[85] : SOLAR[85] + DISCHARGE[85] - CHARGE[85] - 1.1111111111111112 GRIDEXPORT[85] + 0.9 GRIDIMPORT[85] = 0.0
     cEnergyBalance[86] : SOLAR[86] + DISCHARGE[86] - CHARGE[86] - 1.1111111111111112 GRIDEXPORT[86] + 0.9 GRIDIMPORT[86] = 0.0
     cEnergyBalance[87] : SOLAR[87] + DISCHARGE[87] - CHARGE[87] - 1.1111111111111112 GRIDEXPORT[87] + 0.9 GRIDIMPORT[87] = 0.0
     cEnergyBalance[88] : SOLAR[88] + DISCHARGE[88] - CHARGE[88] - 1.1111111111111112 GRIDEXPORT[88] + 0.9 GRIDIMPORT[88] = 0.0
     cEnergyBalance[89] : SOLAR[89] + DISCHARGE[89] - CHARGE[89] - 1.1111111111111112 GRIDEXPORT[89] + 0.9 GRIDIMPORT[89] = 0.0
     cEnergyBalance[90] : SOLAR[90] + DISCHARGE[90] - CHARGE[90] - 1.1111111111111112 GRIDEXPORT[90] + 0.9 GRIDIMPORT[90] = 0.0
     cEnergyBalance[91] : SOLAR[91] + DISCHARGE[91] - CHARGE[91] - 1.1111111111111112 GRIDEXPORT[91] + 0.9 GRIDIMPORT[91] = 0.0
     cEnergyBalance[92] : SOLAR[92] + DISCHARGE[92] - CHARGE[92] - 1.1111111111111112 GRIDEXPORT[92] + 0.9 GRIDIMPORT[92] = 0.0
     cEnergyBalance[93] : SOLAR[93] + DISCHARGE[93] - CHARGE[93] - 1.1111111111111112 GRIDEXPORT[93] + 0.9 GRIDIMPORT[93] = 0.0
     cEnergyBalance[94] : SOLAR[94] + DISCHARGE[94] - CHARGE[94] - 1.1111111111111112 GRIDEXPORT[94] + 0.9 GRIDIMPORT[94] = 0.0
     cEnergyBalance[95] : SOLAR[95] + DISCHARGE[95] - CHARGE[95] - 1.1111111111111112 GRIDEXPORT[95] + 0.9 GRIDIMPORT[95] = 0.0
     cEnergyBalance[96] : SOLAR[96] + DISCHARGE[96] - CHARGE[96] - 1.1111111111111112 GRIDEXPORT[96] + 0.9 GRIDIMPORT[96] = 0.0



You can see that JuMP automatically interprets the expressions here to construct constraints that are [linear combinations](https://en.wikipedia.org/wiki/Linear_combination) of parameters and decision variables only, and moves to the right hand side a single constant (in this case $0$.) That is, JuMP automatically converts all constraint expressions to the form:

$\begin{align*}
&a_1 \times x_1 + a_2 \times x_2 + ... + a_N \times x_N == b\\
&\text{or: } \sum_{i=1:N} a_i x_i == b
\end{align*}$  

...or the equivalent with inequalities ($\geq$ or $\leq)$ replacing the equality constraint. 

So feel free to express constraint definitions in whatever way is most intuitive to you, and JuMP will figure out the rest.

2. The **state of charge** of the battery is constrainted to be equal to the state of charge in the prior time period `t-1` plus the energy charged during this time period less the energy discharged during this time period, accounting for storage efficiency losses. 

$\begin{align*} 
SOC_t = SOC_{t-1} + 0.25\big(CHARGE_t * battery\_eff - \frac{DISCHARGE_t}{battery\_eff}\big)  \quad \forall t \in T
\end{align*}$

Note that as we model 15 minute time steps here, we multiply the charge and discharge power (in MW) by 0.25 to determine the change in storage energy (in MWh). 

This is an example of a recursive constraint: the state of charge in each period depends on the state of charge in the prior period. So we have to define a special case for the first time period, with the starting state of charge as the simulation defined by a parameter earlier. As each expression refers to the expression in the previous time step, we will proceed through a `for` loop to define each expression...


```julia
# First define an Array of length equal to our time series to contain references to each expression
cStateOfCharge = Array{Any}(undef, length(time_series.T))

# First period state of charge:
cStateOfCharge[1] = @constraint(PV_model, 
    SOC[1] == start_charge + (CHARGE[1]*battery_eff - DISCHARGE[1]/battery_eff)*0.25
) 

# All other time periods, defined recursively based on prior state of charge
for t in time_series.T[(time_series.T .> 1)]
    cStateOfCharge[t] = @constraint(PV_model, 
        SOC[t] == SOC[t-1] + CHARGE[t]*battery_eff*0.25 - DISCHARGE[t]/battery_eff*0.25
    )
end

# cStateOfCharge # display constraints
```


```julia
@show(cStateOfCharge)
```

    cStateOfCharge = Any[SOC[1] - 0.2375 CHARGE[1] + 0.2631578947368421 DISCHARGE[1] = 20.0, SOC[2] - SOC[1] - 0.2375 CHARGE[2] + 0.2631578947368421 DISCHARGE[2] = 0.0, SOC[3] - SOC[2] - 0.2375 CHARGE[3] + 0.2631578947368421 DISCHARGE[3] = 0.0, SOC[4] - SOC[3] - 0.2375 CHARGE[4] + 0.2631578947368421 DISCHARGE[4] = 0.0, SOC[5] - SOC[4] - 0.2375 CHARGE[5] + 0.2631578947368421 DISCHARGE[5] = 0.0, SOC[6] - SOC[5] - 0.2375 CHARGE[6] + 0.2631578947368421 DISCHARGE[6] = 0.0, SOC[7] - SOC[6] - 0.2375 CHARGE[7] + 0.2631578947368421 DISCHARGE[7] = 0.0, SOC[8] - SOC[7] - 0.2375 CHARGE[8] + 0.2631578947368421 DISCHARGE[8] = 0.0, SOC[9] - SOC[8] - 0.2375 CHARGE[9] + 0.2631578947368421 DISCHARGE[9] = 0.0, SOC[10] - SOC[9] - 0.2375 CHARGE[10] + 0.2631578947368421 DISCHARGE[10] = 0.0, SOC[11] - SOC[10] - 0.2375 CHARGE[11] + 0.2631578947368421 DISCHARGE[11] = 0.0, SOC[12] - SOC[11] - 0.2375 CHARGE[12] + 0.2631578947368421 DISCHARGE[12] = 0.0, SOC[13] - SOC[12] - 0.2375 CHARGE[13] + 0.2631578947368421 DISCHARGE[13] = 0.0, SOC[14] - SOC[13] - 0.2375 CHARGE[14] + 0.2631578947368421 DISCHARGE[14] = 0.0, SOC[15] - SOC[14] - 0.2375 CHARGE[15] + 0.2631578947368421 DISCHARGE[15] = 0.0, SOC[16] - SOC[15] - 0.2375 CHARGE[16] + 0.2631578947368421 DISCHARGE[16] = 0.0, SOC[17] - SOC[16] - 0.2375 CHARGE[17] + 0.2631578947368421 DISCHARGE[17] = 0.0, SOC[18] - SOC[17] - 0.2375 CHARGE[18] + 0.2631578947368421 DISCHARGE[18] = 0.0, SOC[19] - SOC[18] - 0.2375 CHARGE[19] + 0.2631578947368421 DISCHARGE[19] = 0.0, SOC[20] - SOC[19] - 0.2375 CHARGE[20] + 0.2631578947368421 DISCHARGE[20] = 0.0, SOC[21] - SOC[20] - 0.2375 CHARGE[21] + 0.2631578947368421 DISCHARGE[21] = 0.0, SOC[22] - SOC[21] - 0.2375 CHARGE[22] + 0.2631578947368421 DISCHARGE[22] = 0.0, SOC[23] - SOC[22] - 0.2375 CHARGE[23] + 0.2631578947368421 DISCHARGE[23] = 0.0, SOC[24] - SOC[23] - 0.2375 CHARGE[24] + 0.2631578947368421 DISCHARGE[24] = 0.0, SOC[25] - SOC[24] - 0.2375 CHARGE[25] + 0.2631578947368421 DISCHARGE[25] = 0.0, SOC[26] - SOC[25] - 0.2375 CHARGE[26] + 0.2631578947368421 DISCHARGE[26] = 0.0, SOC[27] - SOC[26] - 0.2375 CHARGE[27] + 0.2631578947368421 DISCHARGE[27] = 0.0, SOC[28] - SOC[27] - 0.2375 CHARGE[28] + 0.2631578947368421 DISCHARGE[28] = 0.0, SOC[29] - SOC[28] - 0.2375 CHARGE[29] + 0.2631578947368421 DISCHARGE[29] = 0.0, SOC[30] - SOC[29] - 0.2375 CHARGE[30] + 0.2631578947368421 DISCHARGE[30] = 0.0, SOC[31] - SOC[30] - 0.2375 CHARGE[31] + 0.2631578947368421 DISCHARGE[31] = 0.0, SOC[32] - SOC[31] - 0.2375 CHARGE[32] + 0.2631578947368421 DISCHARGE[32] = 0.0, SOC[33] - SOC[32] - 0.2375 CHARGE[33] + 0.2631578947368421 DISCHARGE[33] = 0.0, SOC[34] - SOC[33] - 0.2375 CHARGE[34] + 0.2631578947368421 DISCHARGE[34] = 0.0, SOC[35] - SOC[34] - 0.2375 CHARGE[35] + 0.2631578947368421 DISCHARGE[35] = 0.0, SOC[36] - SOC[35] - 0.2375 CHARGE[36] + 0.2631578947368421 DISCHARGE[36] = 0.0, SOC[37] - SOC[36] - 0.2375 CHARGE[37] + 0.2631578947368421 DISCHARGE[37] = 0.0, SOC[38] - SOC[37] - 0.2375 CHARGE[38] + 0.2631578947368421 DISCHARGE[38] = 0.0, SOC[39] - SOC[38] - 0.2375 CHARGE[39] + 0.2631578947368421 DISCHARGE[39] = 0.0, SOC[40] - SOC[39] - 0.2375 CHARGE[40] + 0.2631578947368421 DISCHARGE[40] = 0.0, SOC[41] - SOC[40] - 0.2375 CHARGE[41] + 0.2631578947368421 DISCHARGE[41] = 0.0, SOC[42] - SOC[41] - 0.2375 CHARGE[42] + 0.2631578947368421 DISCHARGE[42] = 0.0, SOC[43] - SOC[42] - 0.2375 CHARGE[43] + 0.2631578947368421 DISCHARGE[43] = 0.0, SOC[44] - SOC[43] - 0.2375 CHARGE[44] + 0.2631578947368421 DISCHARGE[44] = 0.0, SOC[45] - SOC[44] - 0.2375 CHARGE[45] + 0.2631578947368421 DISCHARGE[45] = 0.0, SOC[46] - SOC[45] - 0.2375 CHARGE[46] + 0.2631578947368421 DISCHARGE[46] = 0.0, SOC[47] - SOC[46] - 0.2375 CHARGE[47] + 0.2631578947368421 DISCHARGE[47] = 0.0, SOC[48] - SOC[47] - 0.2375 CHARGE[48] + 0.2631578947368421 DISCHARGE[48] = 0.0, SOC[49] - SOC[48] - 0.2375 CHARGE[49] + 0.2631578947368421 DISCHARGE[49] = 0.0, SOC[50] - SOC[49] - 0.2375 CHARGE[50] + 0.2631578947368421 DISCHARGE[50] = 0.0, SOC[51] - SOC[50] - 0.2375 CHARGE[51] + 0.2631578947368421 DISCHARGE[51] = 0.0, SOC[52] - SOC[51] - 0.2375 CHARGE[52] + 0.2631578947368421 DISCHARGE[52] = 0.0, SOC[53] - SOC[52] - 0.2375 CHARGE[53] + 0.2631578947368421 DISCHARGE[53] = 0.0, SOC[54] - SOC[53] - 0.2375 CHARGE[54] + 0.2631578947368421 DISCHARGE[54] = 0.0, SOC[55] - SOC[54] - 0.2375 CHARGE[55] + 0.2631578947368421 DISCHARGE[55] = 0.0, SOC[56] - SOC[55] - 0.2375 CHARGE[56] + 0.2631578947368421 DISCHARGE[56] = 0.0, SOC[57] - SOC[56] - 0.2375 CHARGE[57] + 0.2631578947368421 DISCHARGE[57] = 0.0, SOC[58] - SOC[57] - 0.2375 CHARGE[58] + 0.2631578947368421 DISCHARGE[58] = 0.0, SOC[59] - SOC[58] - 0.2375 CHARGE[59] + 0.2631578947368421 DISCHARGE[59] = 0.0, SOC[60] - SOC[59] - 0.2375 CHARGE[60] + 0.2631578947368421 DISCHARGE[60] = 0.0, SOC[61] - SOC[60] - 0.2375 CHARGE[61] + 0.2631578947368421 DISCHARGE[61] = 0.0, SOC[62] - SOC[61] - 0.2375 CHARGE[62] + 0.2631578947368421 DISCHARGE[62] = 0.0, SOC[63] - SOC[62] - 0.2375 CHARGE[63] + 0.2631578947368421 DISCHARGE[63] = 0.0, SOC[64] - SOC[63] - 0.2375 CHARGE[64] + 0.2631578947368421 DISCHARGE[64] = 0.0, SOC[65] - SOC[64] - 0.2375 CHARGE[65] + 0.2631578947368421 DISCHARGE[65] = 0.0, SOC[66] - SOC[65] - 0.2375 CHARGE[66] + 0.2631578947368421 DISCHARGE[66] = 0.0, SOC[67] - SOC[66] - 0.2375 CHARGE[67] + 0.2631578947368421 DISCHARGE[67] = 0.0, SOC[68] - SOC[67] - 0.2375 CHARGE[68] + 0.2631578947368421 DISCHARGE[68] = 0.0, SOC[69] - SOC[68] - 0.2375 CHARGE[69] + 0.2631578947368421 DISCHARGE[69] = 0.0, SOC[70] - SOC[69] - 0.2375 CHARGE[70] + 0.2631578947368421 DISCHARGE[70] = 0.0, SOC[71] - SOC[70] - 0.2375 CHARGE[71] + 0.2631578947368421 DISCHARGE[71] = 0.0, SOC[72] - SOC[71] - 0.2375 CHARGE[72] + 0.2631578947368421 DISCHARGE[72] = 0.0, SOC[73] - SOC[72] - 0.2375 CHARGE[73] + 0.2631578947368421 DISCHARGE[73] = 0.0, SOC[74] - SOC[73] - 0.2375 CHARGE[74] + 0.2631578947368421 DISCHARGE[74] = 0.0, SOC[75] - SOC[74] - 0.2375 CHARGE[75] + 0.2631578947368421 DISCHARGE[75] = 0.0, SOC[76] - SOC[75] - 0.2375 CHARGE[76] + 0.2631578947368421 DISCHARGE[76] = 0.0, SOC[77] - SOC[76] - 0.2375 CHARGE[77] + 0.2631578947368421 DISCHARGE[77] = 0.0, SOC[78] - SOC[77] - 0.2375 CHARGE[78] + 0.2631578947368421 DISCHARGE[78] = 0.0, SOC[79] - SOC[78] - 0.2375 CHARGE[79] + 0.2631578947368421 DISCHARGE[79] = 0.0, SOC[80] - SOC[79] - 0.2375 CHARGE[80] + 0.2631578947368421 DISCHARGE[80] = 0.0, SOC[81] - SOC[80] - 0.2375 CHARGE[81] + 0.2631578947368421 DISCHARGE[81] = 0.0, SOC[82] - SOC[81] - 0.2375 CHARGE[82] + 0.2631578947368421 DISCHARGE[82] = 0.0, SOC[83] - SOC[82] - 0.2375 CHARGE[83] + 0.2631578947368421 DISCHARGE[83] = 0.0, SOC[84] - SOC[83] - 0.2375 CHARGE[84] + 0.2631578947368421 DISCHARGE[84] = 0.0, SOC[85] - SOC[84] - 0.2375 CHARGE[85] + 0.2631578947368421 DISCHARGE[85] = 0.0, SOC[86] - SOC[85] - 0.2375 CHARGE[86] + 0.2631578947368421 DISCHARGE[86] = 0.0, SOC[87] - SOC[86] - 0.2375 CHARGE[87] + 0.2631578947368421 DISCHARGE[87] = 0.0, SOC[88] - SOC[87] - 0.2375 CHARGE[88] + 0.2631578947368421 DISCHARGE[88] = 0.0, SOC[89] - SOC[88] - 0.2375 CHARGE[89] + 0.2631578947368421 DISCHARGE[89] = 0.0, SOC[90] - SOC[89] - 0.2375 CHARGE[90] + 0.2631578947368421 DISCHARGE[90] = 0.0, SOC[91] - SOC[90] - 0.2375 CHARGE[91] + 0.2631578947368421 DISCHARGE[91] = 0.0, SOC[92] - SOC[91] - 0.2375 CHARGE[92] + 0.2631578947368421 DISCHARGE[92] = 0.0, SOC[93] - SOC[92] - 0.2375 CHARGE[93] + 0.2631578947368421 DISCHARGE[93] = 0.0, SOC[94] - SOC[93] - 0.2375 CHARGE[94] + 0.2631578947368421 DISCHARGE[94] = 0.0, SOC[95] - SOC[94] - 0.2375 CHARGE[95] + 0.2631578947368421 DISCHARGE[95] = 0.0, SOC[96] - SOC[95] - 0.2375 CHARGE[96] + 0.2631578947368421 DISCHARGE[96] = 0.0]





    96-element Array{Any,1}:
     SOC[1] - 0.2375 CHARGE[1] + 0.2631578947368421 DISCHARGE[1] = 20.0
     SOC[2] - SOC[1] - 0.2375 CHARGE[2] + 0.2631578947368421 DISCHARGE[2] = 0.0
     SOC[3] - SOC[2] - 0.2375 CHARGE[3] + 0.2631578947368421 DISCHARGE[3] = 0.0
     SOC[4] - SOC[3] - 0.2375 CHARGE[4] + 0.2631578947368421 DISCHARGE[4] = 0.0
     SOC[5] - SOC[4] - 0.2375 CHARGE[5] + 0.2631578947368421 DISCHARGE[5] = 0.0
     SOC[6] - SOC[5] - 0.2375 CHARGE[6] + 0.2631578947368421 DISCHARGE[6] = 0.0
     SOC[7] - SOC[6] - 0.2375 CHARGE[7] + 0.2631578947368421 DISCHARGE[7] = 0.0
     SOC[8] - SOC[7] - 0.2375 CHARGE[8] + 0.2631578947368421 DISCHARGE[8] = 0.0
     SOC[9] - SOC[8] - 0.2375 CHARGE[9] + 0.2631578947368421 DISCHARGE[9] = 0.0
     SOC[10] - SOC[9] - 0.2375 CHARGE[10] + 0.2631578947368421 DISCHARGE[10] = 0.0
     SOC[11] - SOC[10] - 0.2375 CHARGE[11] + 0.2631578947368421 DISCHARGE[11] = 0.0
     SOC[12] - SOC[11] - 0.2375 CHARGE[12] + 0.2631578947368421 DISCHARGE[12] = 0.0
     SOC[13] - SOC[12] - 0.2375 CHARGE[13] + 0.2631578947368421 DISCHARGE[13] = 0.0
     ⋮
     SOC[85] - SOC[84] - 0.2375 CHARGE[85] + 0.2631578947368421 DISCHARGE[85] = 0.0
     SOC[86] - SOC[85] - 0.2375 CHARGE[86] + 0.2631578947368421 DISCHARGE[86] = 0.0
     SOC[87] - SOC[86] - 0.2375 CHARGE[87] + 0.2631578947368421 DISCHARGE[87] = 0.0
     SOC[88] - SOC[87] - 0.2375 CHARGE[88] + 0.2631578947368421 DISCHARGE[88] = 0.0
     SOC[89] - SOC[88] - 0.2375 CHARGE[89] + 0.2631578947368421 DISCHARGE[89] = 0.0
     SOC[90] - SOC[89] - 0.2375 CHARGE[90] + 0.2631578947368421 DISCHARGE[90] = 0.0
     SOC[91] - SOC[90] - 0.2375 CHARGE[91] + 0.2631578947368421 DISCHARGE[91] = 0.0
     SOC[92] - SOC[91] - 0.2375 CHARGE[92] + 0.2631578947368421 DISCHARGE[92] = 0.0
     SOC[93] - SOC[92] - 0.2375 CHARGE[93] + 0.2631578947368421 DISCHARGE[93] = 0.0
     SOC[94] - SOC[93] - 0.2375 CHARGE[94] + 0.2631578947368421 DISCHARGE[94] = 0.0
     SOC[95] - SOC[94] - 0.2375 CHARGE[95] + 0.2631578947368421 DISCHARGE[95] = 0.0
     SOC[96] - SOC[95] - 0.2375 CHARGE[96] + 0.2631578947368421 DISCHARGE[96] = 0.0



3. Finally, we must constrain the **maximum solar PV output** to reflect the weather-dependent variation in solar insolation in each time period. The maximum available solar power output in each time interval is provided by the parameters in the Solar time series input data. Thus, the constraint is of the form:

$\begin{align*} 
SOLAR \leq time\_series.Solar_t \quad \forall t \in T
\end{align*}$


```julia
@constraint(PV_model, cMaxSolar[t in time_series.T], 
    SOLAR[t] <= time_series.Solar[t]
);
```


```julia
@show(cMaxSolar)
```

    cMaxSolar = 1-dimensional DenseAxisArray{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.LessThan{Float64}},ScalarShape},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.LessThan{Float64}},ScalarShape},1}:
     cMaxSolar[1] : SOLAR[1] ≤ 0.0
     cMaxSolar[2] : SOLAR[2] ≤ 0.0
     cMaxSolar[3] : SOLAR[3] ≤ 0.0
     cMaxSolar[4] : SOLAR[4] ≤ 0.0
     cMaxSolar[5] : SOLAR[5] ≤ 0.0
     cMaxSolar[6] : SOLAR[6] ≤ 0.0
     cMaxSolar[7] : SOLAR[7] ≤ 0.0
     cMaxSolar[8] : SOLAR[8] ≤ 0.0
     cMaxSolar[9] : SOLAR[9] ≤ 0.0
     cMaxSolar[10] : SOLAR[10] ≤ 0.0
     cMaxSolar[11] : SOLAR[11] ≤ 0.0
     cMaxSolar[12] : SOLAR[12] ≤ 0.0
     cMaxSolar[13] : SOLAR[13] ≤ 0.0
     cMaxSolar[14] : SOLAR[14] ≤ 0.0
     cMaxSolar[15] : SOLAR[15] ≤ 0.0
     cMaxSolar[16] : SOLAR[16] ≤ 0.0
     cMaxSolar[17] : SOLAR[17] ≤ 0.0
     cMaxSolar[18] : SOLAR[18] ≤ 0.0
     cMaxSolar[19] : SOLAR[19] ≤ 0.0
     cMaxSolar[20] : SOLAR[20] ≤ 0.0
     cMaxSolar[21] : SOLAR[21] ≤ 0.0
     cMaxSolar[22] : SOLAR[22] ≤ 0.0
     cMaxSolar[23] : SOLAR[23] ≤ 0.0
     cMaxSolar[24] : SOLAR[24] ≤ 0.0
     cMaxSolar[25] : SOLAR[25] ≤ 0.0
     cMaxSolar[26] : SOLAR[26] ≤ 0.077
     cMaxSolar[27] : SOLAR[27] ≤ 0.154
     cMaxSolar[28] : SOLAR[28] ≤ 0.232
     cMaxSolar[29] : SOLAR[29] ≤ 0.309
     cMaxSolar[30] : SOLAR[30] ≤ 7.94
     cMaxSolar[31] : SOLAR[31] ≤ 15.571
     cMaxSolar[32] : SOLAR[32] ≤ 23.202
     cMaxSolar[33] : SOLAR[33] ≤ 30.833
     cMaxSolar[34] : SOLAR[34] ≤ 33.823
     cMaxSolar[35] : SOLAR[35] ≤ 36.812
     cMaxSolar[36] : SOLAR[36] ≤ 39.801
     cMaxSolar[37] : SOLAR[37] ≤ 42.791
     cMaxSolar[38] : SOLAR[38] ≤ 44.029
     cMaxSolar[39] : SOLAR[39] ≤ 45.268
     cMaxSolar[40] : SOLAR[40] ≤ 46.507
     cMaxSolar[41] : SOLAR[41] ≤ 47.746
     cMaxSolar[42] : SOLAR[42] ≤ 48.298
     cMaxSolar[43] : SOLAR[43] ≤ 48.85
     cMaxSolar[44] : SOLAR[44] ≤ 49.401
     cMaxSolar[45] : SOLAR[45] ≤ 49.953
     cMaxSolar[46] : SOLAR[46] ≤ 49.965
     cMaxSolar[47] : SOLAR[47] ≤ 49.977
     cMaxSolar[48] : SOLAR[48] ≤ 49.988
     cMaxSolar[49] : SOLAR[49] ≤ 50.0
     cMaxSolar[50] : SOLAR[50] ≤ 49.778
     cMaxSolar[51] : SOLAR[51] ≤ 49.556
     cMaxSolar[52] : SOLAR[52] ≤ 49.335
     cMaxSolar[53] : SOLAR[53] ≤ 49.113
     cMaxSolar[54] : SOLAR[54] ≤ 48.549
     cMaxSolar[55] : SOLAR[55] ≤ 47.985
     cMaxSolar[56] : SOLAR[56] ≤ 47.422
     cMaxSolar[57] : SOLAR[57] ≤ 46.858
     cMaxSolar[58] : SOLAR[58] ≤ 45.588
     cMaxSolar[59] : SOLAR[59] ≤ 44.319
     cMaxSolar[60] : SOLAR[60] ≤ 43.049
     cMaxSolar[61] : SOLAR[61] ≤ 41.779
     cMaxSolar[62] : SOLAR[62] ≤ 39.388
     cMaxSolar[63] : SOLAR[63] ≤ 36.996
     cMaxSolar[64] : SOLAR[64] ≤ 34.604
     cMaxSolar[65] : SOLAR[65] ≤ 32.213
     cMaxSolar[66] : SOLAR[66] ≤ 27.218
     cMaxSolar[67] : SOLAR[67] ≤ 22.223
     cMaxSolar[68] : SOLAR[68] ≤ 17.228
     cMaxSolar[69] : SOLAR[69] ≤ 12.233
     cMaxSolar[70] : SOLAR[70] ≤ 9.175
     cMaxSolar[71] : SOLAR[71] ≤ 6.116
     cMaxSolar[72] : SOLAR[72] ≤ 3.058
     cMaxSolar[73] : SOLAR[73] ≤ 0.0
     cMaxSolar[74] : SOLAR[74] ≤ 0.0
     cMaxSolar[75] : SOLAR[75] ≤ 0.0
     cMaxSolar[76] : SOLAR[76] ≤ 0.0
     cMaxSolar[77] : SOLAR[77] ≤ 0.0
     cMaxSolar[78] : SOLAR[78] ≤ 0.0
     cMaxSolar[79] : SOLAR[79] ≤ 0.0
     cMaxSolar[80] : SOLAR[80] ≤ 0.0
     cMaxSolar[81] : SOLAR[81] ≤ 0.0
     cMaxSolar[82] : SOLAR[82] ≤ 0.0
     cMaxSolar[83] : SOLAR[83] ≤ 0.0
     cMaxSolar[84] : SOLAR[84] ≤ 0.0
     cMaxSolar[85] : SOLAR[85] ≤ 0.0
     cMaxSolar[86] : SOLAR[86] ≤ 0.0
     cMaxSolar[87] : SOLAR[87] ≤ 0.0
     cMaxSolar[88] : SOLAR[88] ≤ 0.0
     cMaxSolar[89] : SOLAR[89] ≤ 0.0
     cMaxSolar[90] : SOLAR[90] ≤ 0.0
     cMaxSolar[91] : SOLAR[91] ≤ 0.0
     cMaxSolar[92] : SOLAR[92] ≤ 0.0
     cMaxSolar[93] : SOLAR[93] ≤ 0.0
     cMaxSolar[94] : SOLAR[94] ≤ 0.0
     cMaxSolar[95] : SOLAR[95] ≤ 0.0
     cMaxSolar[96] : SOLAR[96] ≤ 0.0





    1-dimensional DenseAxisArray{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.LessThan{Float64}},ScalarShape},1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.LessThan{Float64}},ScalarShape},1}:
     cMaxSolar[1] : SOLAR[1] ≤ 0.0
     cMaxSolar[2] : SOLAR[2] ≤ 0.0
     cMaxSolar[3] : SOLAR[3] ≤ 0.0
     cMaxSolar[4] : SOLAR[4] ≤ 0.0
     cMaxSolar[5] : SOLAR[5] ≤ 0.0
     cMaxSolar[6] : SOLAR[6] ≤ 0.0
     cMaxSolar[7] : SOLAR[7] ≤ 0.0
     cMaxSolar[8] : SOLAR[8] ≤ 0.0
     cMaxSolar[9] : SOLAR[9] ≤ 0.0
     cMaxSolar[10] : SOLAR[10] ≤ 0.0
     cMaxSolar[11] : SOLAR[11] ≤ 0.0
     cMaxSolar[12] : SOLAR[12] ≤ 0.0
     cMaxSolar[13] : SOLAR[13] ≤ 0.0
     ⋮
     cMaxSolar[85] : SOLAR[85] ≤ 0.0
     cMaxSolar[86] : SOLAR[86] ≤ 0.0
     cMaxSolar[87] : SOLAR[87] ≤ 0.0
     cMaxSolar[88] : SOLAR[88] ≤ 0.0
     cMaxSolar[89] : SOLAR[89] ≤ 0.0
     cMaxSolar[90] : SOLAR[90] ≤ 0.0
     cMaxSolar[91] : SOLAR[91] ≤ 0.0
     cMaxSolar[92] : SOLAR[92] ≤ 0.0
     cMaxSolar[93] : SOLAR[93] ≤ 0.0
     cMaxSolar[94] : SOLAR[94] ≤ 0.0
     cMaxSolar[95] : SOLAR[95] ≤ 0.0
     cMaxSolar[96] : SOLAR[96] ≤ 0.0



### 6. Set Objective Function

Finally, we set our objective function, which is to maximize the revenue from our solar and storage system across the time series (one day). We can make use of the revenue expression we defined previous:

$\begin{align*} 
\max eRevenue &=\\
&\sum_{t \in T} (GRIDEXPORT_t - GRIDIMPORT_t) \times Price_t \times 0.25
\end{align*}$


```julia
@objective(PV_model, Max, eRevenue);
```




Let's take a look at our full model...



```julia
PV_model
```




$$ \begin{alignat*}{1}\max\quad & 3.1925 GRIDEXPORT_{1} - 3.1925 GRIDIMPORT_{1} + 2.955 GRIDEXPORT_{2} - 2.955 GRIDIMPORT_{2} + 3.0975 GRIDEXPORT_{3} - 3.0975 GRIDIMPORT_{3} + 2.5425 GRIDEXPORT_{4} - 2.5425 GRIDIMPORT_{4} + 1.465 GRIDEXPORT_{5} - 1.465 GRIDIMPORT_{5} + 0.6725 GRIDEXPORT_{6} - 0.6725 GRIDIMPORT_{6} + 0.365 GRIDEXPORT_{7} - 0.365 GRIDIMPORT_{7} + 0.3525 GRIDEXPORT_{8} - 0.3525 GRIDIMPORT_{8} + 0.0075 GRIDEXPORT_{9} - 0.0075 GRIDIMPORT_{9} - 0.0475 GRIDEXPORT_{10} + 0.0475 GRIDIMPORT_{10} - 0.18 GRIDEXPORT_{11} + 0.18 GRIDIMPORT_{11} - 0.135 GRIDEXPORT_{12} + 0.135 GRIDIMPORT_{12} - 0.1125 GRIDEXPORT_{13} + 0.1125 GRIDIMPORT_{13} - 0.15 GRIDEXPORT_{14} + 0.15 GRIDIMPORT_{14} - 0.18 GRIDEXPORT_{15} + 0.18 GRIDIMPORT_{15} - 0.1575 GRIDEXPORT_{16} + 0.1575 GRIDIMPORT_{16} - 0.18 GRIDEXPORT_{17} + 0.18 GRIDIMPORT_{17} - 0.2975 GRIDEXPORT_{18} + 0.2975 GRIDIMPORT_{18} - 0.26 GRIDEXPORT_{19} + 0.26 GRIDIMPORT_{19} - 0.19 GRIDEXPORT_{20} + 0.19 GRIDIMPORT_{20} - 0.1175 GRIDEXPORT_{21} + 0.1175 GRIDIMPORT_{21} + 0.17 GRIDEXPORT_{22} - 0.17 GRIDIMPORT_{22} + 0.195 GRIDEXPORT_{23} - 0.195 GRIDIMPORT_{23} + 0.0225 GRIDEXPORT_{24} - 0.0225 GRIDIMPORT_{24} + 1.3775 GRIDEXPORT_{25} - 1.3775 GRIDIMPORT_{25} + 1.165 GRIDEXPORT_{26} - 1.165 GRIDIMPORT_{26} + 1.13 GRIDEXPORT_{27} - 1.13 GRIDIMPORT_{27} + 1.4725 GRIDEXPORT_{28} - 1.4725 GRIDIMPORT_{28} + 2.2075 GRIDEXPORT_{29} - 2.2075 GRIDIMPORT_{29} + 2.2075 GRIDEXPORT_{30} - 2.2075 GRIDIMPORT_{30} + 2.6175 GRIDEXPORT_{31} - 2.6175 GRIDIMPORT_{31} + 2.7425 GRIDEXPORT_{32} - 2.7425 GRIDIMPORT_{32} + 3.1125 GRIDEXPORT_{33} - 3.1125 GRIDIMPORT_{33} + 3.36 GRIDEXPORT_{34} - 3.36 GRIDIMPORT_{34} + 3.3775 GRIDEXPORT_{35} - 3.3775 GRIDIMPORT_{35} + 3.2975 GRIDEXPORT_{36} - 3.2975 GRIDIMPORT_{36} + 3.1925 GRIDEXPORT_{37} - 3.1925 GRIDIMPORT_{37} + 3.1625 GRIDEXPORT_{38} - 3.1625 GRIDIMPORT_{38} + 3.045 GRIDEXPORT_{39} - 3.045 GRIDIMPORT_{39} + 3.1125 GRIDEXPORT_{40} - 3.1125 GRIDIMPORT_{40} + 3.105 GRIDEXPORT_{41} - 3.105 GRIDIMPORT_{41} + 3.3125 GRIDEXPORT_{42} - 3.3125 GRIDIMPORT_{42} + 3.4025 GRIDEXPORT_{43} - 3.4025 GRIDIMPORT_{43} + 3.4625 GRIDEXPORT_{44} - 3.4625 GRIDIMPORT_{44} + 3.7975 GRIDEXPORT_{45} - 3.7975 GRIDIMPORT_{45} + 4.1375 GRIDEXPORT_{46} - 4.1375 GRIDIMPORT_{46} + 4.3125 GRIDEXPORT_{47} - 4.3125 GRIDIMPORT_{47} + 4.3 GRIDEXPORT_{48} - 4.3 GRIDIMPORT_{48} + 4.4925 GRIDEXPORT_{49} - 4.4925 GRIDIMPORT_{49} + 4.49 GRIDEXPORT_{50} - 4.49 GRIDIMPORT_{50} + 4.475 GRIDEXPORT_{51} - 4.475 GRIDIMPORT_{51} + 4.53 GRIDEXPORT_{52} - 4.53 GRIDIMPORT_{52} + 4.5175 GRIDEXPORT_{53} - 4.5175 GRIDIMPORT_{53} + 4.5525 GRIDEXPORT_{54} - 4.5525 GRIDIMPORT_{54} + 4.52 GRIDEXPORT_{55} - 4.52 GRIDIMPORT_{55} + 4.525 GRIDEXPORT_{56} - 4.525 GRIDIMPORT_{56} + 4.495 GRIDEXPORT_{57} - 4.495 GRIDIMPORT_{57} + 4.5875 GRIDEXPORT_{58} - 4.5875 GRIDIMPORT_{58} + 4.5125 GRIDEXPORT_{59} - 4.5125 GRIDIMPORT_{59} + 4.58 GRIDEXPORT_{60} - 4.58 GRIDIMPORT_{60} + 4.49 GRIDEXPORT_{61} - 4.49 GRIDIMPORT_{61} + 4.53 GRIDEXPORT_{62} - 4.53 GRIDIMPORT_{62} + 4.545 GRIDEXPORT_{63} - 4.545 GRIDIMPORT_{63} + 4.4925 GRIDEXPORT_{64} - 4.4925 GRIDIMPORT_{64} + 4.61 GRIDEXPORT_{65} - 4.61 GRIDIMPORT_{65} + 4.6875 GRIDEXPORT_{66} - 4.6875 GRIDIMPORT_{66} + 4.4 GRIDEXPORT_{67} - 4.4 GRIDIMPORT_{67} + 4.55 GRIDEXPORT_{68} - 4.55 GRIDIMPORT_{68} + 4.855 GRIDEXPORT_{69} - 4.855 GRIDIMPORT_{69} + 5.1125 GRIDEXPORT_{70} - 5.1125 GRIDIMPORT_{70} + 8.9475 GRIDEXPORT_{71} - 8.9475 GRIDIMPORT_{71} + 9.375 GRIDEXPORT_{72} - 9.375 GRIDIMPORT_{72} + 17.755 GRIDEXPORT_{73} - 17.755 GRIDIMPORT_{73} + 18.465 GRIDEXPORT_{74} - 18.465 GRIDIMPORT_{74} + 8.8375 GRIDEXPORT_{75} - 8.8375 GRIDIMPORT_{75} + 7.85 GRIDEXPORT_{76} - 7.85 GRIDIMPORT_{76} + 7.7225 GRIDEXPORT_{77} - 7.7225 GRIDIMPORT_{77} + 9.395 GRIDEXPORT_{78} - 9.395 GRIDIMPORT_{78} + 19.4625 GRIDEXPORT_{79} - 19.4625 GRIDIMPORT_{79} + 17.88 GRIDEXPORT_{80} - 17.88 GRIDIMPORT_{80} + 5.81 GRIDEXPORT_{81} - 5.81 GRIDIMPORT_{81} + 3.88 GRIDEXPORT_{82} - 3.88 GRIDIMPORT_{82} + 4.1575 GRIDEXPORT_{83} - 4.1575 GRIDIMPORT_{83} + 4.035 GRIDEXPORT_{84} - 4.035 GRIDIMPORT_{84} + 4.215 GRIDEXPORT_{85} - 4.215 GRIDIMPORT_{85} + 3.6075 GRIDEXPORT_{86} - 3.6075 GRIDIMPORT_{86} + 3.1175 GRIDEXPORT_{87} - 3.1175 GRIDIMPORT_{87} + 3.2775 GRIDEXPORT_{88} - 3.2775 GRIDIMPORT_{88} + 4.4025 GRIDEXPORT_{89} - 4.4025 GRIDIMPORT_{89} + 4.04 GRIDEXPORT_{90} - 4.04 GRIDIMPORT_{90} + 3.825 GRIDEXPORT_{91} - 3.825 GRIDIMPORT_{91} + 3.795 GRIDEXPORT_{92} - 3.795 GRIDIMPORT_{92} + 3.4025 GRIDEXPORT_{93} - 3.4025 GRIDIMPORT_{93} + 2.9725 GRIDEXPORT_{94} - 2.9725 GRIDIMPORT_{94} + 3.5575 GRIDEXPORT_{95} - 3.5575 GRIDIMPORT_{95} + 3.5225 GRIDEXPORT_{96} - 3.5225 GRIDIMPORT_{96}\\
\text{Subject to} \quad & SOLAR_{1} + DISCHARGE_{1} - CHARGE_{1} - 1.1111111111111112 GRIDEXPORT_{1} + 0.9 GRIDIMPORT_{1} = 0.0\\
 & SOLAR_{2} + DISCHARGE_{2} - CHARGE_{2} - 1.1111111111111112 GRIDEXPORT_{2} + 0.9 GRIDIMPORT_{2} = 0.0\\
 & SOLAR_{3} + DISCHARGE_{3} - CHARGE_{3} - 1.1111111111111112 GRIDEXPORT_{3} + 0.9 GRIDIMPORT_{3} = 0.0\\
 & SOLAR_{4} + DISCHARGE_{4} - CHARGE_{4} - 1.1111111111111112 GRIDEXPORT_{4} + 0.9 GRIDIMPORT_{4} = 0.0\\
 & SOLAR_{5} + DISCHARGE_{5} - CHARGE_{5} - 1.1111111111111112 GRIDEXPORT_{5} + 0.9 GRIDIMPORT_{5} = 0.0\\
 & SOLAR_{6} + DISCHARGE_{6} - CHARGE_{6} - 1.1111111111111112 GRIDEXPORT_{6} + 0.9 GRIDIMPORT_{6} = 0.0\\
 & SOLAR_{7} + DISCHARGE_{7} - CHARGE_{7} - 1.1111111111111112 GRIDEXPORT_{7} + 0.9 GRIDIMPORT_{7} = 0.0\\
 & SOLAR_{8} + DISCHARGE_{8} - CHARGE_{8} - 1.1111111111111112 GRIDEXPORT_{8} + 0.9 GRIDIMPORT_{8} = 0.0\\
 & SOLAR_{9} + DISCHARGE_{9} - CHARGE_{9} - 1.1111111111111112 GRIDEXPORT_{9} + 0.9 GRIDIMPORT_{9} = 0.0\\
 & SOLAR_{10} + DISCHARGE_{10} - CHARGE_{10} - 1.1111111111111112 GRIDEXPORT_{10} + 0.9 GRIDIMPORT_{10} = 0.0\\
 & SOLAR_{11} + DISCHARGE_{11} - CHARGE_{11} - 1.1111111111111112 GRIDEXPORT_{11} + 0.9 GRIDIMPORT_{11} = 0.0\\
 & SOLAR_{12} + DISCHARGE_{12} - CHARGE_{12} - 1.1111111111111112 GRIDEXPORT_{12} + 0.9 GRIDIMPORT_{12} = 0.0\\
 & SOLAR_{13} + DISCHARGE_{13} - CHARGE_{13} - 1.1111111111111112 GRIDEXPORT_{13} + 0.9 GRIDIMPORT_{13} = 0.0\\
 & SOLAR_{14} + DISCHARGE_{14} - CHARGE_{14} - 1.1111111111111112 GRIDEXPORT_{14} + 0.9 GRIDIMPORT_{14} = 0.0\\
 & SOLAR_{15} + DISCHARGE_{15} - CHARGE_{15} - 1.1111111111111112 GRIDEXPORT_{15} + 0.9 GRIDIMPORT_{15} = 0.0\\
 & SOLAR_{16} + DISCHARGE_{16} - CHARGE_{16} - 1.1111111111111112 GRIDEXPORT_{16} + 0.9 GRIDIMPORT_{16} = 0.0\\
 & SOLAR_{17} + DISCHARGE_{17} - CHARGE_{17} - 1.1111111111111112 GRIDEXPORT_{17} + 0.9 GRIDIMPORT_{17} = 0.0\\
 & SOLAR_{18} + DISCHARGE_{18} - CHARGE_{18} - 1.1111111111111112 GRIDEXPORT_{18} + 0.9 GRIDIMPORT_{18} = 0.0\\
 & SOLAR_{19} + DISCHARGE_{19} - CHARGE_{19} - 1.1111111111111112 GRIDEXPORT_{19} + 0.9 GRIDIMPORT_{19} = 0.0\\
 & SOLAR_{20} + DISCHARGE_{20} - CHARGE_{20} - 1.1111111111111112 GRIDEXPORT_{20} + 0.9 GRIDIMPORT_{20} = 0.0\\
 & SOLAR_{21} + DISCHARGE_{21} - CHARGE_{21} - 1.1111111111111112 GRIDEXPORT_{21} + 0.9 GRIDIMPORT_{21} = 0.0\\
 & SOLAR_{22} + DISCHARGE_{22} - CHARGE_{22} - 1.1111111111111112 GRIDEXPORT_{22} + 0.9 GRIDIMPORT_{22} = 0.0\\
 & SOLAR_{23} + DISCHARGE_{23} - CHARGE_{23} - 1.1111111111111112 GRIDEXPORT_{23} + 0.9 GRIDIMPORT_{23} = 0.0\\
 & SOLAR_{24} + DISCHARGE_{24} - CHARGE_{24} - 1.1111111111111112 GRIDEXPORT_{24} + 0.9 GRIDIMPORT_{24} = 0.0\\
 & SOLAR_{25} + DISCHARGE_{25} - CHARGE_{25} - 1.1111111111111112 GRIDEXPORT_{25} + 0.9 GRIDIMPORT_{25} = 0.0\\
 & SOLAR_{26} + DISCHARGE_{26} - CHARGE_{26} - 1.1111111111111112 GRIDEXPORT_{26} + 0.9 GRIDIMPORT_{26} = 0.0\\
 & SOLAR_{27} + DISCHARGE_{27} - CHARGE_{27} - 1.1111111111111112 GRIDEXPORT_{27} + 0.9 GRIDIMPORT_{27} = 0.0\\
 & SOLAR_{28} + DISCHARGE_{28} - CHARGE_{28} - 1.1111111111111112 GRIDEXPORT_{28} + 0.9 GRIDIMPORT_{28} = 0.0\\
 & SOLAR_{29} + DISCHARGE_{29} - CHARGE_{29} - 1.1111111111111112 GRIDEXPORT_{29} + 0.9 GRIDIMPORT_{29} = 0.0\\
 & SOLAR_{30} + DISCHARGE_{30} - CHARGE_{30} - 1.1111111111111112 GRIDEXPORT_{30} + 0.9 GRIDIMPORT_{30} = 0.0\\
 & SOLAR_{31} + DISCHARGE_{31} - CHARGE_{31} - 1.1111111111111112 GRIDEXPORT_{31} + 0.9 GRIDIMPORT_{31} = 0.0\\
 & SOLAR_{32} + DISCHARGE_{32} - CHARGE_{32} - 1.1111111111111112 GRIDEXPORT_{32} + 0.9 GRIDIMPORT_{32} = 0.0\\
 & SOLAR_{33} + DISCHARGE_{33} - CHARGE_{33} - 1.1111111111111112 GRIDEXPORT_{33} + 0.9 GRIDIMPORT_{33} = 0.0\\
 & SOLAR_{34} + DISCHARGE_{34} - CHARGE_{34} - 1.1111111111111112 GRIDEXPORT_{34} + 0.9 GRIDIMPORT_{34} = 0.0\\
 & SOLAR_{35} + DISCHARGE_{35} - CHARGE_{35} - 1.1111111111111112 GRIDEXPORT_{35} + 0.9 GRIDIMPORT_{35} = 0.0\\
 & SOLAR_{36} + DISCHARGE_{36} - CHARGE_{36} - 1.1111111111111112 GRIDEXPORT_{36} + 0.9 GRIDIMPORT_{36} = 0.0\\
 & SOLAR_{37} + DISCHARGE_{37} - CHARGE_{37} - 1.1111111111111112 GRIDEXPORT_{37} + 0.9 GRIDIMPORT_{37} = 0.0\\
 & SOLAR_{38} + DISCHARGE_{38} - CHARGE_{38} - 1.1111111111111112 GRIDEXPORT_{38} + 0.9 GRIDIMPORT_{38} = 0.0\\
 & SOLAR_{39} + DISCHARGE_{39} - CHARGE_{39} - 1.1111111111111112 GRIDEXPORT_{39} + 0.9 GRIDIMPORT_{39} = 0.0\\
 & SOLAR_{40} + DISCHARGE_{40} - CHARGE_{40} - 1.1111111111111112 GRIDEXPORT_{40} + 0.9 GRIDIMPORT_{40} = 0.0\\
 & SOLAR_{41} + DISCHARGE_{41} - CHARGE_{41} - 1.1111111111111112 GRIDEXPORT_{41} + 0.9 GRIDIMPORT_{41} = 0.0\\
 & SOLAR_{42} + DISCHARGE_{42} - CHARGE_{42} - 1.1111111111111112 GRIDEXPORT_{42} + 0.9 GRIDIMPORT_{42} = 0.0\\
 & SOLAR_{43} + DISCHARGE_{43} - CHARGE_{43} - 1.1111111111111112 GRIDEXPORT_{43} + 0.9 GRIDIMPORT_{43} = 0.0\\
 & SOLAR_{44} + DISCHARGE_{44} - CHARGE_{44} - 1.1111111111111112 GRIDEXPORT_{44} + 0.9 GRIDIMPORT_{44} = 0.0\\
 & SOLAR_{45} + DISCHARGE_{45} - CHARGE_{45} - 1.1111111111111112 GRIDEXPORT_{45} + 0.9 GRIDIMPORT_{45} = 0.0\\
 & SOLAR_{46} + DISCHARGE_{46} - CHARGE_{46} - 1.1111111111111112 GRIDEXPORT_{46} + 0.9 GRIDIMPORT_{46} = 0.0\\
 & SOLAR_{47} + DISCHARGE_{47} - CHARGE_{47} - 1.1111111111111112 GRIDEXPORT_{47} + 0.9 GRIDIMPORT_{47} = 0.0\\
 & SOLAR_{48} + DISCHARGE_{48} - CHARGE_{48} - 1.1111111111111112 GRIDEXPORT_{48} + 0.9 GRIDIMPORT_{48} = 0.0\\
 & SOLAR_{49} + DISCHARGE_{49} - CHARGE_{49} - 1.1111111111111112 GRIDEXPORT_{49} + 0.9 GRIDIMPORT_{49} = 0.0\\
 & SOLAR_{50} + DISCHARGE_{50} - CHARGE_{50} - 1.1111111111111112 GRIDEXPORT_{50} + 0.9 GRIDIMPORT_{50} = 0.0\\
 & SOLAR_{51} + DISCHARGE_{51} - CHARGE_{51} - 1.1111111111111112 GRIDEXPORT_{51} + 0.9 GRIDIMPORT_{51} = 0.0\\
 & SOLAR_{52} + DISCHARGE_{52} - CHARGE_{52} - 1.1111111111111112 GRIDEXPORT_{52} + 0.9 GRIDIMPORT_{52} = 0.0\\
 & SOLAR_{53} + DISCHARGE_{53} - CHARGE_{53} - 1.1111111111111112 GRIDEXPORT_{53} + 0.9 GRIDIMPORT_{53} = 0.0\\
 & SOLAR_{54} + DISCHARGE_{54} - CHARGE_{54} - 1.1111111111111112 GRIDEXPORT_{54} + 0.9 GRIDIMPORT_{54} = 0.0\\
 & SOLAR_{55} + DISCHARGE_{55} - CHARGE_{55} - 1.1111111111111112 GRIDEXPORT_{55} + 0.9 GRIDIMPORT_{55} = 0.0\\
 & SOLAR_{56} + DISCHARGE_{56} - CHARGE_{56} - 1.1111111111111112 GRIDEXPORT_{56} + 0.9 GRIDIMPORT_{56} = 0.0\\
 & SOLAR_{57} + DISCHARGE_{57} - CHARGE_{57} - 1.1111111111111112 GRIDEXPORT_{57} + 0.9 GRIDIMPORT_{57} = 0.0\\
 & SOLAR_{58} + DISCHARGE_{58} - CHARGE_{58} - 1.1111111111111112 GRIDEXPORT_{58} + 0.9 GRIDIMPORT_{58} = 0.0\\
 & SOLAR_{59} + DISCHARGE_{59} - CHARGE_{59} - 1.1111111111111112 GRIDEXPORT_{59} + 0.9 GRIDIMPORT_{59} = 0.0\\
 & SOLAR_{60} + DISCHARGE_{60} - CHARGE_{60} - 1.1111111111111112 GRIDEXPORT_{60} + 0.9 GRIDIMPORT_{60} = 0.0\\
 & SOLAR_{61} + DISCHARGE_{61} - CHARGE_{61} - 1.1111111111111112 GRIDEXPORT_{61} + 0.9 GRIDIMPORT_{61} = 0.0\\
 & SOLAR_{62} + DISCHARGE_{62} - CHARGE_{62} - 1.1111111111111112 GRIDEXPORT_{62} + 0.9 GRIDIMPORT_{62} = 0.0\\
 & SOLAR_{63} + DISCHARGE_{63} - CHARGE_{63} - 1.1111111111111112 GRIDEXPORT_{63} + 0.9 GRIDIMPORT_{63} = 0.0\\
 & SOLAR_{64} + DISCHARGE_{64} - CHARGE_{64} - 1.1111111111111112 GRIDEXPORT_{64} + 0.9 GRIDIMPORT_{64} = 0.0\\
 & SOLAR_{65} + DISCHARGE_{65} - CHARGE_{65} - 1.1111111111111112 GRIDEXPORT_{65} + 0.9 GRIDIMPORT_{65} = 0.0\\
 & SOLAR_{66} + DISCHARGE_{66} - CHARGE_{66} - 1.1111111111111112 GRIDEXPORT_{66} + 0.9 GRIDIMPORT_{66} = 0.0\\
 & SOLAR_{67} + DISCHARGE_{67} - CHARGE_{67} - 1.1111111111111112 GRIDEXPORT_{67} + 0.9 GRIDIMPORT_{67} = 0.0\\
 & SOLAR_{68} + DISCHARGE_{68} - CHARGE_{68} - 1.1111111111111112 GRIDEXPORT_{68} + 0.9 GRIDIMPORT_{68} = 0.0\\
 & SOLAR_{69} + DISCHARGE_{69} - CHARGE_{69} - 1.1111111111111112 GRIDEXPORT_{69} + 0.9 GRIDIMPORT_{69} = 0.0\\
 & SOLAR_{70} + DISCHARGE_{70} - CHARGE_{70} - 1.1111111111111112 GRIDEXPORT_{70} + 0.9 GRIDIMPORT_{70} = 0.0\\
 & SOLAR_{71} + DISCHARGE_{71} - CHARGE_{71} - 1.1111111111111112 GRIDEXPORT_{71} + 0.9 GRIDIMPORT_{71} = 0.0\\
 & SOLAR_{72} + DISCHARGE_{72} - CHARGE_{72} - 1.1111111111111112 GRIDEXPORT_{72} + 0.9 GRIDIMPORT_{72} = 0.0\\
 & SOLAR_{73} + DISCHARGE_{73} - CHARGE_{73} - 1.1111111111111112 GRIDEXPORT_{73} + 0.9 GRIDIMPORT_{73} = 0.0\\
 & SOLAR_{74} + DISCHARGE_{74} - CHARGE_{74} - 1.1111111111111112 GRIDEXPORT_{74} + 0.9 GRIDIMPORT_{74} = 0.0\\
 & SOLAR_{75} + DISCHARGE_{75} - CHARGE_{75} - 1.1111111111111112 GRIDEXPORT_{75} + 0.9 GRIDIMPORT_{75} = 0.0\\
 & SOLAR_{76} + DISCHARGE_{76} - CHARGE_{76} - 1.1111111111111112 GRIDEXPORT_{76} + 0.9 GRIDIMPORT_{76} = 0.0\\
 & SOLAR_{77} + DISCHARGE_{77} - CHARGE_{77} - 1.1111111111111112 GRIDEXPORT_{77} + 0.9 GRIDIMPORT_{77} = 0.0\\
 & SOLAR_{78} + DISCHARGE_{78} - CHARGE_{78} - 1.1111111111111112 GRIDEXPORT_{78} + 0.9 GRIDIMPORT_{78} = 0.0\\
 & SOLAR_{79} + DISCHARGE_{79} - CHARGE_{79} - 1.1111111111111112 GRIDEXPORT_{79} + 0.9 GRIDIMPORT_{79} = 0.0\\
 & SOLAR_{80} + DISCHARGE_{80} - CHARGE_{80} - 1.1111111111111112 GRIDEXPORT_{80} + 0.9 GRIDIMPORT_{80} = 0.0\\
 & SOLAR_{81} + DISCHARGE_{81} - CHARGE_{81} - 1.1111111111111112 GRIDEXPORT_{81} + 0.9 GRIDIMPORT_{81} = 0.0\\
 & SOLAR_{82} + DISCHARGE_{82} - CHARGE_{82} - 1.1111111111111112 GRIDEXPORT_{82} + 0.9 GRIDIMPORT_{82} = 0.0\\
 & SOLAR_{83} + DISCHARGE_{83} - CHARGE_{83} - 1.1111111111111112 GRIDEXPORT_{83} + 0.9 GRIDIMPORT_{83} = 0.0\\
 & SOLAR_{84} + DISCHARGE_{84} - CHARGE_{84} - 1.1111111111111112 GRIDEXPORT_{84} + 0.9 GRIDIMPORT_{84} = 0.0\\
 & SOLAR_{85} + DISCHARGE_{85} - CHARGE_{85} - 1.1111111111111112 GRIDEXPORT_{85} + 0.9 GRIDIMPORT_{85} = 0.0\\
 & SOLAR_{86} + DISCHARGE_{86} - CHARGE_{86} - 1.1111111111111112 GRIDEXPORT_{86} + 0.9 GRIDIMPORT_{86} = 0.0\\
 & SOLAR_{87} + DISCHARGE_{87} - CHARGE_{87} - 1.1111111111111112 GRIDEXPORT_{87} + 0.9 GRIDIMPORT_{87} = 0.0\\
 & SOLAR_{88} + DISCHARGE_{88} - CHARGE_{88} - 1.1111111111111112 GRIDEXPORT_{88} + 0.9 GRIDIMPORT_{88} = 0.0\\
 & SOLAR_{89} + DISCHARGE_{89} - CHARGE_{89} - 1.1111111111111112 GRIDEXPORT_{89} + 0.9 GRIDIMPORT_{89} = 0.0\\
 & SOLAR_{90} + DISCHARGE_{90} - CHARGE_{90} - 1.1111111111111112 GRIDEXPORT_{90} + 0.9 GRIDIMPORT_{90} = 0.0\\
 & SOLAR_{91} + DISCHARGE_{91} - CHARGE_{91} - 1.1111111111111112 GRIDEXPORT_{91} + 0.9 GRIDIMPORT_{91} = 0.0\\
 & SOLAR_{92} + DISCHARGE_{92} - CHARGE_{92} - 1.1111111111111112 GRIDEXPORT_{92} + 0.9 GRIDIMPORT_{92} = 0.0\\
 & SOLAR_{93} + DISCHARGE_{93} - CHARGE_{93} - 1.1111111111111112 GRIDEXPORT_{93} + 0.9 GRIDIMPORT_{93} = 0.0\\
 & SOLAR_{94} + DISCHARGE_{94} - CHARGE_{94} - 1.1111111111111112 GRIDEXPORT_{94} + 0.9 GRIDIMPORT_{94} = 0.0\\
 & SOLAR_{95} + DISCHARGE_{95} - CHARGE_{95} - 1.1111111111111112 GRIDEXPORT_{95} + 0.9 GRIDIMPORT_{95} = 0.0\\
 & SOLAR_{96} + DISCHARGE_{96} - CHARGE_{96} - 1.1111111111111112 GRIDEXPORT_{96} + 0.9 GRIDIMPORT_{96} = 0.0\\
 & SOC_{1} - 0.2375 CHARGE_{1} + 0.2631578947368421 DISCHARGE_{1} = 20.0\\
 & SOC_{2} - SOC_{1} - 0.2375 CHARGE_{2} + 0.2631578947368421 DISCHARGE_{2} = 0.0\\
 & SOC_{3} - SOC_{2} - 0.2375 CHARGE_{3} + 0.2631578947368421 DISCHARGE_{3} = 0.0\\
 & SOC_{4} - SOC_{3} - 0.2375 CHARGE_{4} + 0.2631578947368421 DISCHARGE_{4} = 0.0\\
 & SOC_{5} - SOC_{4} - 0.2375 CHARGE_{5} + 0.2631578947368421 DISCHARGE_{5} = 0.0\\
 & SOC_{6} - SOC_{5} - 0.2375 CHARGE_{6} + 0.2631578947368421 DISCHARGE_{6} = 0.0\\
 & SOC_{7} - SOC_{6} - 0.2375 CHARGE_{7} + 0.2631578947368421 DISCHARGE_{7} = 0.0\\
 & SOC_{8} - SOC_{7} - 0.2375 CHARGE_{8} + 0.2631578947368421 DISCHARGE_{8} = 0.0\\
 & SOC_{9} - SOC_{8} - 0.2375 CHARGE_{9} + 0.2631578947368421 DISCHARGE_{9} = 0.0\\
 & SOC_{10} - SOC_{9} - 0.2375 CHARGE_{10} + 0.2631578947368421 DISCHARGE_{10} = 0.0\\
 & SOC_{11} - SOC_{10} - 0.2375 CHARGE_{11} + 0.2631578947368421 DISCHARGE_{11} = 0.0\\
 & SOC_{12} - SOC_{11} - 0.2375 CHARGE_{12} + 0.2631578947368421 DISCHARGE_{12} = 0.0\\
 & SOC_{13} - SOC_{12} - 0.2375 CHARGE_{13} + 0.2631578947368421 DISCHARGE_{13} = 0.0\\
 & SOC_{14} - SOC_{13} - 0.2375 CHARGE_{14} + 0.2631578947368421 DISCHARGE_{14} = 0.0\\
 & SOC_{15} - SOC_{14} - 0.2375 CHARGE_{15} + 0.2631578947368421 DISCHARGE_{15} = 0.0\\
 & SOC_{16} - SOC_{15} - 0.2375 CHARGE_{16} + 0.2631578947368421 DISCHARGE_{16} = 0.0\\
 & SOC_{17} - SOC_{16} - 0.2375 CHARGE_{17} + 0.2631578947368421 DISCHARGE_{17} = 0.0\\
 & SOC_{18} - SOC_{17} - 0.2375 CHARGE_{18} + 0.2631578947368421 DISCHARGE_{18} = 0.0\\
 & SOC_{19} - SOC_{18} - 0.2375 CHARGE_{19} + 0.2631578947368421 DISCHARGE_{19} = 0.0\\
 & SOC_{20} - SOC_{19} - 0.2375 CHARGE_{20} + 0.2631578947368421 DISCHARGE_{20} = 0.0\\
 & SOC_{21} - SOC_{20} - 0.2375 CHARGE_{21} + 0.2631578947368421 DISCHARGE_{21} = 0.0\\
 & SOC_{22} - SOC_{21} - 0.2375 CHARGE_{22} + 0.2631578947368421 DISCHARGE_{22} = 0.0\\
 & SOC_{23} - SOC_{22} - 0.2375 CHARGE_{23} + 0.2631578947368421 DISCHARGE_{23} = 0.0\\
 & SOC_{24} - SOC_{23} - 0.2375 CHARGE_{24} + 0.2631578947368421 DISCHARGE_{24} = 0.0\\
 & SOC_{25} - SOC_{24} - 0.2375 CHARGE_{25} + 0.2631578947368421 DISCHARGE_{25} = 0.0\\
 & SOC_{26} - SOC_{25} - 0.2375 CHARGE_{26} + 0.2631578947368421 DISCHARGE_{26} = 0.0\\
 & SOC_{27} - SOC_{26} - 0.2375 CHARGE_{27} + 0.2631578947368421 DISCHARGE_{27} = 0.0\\
 & SOC_{28} - SOC_{27} - 0.2375 CHARGE_{28} + 0.2631578947368421 DISCHARGE_{28} = 0.0\\
 & SOC_{29} - SOC_{28} - 0.2375 CHARGE_{29} + 0.2631578947368421 DISCHARGE_{29} = 0.0\\
 & SOC_{30} - SOC_{29} - 0.2375 CHARGE_{30} + 0.2631578947368421 DISCHARGE_{30} = 0.0\\
 & SOC_{31} - SOC_{30} - 0.2375 CHARGE_{31} + 0.2631578947368421 DISCHARGE_{31} = 0.0\\
 & SOC_{32} - SOC_{31} - 0.2375 CHARGE_{32} + 0.2631578947368421 DISCHARGE_{32} = 0.0\\
 & SOC_{33} - SOC_{32} - 0.2375 CHARGE_{33} + 0.2631578947368421 DISCHARGE_{33} = 0.0\\
 & SOC_{34} - SOC_{33} - 0.2375 CHARGE_{34} + 0.2631578947368421 DISCHARGE_{34} = 0.0\\
 & SOC_{35} - SOC_{34} - 0.2375 CHARGE_{35} + 0.2631578947368421 DISCHARGE_{35} = 0.0\\
 & SOC_{36} - SOC_{35} - 0.2375 CHARGE_{36} + 0.2631578947368421 DISCHARGE_{36} = 0.0\\
 & SOC_{37} - SOC_{36} - 0.2375 CHARGE_{37} + 0.2631578947368421 DISCHARGE_{37} = 0.0\\
 & SOC_{38} - SOC_{37} - 0.2375 CHARGE_{38} + 0.2631578947368421 DISCHARGE_{38} = 0.0\\
 & SOC_{39} - SOC_{38} - 0.2375 CHARGE_{39} + 0.2631578947368421 DISCHARGE_{39} = 0.0\\
 & SOC_{40} - SOC_{39} - 0.2375 CHARGE_{40} + 0.2631578947368421 DISCHARGE_{40} = 0.0\\
 & SOC_{41} - SOC_{40} - 0.2375 CHARGE_{41} + 0.2631578947368421 DISCHARGE_{41} = 0.0\\
 & SOC_{42} - SOC_{41} - 0.2375 CHARGE_{42} + 0.2631578947368421 DISCHARGE_{42} = 0.0\\
 & SOC_{43} - SOC_{42} - 0.2375 CHARGE_{43} + 0.2631578947368421 DISCHARGE_{43} = 0.0\\
 & SOC_{44} - SOC_{43} - 0.2375 CHARGE_{44} + 0.2631578947368421 DISCHARGE_{44} = 0.0\\
 & SOC_{45} - SOC_{44} - 0.2375 CHARGE_{45} + 0.2631578947368421 DISCHARGE_{45} = 0.0\\
 & SOC_{46} - SOC_{45} - 0.2375 CHARGE_{46} + 0.2631578947368421 DISCHARGE_{46} = 0.0\\
 & SOC_{47} - SOC_{46} - 0.2375 CHARGE_{47} + 0.2631578947368421 DISCHARGE_{47} = 0.0\\
 & SOC_{48} - SOC_{47} - 0.2375 CHARGE_{48} + 0.2631578947368421 DISCHARGE_{48} = 0.0\\
 & SOC_{49} - SOC_{48} - 0.2375 CHARGE_{49} + 0.2631578947368421 DISCHARGE_{49} = 0.0\\
 & SOC_{50} - SOC_{49} - 0.2375 CHARGE_{50} + 0.2631578947368421 DISCHARGE_{50} = 0.0\\
 & SOC_{51} - SOC_{50} - 0.2375 CHARGE_{51} + 0.2631578947368421 DISCHARGE_{51} = 0.0\\
 & SOC_{52} - SOC_{51} - 0.2375 CHARGE_{52} + 0.2631578947368421 DISCHARGE_{52} = 0.0\\
 & SOC_{53} - SOC_{52} - 0.2375 CHARGE_{53} + 0.2631578947368421 DISCHARGE_{53} = 0.0\\
 & SOC_{54} - SOC_{53} - 0.2375 CHARGE_{54} + 0.2631578947368421 DISCHARGE_{54} = 0.0\\
 & SOC_{55} - SOC_{54} - 0.2375 CHARGE_{55} + 0.2631578947368421 DISCHARGE_{55} = 0.0\\
 & SOC_{56} - SOC_{55} - 0.2375 CHARGE_{56} + 0.2631578947368421 DISCHARGE_{56} = 0.0\\
 & SOC_{57} - SOC_{56} - 0.2375 CHARGE_{57} + 0.2631578947368421 DISCHARGE_{57} = 0.0\\
 & SOC_{58} - SOC_{57} - 0.2375 CHARGE_{58} + 0.2631578947368421 DISCHARGE_{58} = 0.0\\
 & SOC_{59} - SOC_{58} - 0.2375 CHARGE_{59} + 0.2631578947368421 DISCHARGE_{59} = 0.0\\
 & SOC_{60} - SOC_{59} - 0.2375 CHARGE_{60} + 0.2631578947368421 DISCHARGE_{60} = 0.0\\
 & SOC_{61} - SOC_{60} - 0.2375 CHARGE_{61} + 0.2631578947368421 DISCHARGE_{61} = 0.0\\
 & SOC_{62} - SOC_{61} - 0.2375 CHARGE_{62} + 0.2631578947368421 DISCHARGE_{62} = 0.0\\
 & SOC_{63} - SOC_{62} - 0.2375 CHARGE_{63} + 0.2631578947368421 DISCHARGE_{63} = 0.0\\
 & SOC_{64} - SOC_{63} - 0.2375 CHARGE_{64} + 0.2631578947368421 DISCHARGE_{64} = 0.0\\
 & SOC_{65} - SOC_{64} - 0.2375 CHARGE_{65} + 0.2631578947368421 DISCHARGE_{65} = 0.0\\
 & SOC_{66} - SOC_{65} - 0.2375 CHARGE_{66} + 0.2631578947368421 DISCHARGE_{66} = 0.0\\
 & SOC_{67} - SOC_{66} - 0.2375 CHARGE_{67} + 0.2631578947368421 DISCHARGE_{67} = 0.0\\
 & SOC_{68} - SOC_{67} - 0.2375 CHARGE_{68} + 0.2631578947368421 DISCHARGE_{68} = 0.0\\
 & SOC_{69} - SOC_{68} - 0.2375 CHARGE_{69} + 0.2631578947368421 DISCHARGE_{69} = 0.0\\
 & SOC_{70} - SOC_{69} - 0.2375 CHARGE_{70} + 0.2631578947368421 DISCHARGE_{70} = 0.0\\
 & SOC_{71} - SOC_{70} - 0.2375 CHARGE_{71} + 0.2631578947368421 DISCHARGE_{71} = 0.0\\
 & SOC_{72} - SOC_{71} - 0.2375 CHARGE_{72} + 0.2631578947368421 DISCHARGE_{72} = 0.0\\
 & SOC_{73} - SOC_{72} - 0.2375 CHARGE_{73} + 0.2631578947368421 DISCHARGE_{73} = 0.0\\
 & SOC_{74} - SOC_{73} - 0.2375 CHARGE_{74} + 0.2631578947368421 DISCHARGE_{74} = 0.0\\
 & SOC_{75} - SOC_{74} - 0.2375 CHARGE_{75} + 0.2631578947368421 DISCHARGE_{75} = 0.0\\
 & SOC_{76} - SOC_{75} - 0.2375 CHARGE_{76} + 0.2631578947368421 DISCHARGE_{76} = 0.0\\
 & SOC_{77} - SOC_{76} - 0.2375 CHARGE_{77} + 0.2631578947368421 DISCHARGE_{77} = 0.0\\
 & SOC_{78} - SOC_{77} - 0.2375 CHARGE_{78} + 0.2631578947368421 DISCHARGE_{78} = 0.0\\
 & SOC_{79} - SOC_{78} - 0.2375 CHARGE_{79} + 0.2631578947368421 DISCHARGE_{79} = 0.0\\
 & SOC_{80} - SOC_{79} - 0.2375 CHARGE_{80} + 0.2631578947368421 DISCHARGE_{80} = 0.0\\
 & SOC_{81} - SOC_{80} - 0.2375 CHARGE_{81} + 0.2631578947368421 DISCHARGE_{81} = 0.0\\
 & SOC_{82} - SOC_{81} - 0.2375 CHARGE_{82} + 0.2631578947368421 DISCHARGE_{82} = 0.0\\
 & SOC_{83} - SOC_{82} - 0.2375 CHARGE_{83} + 0.2631578947368421 DISCHARGE_{83} = 0.0\\
 & SOC_{84} - SOC_{83} - 0.2375 CHARGE_{84} + 0.2631578947368421 DISCHARGE_{84} = 0.0\\
 & SOC_{85} - SOC_{84} - 0.2375 CHARGE_{85} + 0.2631578947368421 DISCHARGE_{85} = 0.0\\
 & SOC_{86} - SOC_{85} - 0.2375 CHARGE_{86} + 0.2631578947368421 DISCHARGE_{86} = 0.0\\
 & SOC_{87} - SOC_{86} - 0.2375 CHARGE_{87} + 0.2631578947368421 DISCHARGE_{87} = 0.0\\
 & SOC_{88} - SOC_{87} - 0.2375 CHARGE_{88} + 0.2631578947368421 DISCHARGE_{88} = 0.0\\
 & SOC_{89} - SOC_{88} - 0.2375 CHARGE_{89} + 0.2631578947368421 DISCHARGE_{89} = 0.0\\
 & SOC_{90} - SOC_{89} - 0.2375 CHARGE_{90} + 0.2631578947368421 DISCHARGE_{90} = 0.0\\
 & SOC_{91} - SOC_{90} - 0.2375 CHARGE_{91} + 0.2631578947368421 DISCHARGE_{91} = 0.0\\
 & SOC_{92} - SOC_{91} - 0.2375 CHARGE_{92} + 0.2631578947368421 DISCHARGE_{92} = 0.0\\
 & SOC_{93} - SOC_{92} - 0.2375 CHARGE_{93} + 0.2631578947368421 DISCHARGE_{93} = 0.0\\
 & SOC_{94} - SOC_{93} - 0.2375 CHARGE_{94} + 0.2631578947368421 DISCHARGE_{94} = 0.0\\
 & SOC_{95} - SOC_{94} - 0.2375 CHARGE_{95} + 0.2631578947368421 DISCHARGE_{95} = 0.0\\
 & SOC_{96} - SOC_{95} - 0.2375 CHARGE_{96} + 0.2631578947368421 DISCHARGE_{96} = 0.0\\
 & SOLAR_{1} \leq 0.0\\
 & SOLAR_{2} \leq 0.0\\
 & SOLAR_{3} \leq 0.0\\
 & SOLAR_{4} \leq 0.0\\
 & SOLAR_{5} \leq 0.0\\
 & SOLAR_{6} \leq 0.0\\
 & SOLAR_{7} \leq 0.0\\
 & SOLAR_{8} \leq 0.0\\
 & SOLAR_{9} \leq 0.0\\
 & SOLAR_{10} \leq 0.0\\
 & SOLAR_{11} \leq 0.0\\
 & SOLAR_{12} \leq 0.0\\
 & SOLAR_{13} \leq 0.0\\
 & SOLAR_{14} \leq 0.0\\
 & SOLAR_{15} \leq 0.0\\
 & SOLAR_{16} \leq 0.0\\
 & SOLAR_{17} \leq 0.0\\
 & SOLAR_{18} \leq 0.0\\
 & SOLAR_{19} \leq 0.0\\
 & SOLAR_{20} \leq 0.0\\
 & SOLAR_{21} \leq 0.0\\
 & SOLAR_{22} \leq 0.0\\
 & SOLAR_{23} \leq 0.0\\
 & SOLAR_{24} \leq 0.0\\
 & SOLAR_{25} \leq 0.0\\
 & SOLAR_{26} \leq 0.077\\
 & SOLAR_{27} \leq 0.154\\
 & SOLAR_{28} \leq 0.232\\
 & SOLAR_{29} \leq 0.309\\
 & SOLAR_{30} \leq 7.94\\
 & SOLAR_{31} \leq 15.571\\
 & SOLAR_{32} \leq 23.202\\
 & SOLAR_{33} \leq 30.833\\
 & SOLAR_{34} \leq 33.823\\
 & SOLAR_{35} \leq 36.812\\
 & SOLAR_{36} \leq 39.801\\
 & SOLAR_{37} \leq 42.791\\
 & SOLAR_{38} \leq 44.029\\
 & SOLAR_{39} \leq 45.268\\
 & SOLAR_{40} \leq 46.507\\
 & SOLAR_{41} \leq 47.746\\
 & SOLAR_{42} \leq 48.298\\
 & SOLAR_{43} \leq 48.85\\
 & SOLAR_{44} \leq 49.401\\
 & SOLAR_{45} \leq 49.953\\
 & SOLAR_{46} \leq 49.965\\
 & SOLAR_{47} \leq 49.977\\
 & SOLAR_{48} \leq 49.988\\
 & SOLAR_{49} \leq 50.0\\
 & SOLAR_{50} \leq 49.778\\
 & SOLAR_{51} \leq 49.556\\
 & SOLAR_{52} \leq 49.335\\
 & SOLAR_{53} \leq 49.113\\
 & SOLAR_{54} \leq 48.549\\
 & SOLAR_{55} \leq 47.985\\
 & SOLAR_{56} \leq 47.422\\
 & SOLAR_{57} \leq 46.858\\
 & SOLAR_{58} \leq 45.588\\
 & SOLAR_{59} \leq 44.319\\
 & SOLAR_{60} \leq 43.049\\
 & SOLAR_{61} \leq 41.779\\
 & SOLAR_{62} \leq 39.388\\
 & SOLAR_{63} \leq 36.996\\
 & SOLAR_{64} \leq 34.604\\
 & SOLAR_{65} \leq 32.213\\
 & SOLAR_{66} \leq 27.218\\
 & SOLAR_{67} \leq 22.223\\
 & SOLAR_{68} \leq 17.228\\
 & SOLAR_{69} \leq 12.233\\
 & SOLAR_{70} \leq 9.175\\
 & SOLAR_{71} \leq 6.116\\
 & SOLAR_{72} \leq 3.058\\
 & SOLAR_{73} \leq 0.0\\
 & SOLAR_{74} \leq 0.0\\
 & SOLAR_{75} \leq 0.0\\
 & SOLAR_{76} \leq 0.0\\
 & SOLAR_{77} \leq 0.0\\
 & SOLAR_{78} \leq 0.0\\
 & SOLAR_{79} \leq 0.0\\
 & SOLAR_{80} \leq 0.0\\
 & SOLAR_{81} \leq 0.0\\
 & SOLAR_{82} \leq 0.0\\
 & SOLAR_{83} \leq 0.0\\
 & SOLAR_{84} \leq 0.0\\
 & SOLAR_{85} \leq 0.0\\
 & SOLAR_{86} \leq 0.0\\
 & SOLAR_{87} \leq 0.0\\
 & SOLAR_{88} \leq 0.0\\
 & SOLAR_{89} \leq 0.0\\
 & SOLAR_{90} \leq 0.0\\
 & SOLAR_{91} \leq 0.0\\
 & SOLAR_{92} \leq 0.0\\
 & SOLAR_{93} \leq 0.0\\
 & SOLAR_{94} \leq 0.0\\
 & SOLAR_{95} \leq 0.0\\
 & SOLAR_{96} \leq 0.0\\
 & SOLAR_{1} \geq 0.0\\
 & SOLAR_{2} \geq 0.0\\
 & SOLAR_{3} \geq 0.0\\
 & SOLAR_{4} \geq 0.0\\
 & SOLAR_{5} \geq 0.0\\
 & SOLAR_{6} \geq 0.0\\
 & SOLAR_{7} \geq 0.0\\
 & SOLAR_{8} \geq 0.0\\
 & SOLAR_{9} \geq 0.0\\
 & SOLAR_{10} \geq 0.0\\
 & SOLAR_{11} \geq 0.0\\
 & SOLAR_{12} \geq 0.0\\
 & SOLAR_{13} \geq 0.0\\
 & SOLAR_{14} \geq 0.0\\
 & SOLAR_{15} \geq 0.0\\
 & SOLAR_{16} \geq 0.0\\
 & SOLAR_{17} \geq 0.0\\
 & SOLAR_{18} \geq 0.0\\
 & SOLAR_{19} \geq 0.0\\
 & SOLAR_{20} \geq 0.0\\
 & SOLAR_{21} \geq 0.0\\
 & SOLAR_{22} \geq 0.0\\
 & SOLAR_{23} \geq 0.0\\
 & SOLAR_{24} \geq 0.0\\
 & SOLAR_{25} \geq 0.0\\
 & SOLAR_{26} \geq 0.0\\
 & SOLAR_{27} \geq 0.0\\
 & SOLAR_{28} \geq 0.0\\
 & SOLAR_{29} \geq 0.0\\
 & SOLAR_{30} \geq 0.0\\
 & SOLAR_{31} \geq 0.0\\
 & SOLAR_{32} \geq 0.0\\
 & SOLAR_{33} \geq 0.0\\
 & SOLAR_{34} \geq 0.0\\
 & SOLAR_{35} \geq 0.0\\
 & SOLAR_{36} \geq 0.0\\
 & SOLAR_{37} \geq 0.0\\
 & SOLAR_{38} \geq 0.0\\
 & SOLAR_{39} \geq 0.0\\
 & SOLAR_{40} \geq 0.0\\
 & SOLAR_{41} \geq 0.0\\
 & SOLAR_{42} \geq 0.0\\
 & SOLAR_{43} \geq 0.0\\
 & SOLAR_{44} \geq 0.0\\
 & SOLAR_{45} \geq 0.0\\
 & SOLAR_{46} \geq 0.0\\
 & SOLAR_{47} \geq 0.0\\
 & SOLAR_{48} \geq 0.0\\
 & SOLAR_{49} \geq 0.0\\
 & SOLAR_{50} \geq 0.0\\
 & SOLAR_{51} \geq 0.0\\
 & SOLAR_{52} \geq 0.0\\
 & SOLAR_{53} \geq 0.0\\
 & SOLAR_{54} \geq 0.0\\
 & SOLAR_{55} \geq 0.0\\
 & SOLAR_{56} \geq 0.0\\
 & SOLAR_{57} \geq 0.0\\
 & SOLAR_{58} \geq 0.0\\
 & SOLAR_{59} \geq 0.0\\
 & SOLAR_{60} \geq 0.0\\
 & SOLAR_{61} \geq 0.0\\
 & SOLAR_{62} \geq 0.0\\
 & SOLAR_{63} \geq 0.0\\
 & SOLAR_{64} \geq 0.0\\
 & SOLAR_{65} \geq 0.0\\
 & SOLAR_{66} \geq 0.0\\
 & SOLAR_{67} \geq 0.0\\
 & SOLAR_{68} \geq 0.0\\
 & SOLAR_{69} \geq 0.0\\
 & SOLAR_{70} \geq 0.0\\
 & SOLAR_{71} \geq 0.0\\
 & SOLAR_{72} \geq 0.0\\
 & SOLAR_{73} \geq 0.0\\
 & SOLAR_{74} \geq 0.0\\
 & SOLAR_{75} \geq 0.0\\
 & SOLAR_{76} \geq 0.0\\
 & SOLAR_{77} \geq 0.0\\
 & SOLAR_{78} \geq 0.0\\
 & SOLAR_{79} \geq 0.0\\
 & SOLAR_{80} \geq 0.0\\
 & SOLAR_{81} \geq 0.0\\
 & SOLAR_{82} \geq 0.0\\
 & SOLAR_{83} \geq 0.0\\
 & SOLAR_{84} \geq 0.0\\
 & SOLAR_{85} \geq 0.0\\
 & SOLAR_{86} \geq 0.0\\
 & SOLAR_{87} \geq 0.0\\
 & SOLAR_{88} \geq 0.0\\
 & SOLAR_{89} \geq 0.0\\
 & SOLAR_{90} \geq 0.0\\
 & SOLAR_{91} \geq 0.0\\
 & SOLAR_{92} \geq 0.0\\
 & SOLAR_{93} \geq 0.0\\
 & SOLAR_{94} \geq 0.0\\
 & SOLAR_{95} \geq 0.0\\
 & SOLAR_{96} \geq 0.0\\
 & CHARGE_{1} \geq 0.0\\
 & CHARGE_{2} \geq 0.0\\
 & CHARGE_{3} \geq 0.0\\
 & CHARGE_{4} \geq 0.0\\
 & CHARGE_{5} \geq 0.0\\
 & CHARGE_{6} \geq 0.0\\
 & CHARGE_{7} \geq 0.0\\
 & CHARGE_{8} \geq 0.0\\
 & CHARGE_{9} \geq 0.0\\
 & CHARGE_{10} \geq 0.0\\
 & CHARGE_{11} \geq 0.0\\
 & CHARGE_{12} \geq 0.0\\
 & CHARGE_{13} \geq 0.0\\
 & CHARGE_{14} \geq 0.0\\
 & CHARGE_{15} \geq 0.0\\
 & CHARGE_{16} \geq 0.0\\
 & CHARGE_{17} \geq 0.0\\
 & CHARGE_{18} \geq 0.0\\
 & CHARGE_{19} \geq 0.0\\
 & CHARGE_{20} \geq 0.0\\
 & CHARGE_{21} \geq 0.0\\
 & CHARGE_{22} \geq 0.0\\
 & CHARGE_{23} \geq 0.0\\
 & CHARGE_{24} \geq 0.0\\
 & CHARGE_{25} \geq 0.0\\
 & CHARGE_{26} \geq 0.0\\
 & CHARGE_{27} \geq 0.0\\
 & CHARGE_{28} \geq 0.0\\
 & CHARGE_{29} \geq 0.0\\
 & CHARGE_{30} \geq 0.0\\
 & CHARGE_{31} \geq 0.0\\
 & CHARGE_{32} \geq 0.0\\
 & CHARGE_{33} \geq 0.0\\
 & CHARGE_{34} \geq 0.0\\
 & CHARGE_{35} \geq 0.0\\
 & CHARGE_{36} \geq 0.0\\
 & CHARGE_{37} \geq 0.0\\
 & CHARGE_{38} \geq 0.0\\
 & CHARGE_{39} \geq 0.0\\
 & CHARGE_{40} \geq 0.0\\
 & CHARGE_{41} \geq 0.0\\
 & CHARGE_{42} \geq 0.0\\
 & CHARGE_{43} \geq 0.0\\
 & CHARGE_{44} \geq 0.0\\
 & CHARGE_{45} \geq 0.0\\
 & CHARGE_{46} \geq 0.0\\
 & CHARGE_{47} \geq 0.0\\
 & CHARGE_{48} \geq 0.0\\
 & CHARGE_{49} \geq 0.0\\
 & CHARGE_{50} \geq 0.0\\
 & CHARGE_{51} \geq 0.0\\
 & CHARGE_{52} \geq 0.0\\
 & CHARGE_{53} \geq 0.0\\
 & CHARGE_{54} \geq 0.0\\
 & CHARGE_{55} \geq 0.0\\
 & CHARGE_{56} \geq 0.0\\
 & CHARGE_{57} \geq 0.0\\
 & CHARGE_{58} \geq 0.0\\
 & CHARGE_{59} \geq 0.0\\
 & CHARGE_{60} \geq 0.0\\
 & CHARGE_{61} \geq 0.0\\
 & CHARGE_{62} \geq 0.0\\
 & CHARGE_{63} \geq 0.0\\
 & CHARGE_{64} \geq 0.0\\
 & CHARGE_{65} \geq 0.0\\
 & CHARGE_{66} \geq 0.0\\
 & CHARGE_{67} \geq 0.0\\
 & CHARGE_{68} \geq 0.0\\
 & CHARGE_{69} \geq 0.0\\
 & CHARGE_{70} \geq 0.0\\
 & CHARGE_{71} \geq 0.0\\
 & CHARGE_{72} \geq 0.0\\
 & CHARGE_{73} \geq 0.0\\
 & CHARGE_{74} \geq 0.0\\
 & CHARGE_{75} \geq 0.0\\
 & CHARGE_{76} \geq 0.0\\
 & CHARGE_{77} \geq 0.0\\
 & CHARGE_{78} \geq 0.0\\
 & CHARGE_{79} \geq 0.0\\
 & CHARGE_{80} \geq 0.0\\
 & CHARGE_{81} \geq 0.0\\
 & CHARGE_{82} \geq 0.0\\
 & CHARGE_{83} \geq 0.0\\
 & CHARGE_{84} \geq 0.0\\
 & CHARGE_{85} \geq 0.0\\
 & CHARGE_{86} \geq 0.0\\
 & CHARGE_{87} \geq 0.0\\
 & CHARGE_{88} \geq 0.0\\
 & CHARGE_{89} \geq 0.0\\
 & CHARGE_{90} \geq 0.0\\
 & CHARGE_{91} \geq 0.0\\
 & CHARGE_{92} \geq 0.0\\
 & CHARGE_{93} \geq 0.0\\
 & CHARGE_{94} \geq 0.0\\
 & CHARGE_{95} \geq 0.0\\
 & CHARGE_{96} \geq 0.0\\
 & DISCHARGE_{1} \geq 0.0\\
 & DISCHARGE_{2} \geq 0.0\\
 & DISCHARGE_{3} \geq 0.0\\
 & DISCHARGE_{4} \geq 0.0\\
 & DISCHARGE_{5} \geq 0.0\\
 & DISCHARGE_{6} \geq 0.0\\
 & DISCHARGE_{7} \geq 0.0\\
 & DISCHARGE_{8} \geq 0.0\\
 & DISCHARGE_{9} \geq 0.0\\
 & DISCHARGE_{10} \geq 0.0\\
 & DISCHARGE_{11} \geq 0.0\\
 & DISCHARGE_{12} \geq 0.0\\
 & DISCHARGE_{13} \geq 0.0\\
 & DISCHARGE_{14} \geq 0.0\\
 & DISCHARGE_{15} \geq 0.0\\
 & DISCHARGE_{16} \geq 0.0\\
 & DISCHARGE_{17} \geq 0.0\\
 & DISCHARGE_{18} \geq 0.0\\
 & DISCHARGE_{19} \geq 0.0\\
 & DISCHARGE_{20} \geq 0.0\\
 & DISCHARGE_{21} \geq 0.0\\
 & DISCHARGE_{22} \geq 0.0\\
 & DISCHARGE_{23} \geq 0.0\\
 & DISCHARGE_{24} \geq 0.0\\
 & DISCHARGE_{25} \geq 0.0\\
 & DISCHARGE_{26} \geq 0.0\\
 & DISCHARGE_{27} \geq 0.0\\
 & DISCHARGE_{28} \geq 0.0\\
 & DISCHARGE_{29} \geq 0.0\\
 & DISCHARGE_{30} \geq 0.0\\
 & DISCHARGE_{31} \geq 0.0\\
 & DISCHARGE_{32} \geq 0.0\\
 & DISCHARGE_{33} \geq 0.0\\
 & DISCHARGE_{34} \geq 0.0\\
 & DISCHARGE_{35} \geq 0.0\\
 & DISCHARGE_{36} \geq 0.0\\
 & DISCHARGE_{37} \geq 0.0\\
 & DISCHARGE_{38} \geq 0.0\\
 & DISCHARGE_{39} \geq 0.0\\
 & DISCHARGE_{40} \geq 0.0\\
 & DISCHARGE_{41} \geq 0.0\\
 & DISCHARGE_{42} \geq 0.0\\
 & DISCHARGE_{43} \geq 0.0\\
 & DISCHARGE_{44} \geq 0.0\\
 & DISCHARGE_{45} \geq 0.0\\
 & DISCHARGE_{46} \geq 0.0\\
 & DISCHARGE_{47} \geq 0.0\\
 & DISCHARGE_{48} \geq 0.0\\
 & DISCHARGE_{49} \geq 0.0\\
 & DISCHARGE_{50} \geq 0.0\\
 & DISCHARGE_{51} \geq 0.0\\
 & DISCHARGE_{52} \geq 0.0\\
 & DISCHARGE_{53} \geq 0.0\\
 & DISCHARGE_{54} \geq 0.0\\
 & DISCHARGE_{55} \geq 0.0\\
 & DISCHARGE_{56} \geq 0.0\\
 & DISCHARGE_{57} \geq 0.0\\
 & DISCHARGE_{58} \geq 0.0\\
 & DISCHARGE_{59} \geq 0.0\\
 & DISCHARGE_{60} \geq 0.0\\
 & DISCHARGE_{61} \geq 0.0\\
 & DISCHARGE_{62} \geq 0.0\\
 & DISCHARGE_{63} \geq 0.0\\
 & DISCHARGE_{64} \geq 0.0\\
 & DISCHARGE_{65} \geq 0.0\\
 & DISCHARGE_{66} \geq 0.0\\
 & DISCHARGE_{67} \geq 0.0\\
 & DISCHARGE_{68} \geq 0.0\\
 & DISCHARGE_{69} \geq 0.0\\
 & DISCHARGE_{70} \geq 0.0\\
 & DISCHARGE_{71} \geq 0.0\\
 & DISCHARGE_{72} \geq 0.0\\
 & DISCHARGE_{73} \geq 0.0\\
 & DISCHARGE_{74} \geq 0.0\\
 & DISCHARGE_{75} \geq 0.0\\
 & DISCHARGE_{76} \geq 0.0\\
 & DISCHARGE_{77} \geq 0.0\\
 & DISCHARGE_{78} \geq 0.0\\
 & DISCHARGE_{79} \geq 0.0\\
 & DISCHARGE_{80} \geq 0.0\\
 & DISCHARGE_{81} \geq 0.0\\
 & DISCHARGE_{82} \geq 0.0\\
 & DISCHARGE_{83} \geq 0.0\\
 & DISCHARGE_{84} \geq 0.0\\
 & DISCHARGE_{85} \geq 0.0\\
 & DISCHARGE_{86} \geq 0.0\\
 & DISCHARGE_{87} \geq 0.0\\
 & DISCHARGE_{88} \geq 0.0\\
 & DISCHARGE_{89} \geq 0.0\\
 & DISCHARGE_{90} \geq 0.0\\
 & DISCHARGE_{91} \geq 0.0\\
 & DISCHARGE_{92} \geq 0.0\\
 & DISCHARGE_{93} \geq 0.0\\
 & DISCHARGE_{94} \geq 0.0\\
 & DISCHARGE_{95} \geq 0.0\\
 & DISCHARGE_{96} \geq 0.0\\
 & GRIDEXPORT_{1} \geq 0.0\\
 & GRIDEXPORT_{2} \geq 0.0\\
 & GRIDEXPORT_{3} \geq 0.0\\
 & GRIDEXPORT_{4} \geq 0.0\\
 & GRIDEXPORT_{5} \geq 0.0\\
 & GRIDEXPORT_{6} \geq 0.0\\
 & GRIDEXPORT_{7} \geq 0.0\\
 & GRIDEXPORT_{8} \geq 0.0\\
 & GRIDEXPORT_{9} \geq 0.0\\
 & GRIDEXPORT_{10} \geq 0.0\\
 & GRIDEXPORT_{11} \geq 0.0\\
 & GRIDEXPORT_{12} \geq 0.0\\
 & GRIDEXPORT_{13} \geq 0.0\\
 & GRIDEXPORT_{14} \geq 0.0\\
 & GRIDEXPORT_{15} \geq 0.0\\
 & GRIDEXPORT_{16} \geq 0.0\\
 & GRIDEXPORT_{17} \geq 0.0\\
 & GRIDEXPORT_{18} \geq 0.0\\
 & GRIDEXPORT_{19} \geq 0.0\\
 & GRIDEXPORT_{20} \geq 0.0\\
 & GRIDEXPORT_{21} \geq 0.0\\
 & GRIDEXPORT_{22} \geq 0.0\\
 & GRIDEXPORT_{23} \geq 0.0\\
 & GRIDEXPORT_{24} \geq 0.0\\
 & GRIDEXPORT_{25} \geq 0.0\\
 & GRIDEXPORT_{26} \geq 0.0\\
 & GRIDEXPORT_{27} \geq 0.0\\
 & GRIDEXPORT_{28} \geq 0.0\\
 & GRIDEXPORT_{29} \geq 0.0\\
 & GRIDEXPORT_{30} \geq 0.0\\
 & GRIDEXPORT_{31} \geq 0.0\\
 & GRIDEXPORT_{32} \geq 0.0\\
 & GRIDEXPORT_{33} \geq 0.0\\
 & GRIDEXPORT_{34} \geq 0.0\\
 & GRIDEXPORT_{35} \geq 0.0\\
 & GRIDEXPORT_{36} \geq 0.0\\
 & GRIDEXPORT_{37} \geq 0.0\\
 & GRIDEXPORT_{38} \geq 0.0\\
 & GRIDEXPORT_{39} \geq 0.0\\
 & GRIDEXPORT_{40} \geq 0.0\\
 & GRIDEXPORT_{41} \geq 0.0\\
 & GRIDEXPORT_{42} \geq 0.0\\
 & GRIDEXPORT_{43} \geq 0.0\\
 & GRIDEXPORT_{44} \geq 0.0\\
 & GRIDEXPORT_{45} \geq 0.0\\
 & GRIDEXPORT_{46} \geq 0.0\\
 & GRIDEXPORT_{47} \geq 0.0\\
 & GRIDEXPORT_{48} \geq 0.0\\
 & GRIDEXPORT_{49} \geq 0.0\\
 & GRIDEXPORT_{50} \geq 0.0\\
 & GRIDEXPORT_{51} \geq 0.0\\
 & GRIDEXPORT_{52} \geq 0.0\\
 & GRIDEXPORT_{53} \geq 0.0\\
 & GRIDEXPORT_{54} \geq 0.0\\
 & GRIDEXPORT_{55} \geq 0.0\\
 & GRIDEXPORT_{56} \geq 0.0\\
 & GRIDEXPORT_{57} \geq 0.0\\
 & GRIDEXPORT_{58} \geq 0.0\\
 & GRIDEXPORT_{59} \geq 0.0\\
 & GRIDEXPORT_{60} \geq 0.0\\
 & GRIDEXPORT_{61} \geq 0.0\\
 & GRIDEXPORT_{62} \geq 0.0\\
 & GRIDEXPORT_{63} \geq 0.0\\
 & GRIDEXPORT_{64} \geq 0.0\\
 & GRIDEXPORT_{65} \geq 0.0\\
 & GRIDEXPORT_{66} \geq 0.0\\
 & GRIDEXPORT_{67} \geq 0.0\\
 & GRIDEXPORT_{68} \geq 0.0\\
 & GRIDEXPORT_{69} \geq 0.0\\
 & GRIDEXPORT_{70} \geq 0.0\\
 & GRIDEXPORT_{71} \geq 0.0\\
 & GRIDEXPORT_{72} \geq 0.0\\
 & GRIDEXPORT_{73} \geq 0.0\\
 & GRIDEXPORT_{74} \geq 0.0\\
 & GRIDEXPORT_{75} \geq 0.0\\
 & GRIDEXPORT_{76} \geq 0.0\\
 & GRIDEXPORT_{77} \geq 0.0\\
 & GRIDEXPORT_{78} \geq 0.0\\
 & GRIDEXPORT_{79} \geq 0.0\\
 & GRIDEXPORT_{80} \geq 0.0\\
 & GRIDEXPORT_{81} \geq 0.0\\
 & GRIDEXPORT_{82} \geq 0.0\\
 & GRIDEXPORT_{83} \geq 0.0\\
 & GRIDEXPORT_{84} \geq 0.0\\
 & GRIDEXPORT_{85} \geq 0.0\\
 & GRIDEXPORT_{86} \geq 0.0\\
 & GRIDEXPORT_{87} \geq 0.0\\
 & GRIDEXPORT_{88} \geq 0.0\\
 & GRIDEXPORT_{89} \geq 0.0\\
 & GRIDEXPORT_{90} \geq 0.0\\
 & GRIDEXPORT_{91} \geq 0.0\\
 & GRIDEXPORT_{92} \geq 0.0\\
 & GRIDEXPORT_{93} \geq 0.0\\
 & GRIDEXPORT_{94} \geq 0.0\\
 & GRIDEXPORT_{95} \geq 0.0\\
 & GRIDEXPORT_{96} \geq 0.0\\
 & GRIDIMPORT_{1} \geq 0.0\\
 & GRIDIMPORT_{2} \geq 0.0\\
 & GRIDIMPORT_{3} \geq 0.0\\
 & GRIDIMPORT_{4} \geq 0.0\\
 & GRIDIMPORT_{5} \geq 0.0\\
 & GRIDIMPORT_{6} \geq 0.0\\
 & GRIDIMPORT_{7} \geq 0.0\\
 & GRIDIMPORT_{8} \geq 0.0\\
 & GRIDIMPORT_{9} \geq 0.0\\
 & GRIDIMPORT_{10} \geq 0.0\\
 & GRIDIMPORT_{11} \geq 0.0\\
 & GRIDIMPORT_{12} \geq 0.0\\
 & GRIDIMPORT_{13} \geq 0.0\\
 & GRIDIMPORT_{14} \geq 0.0\\
 & GRIDIMPORT_{15} \geq 0.0\\
 & GRIDIMPORT_{16} \geq 0.0\\
 & GRIDIMPORT_{17} \geq 0.0\\
 & GRIDIMPORT_{18} \geq 0.0\\
 & GRIDIMPORT_{19} \geq 0.0\\
 & GRIDIMPORT_{20} \geq 0.0\\
 & GRIDIMPORT_{21} \geq 0.0\\
 & GRIDIMPORT_{22} \geq 0.0\\
 & GRIDIMPORT_{23} \geq 0.0\\
 & GRIDIMPORT_{24} \geq 0.0\\
 & GRIDIMPORT_{25} \geq 0.0\\
 & GRIDIMPORT_{26} \geq 0.0\\
 & GRIDIMPORT_{27} \geq 0.0\\
 & GRIDIMPORT_{28} \geq 0.0\\
 & GRIDIMPORT_{29} \geq 0.0\\
 & GRIDIMPORT_{30} \geq 0.0\\
 & GRIDIMPORT_{31} \geq 0.0\\
 & GRIDIMPORT_{32} \geq 0.0\\
 & GRIDIMPORT_{33} \geq 0.0\\
 & GRIDIMPORT_{34} \geq 0.0\\
 & GRIDIMPORT_{35} \geq 0.0\\
 & GRIDIMPORT_{36} \geq 0.0\\
 & GRIDIMPORT_{37} \geq 0.0\\
 & GRIDIMPORT_{38} \geq 0.0\\
 & GRIDIMPORT_{39} \geq 0.0\\
 & GRIDIMPORT_{40} \geq 0.0\\
 & GRIDIMPORT_{41} \geq 0.0\\
 & GRIDIMPORT_{42} \geq 0.0\\
 & GRIDIMPORT_{43} \geq 0.0\\
 & GRIDIMPORT_{44} \geq 0.0\\
 & GRIDIMPORT_{45} \geq 0.0\\
 & GRIDIMPORT_{46} \geq 0.0\\
 & GRIDIMPORT_{47} \geq 0.0\\
 & GRIDIMPORT_{48} \geq 0.0\\
 & GRIDIMPORT_{49} \geq 0.0\\
 & GRIDIMPORT_{50} \geq 0.0\\
 & GRIDIMPORT_{51} \geq 0.0\\
 & GRIDIMPORT_{52} \geq 0.0\\
 & GRIDIMPORT_{53} \geq 0.0\\
 & GRIDIMPORT_{54} \geq 0.0\\
 & GRIDIMPORT_{55} \geq 0.0\\
 & GRIDIMPORT_{56} \geq 0.0\\
 & GRIDIMPORT_{57} \geq 0.0\\
 & GRIDIMPORT_{58} \geq 0.0\\
 & GRIDIMPORT_{59} \geq 0.0\\
 & GRIDIMPORT_{60} \geq 0.0\\
 & GRIDIMPORT_{61} \geq 0.0\\
 & GRIDIMPORT_{62} \geq 0.0\\
 & GRIDIMPORT_{63} \geq 0.0\\
 & GRIDIMPORT_{64} \geq 0.0\\
 & GRIDIMPORT_{65} \geq 0.0\\
 & GRIDIMPORT_{66} \geq 0.0\\
 & GRIDIMPORT_{67} \geq 0.0\\
 & GRIDIMPORT_{68} \geq 0.0\\
 & GRIDIMPORT_{69} \geq 0.0\\
 & GRIDIMPORT_{70} \geq 0.0\\
 & GRIDIMPORT_{71} \geq 0.0\\
 & GRIDIMPORT_{72} \geq 0.0\\
 & GRIDIMPORT_{73} \geq 0.0\\
 & GRIDIMPORT_{74} \geq 0.0\\
 & GRIDIMPORT_{75} \geq 0.0\\
 & GRIDIMPORT_{76} \geq 0.0\\
 & GRIDIMPORT_{77} \geq 0.0\\
 & GRIDIMPORT_{78} \geq 0.0\\
 & GRIDIMPORT_{79} \geq 0.0\\
 & GRIDIMPORT_{80} \geq 0.0\\
 & GRIDIMPORT_{81} \geq 0.0\\
 & GRIDIMPORT_{82} \geq 0.0\\
 & GRIDIMPORT_{83} \geq 0.0\\
 & GRIDIMPORT_{84} \geq 0.0\\
 & GRIDIMPORT_{85} \geq 0.0\\
 & GRIDIMPORT_{86} \geq 0.0\\
 & GRIDIMPORT_{87} \geq 0.0\\
 & GRIDIMPORT_{88} \geq 0.0\\
 & GRIDIMPORT_{89} \geq 0.0\\
 & GRIDIMPORT_{90} \geq 0.0\\
 & GRIDIMPORT_{91} \geq 0.0\\
 & GRIDIMPORT_{92} \geq 0.0\\
 & GRIDIMPORT_{93} \geq 0.0\\
 & GRIDIMPORT_{94} \geq 0.0\\
 & GRIDIMPORT_{95} \geq 0.0\\
 & GRIDIMPORT_{96} \geq 0.0\\
 & SOC_{1} \geq 0.0\\
 & SOC_{2} \geq 0.0\\
 & SOC_{3} \geq 0.0\\
 & SOC_{4} \geq 0.0\\
 & SOC_{5} \geq 0.0\\
 & SOC_{6} \geq 0.0\\
 & SOC_{7} \geq 0.0\\
 & SOC_{8} \geq 0.0\\
 & SOC_{9} \geq 0.0\\
 & SOC_{10} \geq 0.0\\
 & SOC_{11} \geq 0.0\\
 & SOC_{12} \geq 0.0\\
 & SOC_{13} \geq 0.0\\
 & SOC_{14} \geq 0.0\\
 & SOC_{15} \geq 0.0\\
 & SOC_{16} \geq 0.0\\
 & SOC_{17} \geq 0.0\\
 & SOC_{18} \geq 0.0\\
 & SOC_{19} \geq 0.0\\
 & SOC_{20} \geq 0.0\\
 & SOC_{21} \geq 0.0\\
 & SOC_{22} \geq 0.0\\
 & SOC_{23} \geq 0.0\\
 & SOC_{24} \geq 0.0\\
 & SOC_{25} \geq 0.0\\
 & SOC_{26} \geq 0.0\\
 & SOC_{27} \geq 0.0\\
 & SOC_{28} \geq 0.0\\
 & SOC_{29} \geq 0.0\\
 & SOC_{30} \geq 0.0\\
 & SOC_{31} \geq 0.0\\
 & SOC_{32} \geq 0.0\\
 & SOC_{33} \geq 0.0\\
 & SOC_{34} \geq 0.0\\
 & SOC_{35} \geq 0.0\\
 & SOC_{36} \geq 0.0\\
 & SOC_{37} \geq 0.0\\
 & SOC_{38} \geq 0.0\\
 & SOC_{39} \geq 0.0\\
 & SOC_{40} \geq 0.0\\
 & SOC_{41} \geq 0.0\\
 & SOC_{42} \geq 0.0\\
 & SOC_{43} \geq 0.0\\
 & SOC_{44} \geq 0.0\\
 & SOC_{45} \geq 0.0\\
 & SOC_{46} \geq 0.0\\
 & SOC_{47} \geq 0.0\\
 & SOC_{48} \geq 0.0\\
 & SOC_{49} \geq 0.0\\
 & SOC_{50} \geq 0.0\\
 & SOC_{51} \geq 0.0\\
 & SOC_{52} \geq 0.0\\
 & SOC_{53} \geq 0.0\\
 & SOC_{54} \geq 0.0\\
 & SOC_{55} \geq 0.0\\
 & SOC_{56} \geq 0.0\\
 & SOC_{57} \geq 0.0\\
 & SOC_{58} \geq 0.0\\
 & SOC_{59} \geq 0.0\\
 & SOC_{60} \geq 0.0\\
 & SOC_{61} \geq 0.0\\
 & SOC_{62} \geq 0.0\\
 & SOC_{63} \geq 0.0\\
 & SOC_{64} \geq 0.0\\
 & SOC_{65} \geq 0.0\\
 & SOC_{66} \geq 0.0\\
 & SOC_{67} \geq 0.0\\
 & SOC_{68} \geq 0.0\\
 & SOC_{69} \geq 0.0\\
 & SOC_{70} \geq 0.0\\
 & SOC_{71} \geq 0.0\\
 & SOC_{72} \geq 0.0\\
 & SOC_{73} \geq 0.0\\
 & SOC_{74} \geq 0.0\\
 & SOC_{75} \geq 0.0\\
 & SOC_{76} \geq 0.0\\
 & SOC_{77} \geq 0.0\\
 & SOC_{78} \geq 0.0\\
 & SOC_{79} \geq 0.0\\
 & SOC_{80} \geq 0.0\\
 & SOC_{81} \geq 0.0\\
 & SOC_{82} \geq 0.0\\
 & SOC_{83} \geq 0.0\\
 & SOC_{84} \geq 0.0\\
 & SOC_{85} \geq 0.0\\
 & SOC_{86} \geq 0.0\\
 & SOC_{87} \geq 0.0\\
 & SOC_{88} \geq 0.0\\
 & SOC_{89} \geq 0.0\\
 & SOC_{90} \geq 0.0\\
 & SOC_{91} \geq 0.0\\
 & SOC_{92} \geq 0.0\\
 & SOC_{93} \geq 0.0\\
 & SOC_{94} \geq 0.0\\
 & SOC_{95} \geq 0.0\\
 & SOC_{96} \geq 0.0\\
 & CHARGE_{1} \leq 10.0\\
 & CHARGE_{2} \leq 10.0\\
 & CHARGE_{3} \leq 10.0\\
 & CHARGE_{4} \leq 10.0\\
 & CHARGE_{5} \leq 10.0\\
 & CHARGE_{6} \leq 10.0\\
 & CHARGE_{7} \leq 10.0\\
 & CHARGE_{8} \leq 10.0\\
 & CHARGE_{9} \leq 10.0\\
 & CHARGE_{10} \leq 10.0\\
 & CHARGE_{11} \leq 10.0\\
 & CHARGE_{12} \leq 10.0\\
 & CHARGE_{13} \leq 10.0\\
 & CHARGE_{14} \leq 10.0\\
 & CHARGE_{15} \leq 10.0\\
 & CHARGE_{16} \leq 10.0\\
 & CHARGE_{17} \leq 10.0\\
 & CHARGE_{18} \leq 10.0\\
 & CHARGE_{19} \leq 10.0\\
 & CHARGE_{20} \leq 10.0\\
 & CHARGE_{21} \leq 10.0\\
 & CHARGE_{22} \leq 10.0\\
 & CHARGE_{23} \leq 10.0\\
 & CHARGE_{24} \leq 10.0\\
 & CHARGE_{25} \leq 10.0\\
 & CHARGE_{26} \leq 10.0\\
 & CHARGE_{27} \leq 10.0\\
 & CHARGE_{28} \leq 10.0\\
 & CHARGE_{29} \leq 10.0\\
 & CHARGE_{30} \leq 10.0\\
 & CHARGE_{31} \leq 10.0\\
 & CHARGE_{32} \leq 10.0\\
 & CHARGE_{33} \leq 10.0\\
 & CHARGE_{34} \leq 10.0\\
 & CHARGE_{35} \leq 10.0\\
 & CHARGE_{36} \leq 10.0\\
 & CHARGE_{37} \leq 10.0\\
 & CHARGE_{38} \leq 10.0\\
 & CHARGE_{39} \leq 10.0\\
 & CHARGE_{40} \leq 10.0\\
 & CHARGE_{41} \leq 10.0\\
 & CHARGE_{42} \leq 10.0\\
 & CHARGE_{43} \leq 10.0\\
 & CHARGE_{44} \leq 10.0\\
 & CHARGE_{45} \leq 10.0\\
 & CHARGE_{46} \leq 10.0\\
 & CHARGE_{47} \leq 10.0\\
 & CHARGE_{48} \leq 10.0\\
 & CHARGE_{49} \leq 10.0\\
 & CHARGE_{50} \leq 10.0\\
 & CHARGE_{51} \leq 10.0\\
 & CHARGE_{52} \leq 10.0\\
 & CHARGE_{53} \leq 10.0\\
 & CHARGE_{54} \leq 10.0\\
 & CHARGE_{55} \leq 10.0\\
 & CHARGE_{56} \leq 10.0\\
 & CHARGE_{57} \leq 10.0\\
 & CHARGE_{58} \leq 10.0\\
 & CHARGE_{59} \leq 10.0\\
 & CHARGE_{60} \leq 10.0\\
 & CHARGE_{61} \leq 10.0\\
 & CHARGE_{62} \leq 10.0\\
 & CHARGE_{63} \leq 10.0\\
 & CHARGE_{64} \leq 10.0\\
 & CHARGE_{65} \leq 10.0\\
 & CHARGE_{66} \leq 10.0\\
 & CHARGE_{67} \leq 10.0\\
 & CHARGE_{68} \leq 10.0\\
 & CHARGE_{69} \leq 10.0\\
 & CHARGE_{70} \leq 10.0\\
 & CHARGE_{71} \leq 10.0\\
 & CHARGE_{72} \leq 10.0\\
 & CHARGE_{73} \leq 10.0\\
 & CHARGE_{74} \leq 10.0\\
 & CHARGE_{75} \leq 10.0\\
 & CHARGE_{76} \leq 10.0\\
 & CHARGE_{77} \leq 10.0\\
 & CHARGE_{78} \leq 10.0\\
 & CHARGE_{79} \leq 10.0\\
 & CHARGE_{80} \leq 10.0\\
 & CHARGE_{81} \leq 10.0\\
 & CHARGE_{82} \leq 10.0\\
 & CHARGE_{83} \leq 10.0\\
 & CHARGE_{84} \leq 10.0\\
 & CHARGE_{85} \leq 10.0\\
 & CHARGE_{86} \leq 10.0\\
 & CHARGE_{87} \leq 10.0\\
 & CHARGE_{88} \leq 10.0\\
 & CHARGE_{89} \leq 10.0\\
 & CHARGE_{90} \leq 10.0\\
 & CHARGE_{91} \leq 10.0\\
 & CHARGE_{92} \leq 10.0\\
 & CHARGE_{93} \leq 10.0\\
 & CHARGE_{94} \leq 10.0\\
 & CHARGE_{95} \leq 10.0\\
 & CHARGE_{96} \leq 10.0\\
 & DISCHARGE_{1} \leq 10.0\\
 & DISCHARGE_{2} \leq 10.0\\
 & DISCHARGE_{3} \leq 10.0\\
 & DISCHARGE_{4} \leq 10.0\\
 & DISCHARGE_{5} \leq 10.0\\
 & DISCHARGE_{6} \leq 10.0\\
 & DISCHARGE_{7} \leq 10.0\\
 & DISCHARGE_{8} \leq 10.0\\
 & DISCHARGE_{9} \leq 10.0\\
 & DISCHARGE_{10} \leq 10.0\\
 & DISCHARGE_{11} \leq 10.0\\
 & DISCHARGE_{12} \leq 10.0\\
 & DISCHARGE_{13} \leq 10.0\\
 & DISCHARGE_{14} \leq 10.0\\
 & DISCHARGE_{15} \leq 10.0\\
 & DISCHARGE_{16} \leq 10.0\\
 & DISCHARGE_{17} \leq 10.0\\
 & DISCHARGE_{18} \leq 10.0\\
 & DISCHARGE_{19} \leq 10.0\\
 & DISCHARGE_{20} \leq 10.0\\
 & DISCHARGE_{21} \leq 10.0\\
 & DISCHARGE_{22} \leq 10.0\\
 & DISCHARGE_{23} \leq 10.0\\
 & DISCHARGE_{24} \leq 10.0\\
 & DISCHARGE_{25} \leq 10.0\\
 & DISCHARGE_{26} \leq 10.0\\
 & DISCHARGE_{27} \leq 10.0\\
 & DISCHARGE_{28} \leq 10.0\\
 & DISCHARGE_{29} \leq 10.0\\
 & DISCHARGE_{30} \leq 10.0\\
 & DISCHARGE_{31} \leq 10.0\\
 & DISCHARGE_{32} \leq 10.0\\
 & DISCHARGE_{33} \leq 10.0\\
 & DISCHARGE_{34} \leq 10.0\\
 & DISCHARGE_{35} \leq 10.0\\
 & DISCHARGE_{36} \leq 10.0\\
 & DISCHARGE_{37} \leq 10.0\\
 & DISCHARGE_{38} \leq 10.0\\
 & DISCHARGE_{39} \leq 10.0\\
 & DISCHARGE_{40} \leq 10.0\\
 & DISCHARGE_{41} \leq 10.0\\
 & DISCHARGE_{42} \leq 10.0\\
 & DISCHARGE_{43} \leq 10.0\\
 & DISCHARGE_{44} \leq 10.0\\
 & DISCHARGE_{45} \leq 10.0\\
 & DISCHARGE_{46} \leq 10.0\\
 & DISCHARGE_{47} \leq 10.0\\
 & DISCHARGE_{48} \leq 10.0\\
 & DISCHARGE_{49} \leq 10.0\\
 & DISCHARGE_{50} \leq 10.0\\
 & DISCHARGE_{51} \leq 10.0\\
 & DISCHARGE_{52} \leq 10.0\\
 & DISCHARGE_{53} \leq 10.0\\
 & DISCHARGE_{54} \leq 10.0\\
 & DISCHARGE_{55} \leq 10.0\\
 & DISCHARGE_{56} \leq 10.0\\
 & DISCHARGE_{57} \leq 10.0\\
 & DISCHARGE_{58} \leq 10.0\\
 & DISCHARGE_{59} \leq 10.0\\
 & DISCHARGE_{60} \leq 10.0\\
 & DISCHARGE_{61} \leq 10.0\\
 & DISCHARGE_{62} \leq 10.0\\
 & DISCHARGE_{63} \leq 10.0\\
 & DISCHARGE_{64} \leq 10.0\\
 & DISCHARGE_{65} \leq 10.0\\
 & DISCHARGE_{66} \leq 10.0\\
 & DISCHARGE_{67} \leq 10.0\\
 & DISCHARGE_{68} \leq 10.0\\
 & DISCHARGE_{69} \leq 10.0\\
 & DISCHARGE_{70} \leq 10.0\\
 & DISCHARGE_{71} \leq 10.0\\
 & DISCHARGE_{72} \leq 10.0\\
 & DISCHARGE_{73} \leq 10.0\\
 & DISCHARGE_{74} \leq 10.0\\
 & DISCHARGE_{75} \leq 10.0\\
 & DISCHARGE_{76} \leq 10.0\\
 & DISCHARGE_{77} \leq 10.0\\
 & DISCHARGE_{78} \leq 10.0\\
 & DISCHARGE_{79} \leq 10.0\\
 & DISCHARGE_{80} \leq 10.0\\
 & DISCHARGE_{81} \leq 10.0\\
 & DISCHARGE_{82} \leq 10.0\\
 & DISCHARGE_{83} \leq 10.0\\
 & DISCHARGE_{84} \leq 10.0\\
 & DISCHARGE_{85} \leq 10.0\\
 & DISCHARGE_{86} \leq 10.0\\
 & DISCHARGE_{87} \leq 10.0\\
 & DISCHARGE_{88} \leq 10.0\\
 & DISCHARGE_{89} \leq 10.0\\
 & DISCHARGE_{90} \leq 10.0\\
 & DISCHARGE_{91} \leq 10.0\\
 & DISCHARGE_{92} \leq 10.0\\
 & DISCHARGE_{93} \leq 10.0\\
 & DISCHARGE_{94} \leq 10.0\\
 & DISCHARGE_{95} \leq 10.0\\
 & DISCHARGE_{96} \leq 10.0\\
 & GRIDEXPORT_{1} \leq 40.0\\
 & GRIDEXPORT_{2} \leq 40.0\\
 & GRIDEXPORT_{3} \leq 40.0\\
 & GRIDEXPORT_{4} \leq 40.0\\
 & GRIDEXPORT_{5} \leq 40.0\\
 & GRIDEXPORT_{6} \leq 40.0\\
 & GRIDEXPORT_{7} \leq 40.0\\
 & GRIDEXPORT_{8} \leq 40.0\\
 & GRIDEXPORT_{9} \leq 40.0\\
 & GRIDEXPORT_{10} \leq 40.0\\
 & GRIDEXPORT_{11} \leq 40.0\\
 & GRIDEXPORT_{12} \leq 40.0\\
 & GRIDEXPORT_{13} \leq 40.0\\
 & GRIDEXPORT_{14} \leq 40.0\\
 & GRIDEXPORT_{15} \leq 40.0\\
 & GRIDEXPORT_{16} \leq 40.0\\
 & GRIDEXPORT_{17} \leq 40.0\\
 & GRIDEXPORT_{18} \leq 40.0\\
 & GRIDEXPORT_{19} \leq 40.0\\
 & GRIDEXPORT_{20} \leq 40.0\\
 & GRIDEXPORT_{21} \leq 40.0\\
 & GRIDEXPORT_{22} \leq 40.0\\
 & GRIDEXPORT_{23} \leq 40.0\\
 & GRIDEXPORT_{24} \leq 40.0\\
 & GRIDEXPORT_{25} \leq 40.0\\
 & GRIDEXPORT_{26} \leq 40.0\\
 & GRIDEXPORT_{27} \leq 40.0\\
 & GRIDEXPORT_{28} \leq 40.0\\
 & GRIDEXPORT_{29} \leq 40.0\\
 & GRIDEXPORT_{30} \leq 40.0\\
 & GRIDEXPORT_{31} \leq 40.0\\
 & GRIDEXPORT_{32} \leq 40.0\\
 & GRIDEXPORT_{33} \leq 40.0\\
 & GRIDEXPORT_{34} \leq 40.0\\
 & GRIDEXPORT_{35} \leq 40.0\\
 & GRIDEXPORT_{36} \leq 40.0\\
 & GRIDEXPORT_{37} \leq 40.0\\
 & GRIDEXPORT_{38} \leq 40.0\\
 & GRIDEXPORT_{39} \leq 40.0\\
 & GRIDEXPORT_{40} \leq 40.0\\
 & GRIDEXPORT_{41} \leq 40.0\\
 & GRIDEXPORT_{42} \leq 40.0\\
 & GRIDEXPORT_{43} \leq 40.0\\
 & GRIDEXPORT_{44} \leq 40.0\\
 & GRIDEXPORT_{45} \leq 40.0\\
 & GRIDEXPORT_{46} \leq 40.0\\
 & GRIDEXPORT_{47} \leq 40.0\\
 & GRIDEXPORT_{48} \leq 40.0\\
 & GRIDEXPORT_{49} \leq 40.0\\
 & GRIDEXPORT_{50} \leq 40.0\\
 & GRIDEXPORT_{51} \leq 40.0\\
 & GRIDEXPORT_{52} \leq 40.0\\
 & GRIDEXPORT_{53} \leq 40.0\\
 & GRIDEXPORT_{54} \leq 40.0\\
 & GRIDEXPORT_{55} \leq 40.0\\
 & GRIDEXPORT_{56} \leq 40.0\\
 & GRIDEXPORT_{57} \leq 40.0\\
 & GRIDEXPORT_{58} \leq 40.0\\
 & GRIDEXPORT_{59} \leq 40.0\\
 & GRIDEXPORT_{60} \leq 40.0\\
 & GRIDEXPORT_{61} \leq 40.0\\
 & GRIDEXPORT_{62} \leq 40.0\\
 & GRIDEXPORT_{63} \leq 40.0\\
 & GRIDEXPORT_{64} \leq 40.0\\
 & GRIDEXPORT_{65} \leq 40.0\\
 & GRIDEXPORT_{66} \leq 40.0\\
 & GRIDEXPORT_{67} \leq 40.0\\
 & GRIDEXPORT_{68} \leq 40.0\\
 & GRIDEXPORT_{69} \leq 40.0\\
 & GRIDEXPORT_{70} \leq 40.0\\
 & GRIDEXPORT_{71} \leq 40.0\\
 & GRIDEXPORT_{72} \leq 40.0\\
 & GRIDEXPORT_{73} \leq 40.0\\
 & GRIDEXPORT_{74} \leq 40.0\\
 & GRIDEXPORT_{75} \leq 40.0\\
 & GRIDEXPORT_{76} \leq 40.0\\
 & GRIDEXPORT_{77} \leq 40.0\\
 & GRIDEXPORT_{78} \leq 40.0\\
 & GRIDEXPORT_{79} \leq 40.0\\
 & GRIDEXPORT_{80} \leq 40.0\\
 & GRIDEXPORT_{81} \leq 40.0\\
 & GRIDEXPORT_{82} \leq 40.0\\
 & GRIDEXPORT_{83} \leq 40.0\\
 & GRIDEXPORT_{84} \leq 40.0\\
 & GRIDEXPORT_{85} \leq 40.0\\
 & GRIDEXPORT_{86} \leq 40.0\\
 & GRIDEXPORT_{87} \leq 40.0\\
 & GRIDEXPORT_{88} \leq 40.0\\
 & GRIDEXPORT_{89} \leq 40.0\\
 & GRIDEXPORT_{90} \leq 40.0\\
 & GRIDEXPORT_{91} \leq 40.0\\
 & GRIDEXPORT_{92} \leq 40.0\\
 & GRIDEXPORT_{93} \leq 40.0\\
 & GRIDEXPORT_{94} \leq 40.0\\
 & GRIDEXPORT_{95} \leq 40.0\\
 & GRIDEXPORT_{96} \leq 40.0\\
 & GRIDIMPORT_{1} \leq 40.0\\
 & GRIDIMPORT_{2} \leq 40.0\\
 & GRIDIMPORT_{3} \leq 40.0\\
 & GRIDIMPORT_{4} \leq 40.0\\
 & GRIDIMPORT_{5} \leq 40.0\\
 & GRIDIMPORT_{6} \leq 40.0\\
 & GRIDIMPORT_{7} \leq 40.0\\
 & GRIDIMPORT_{8} \leq 40.0\\
 & GRIDIMPORT_{9} \leq 40.0\\
 & GRIDIMPORT_{10} \leq 40.0\\
 & GRIDIMPORT_{11} \leq 40.0\\
 & GRIDIMPORT_{12} \leq 40.0\\
 & GRIDIMPORT_{13} \leq 40.0\\
 & GRIDIMPORT_{14} \leq 40.0\\
 & GRIDIMPORT_{15} \leq 40.0\\
 & GRIDIMPORT_{16} \leq 40.0\\
 & GRIDIMPORT_{17} \leq 40.0\\
 & GRIDIMPORT_{18} \leq 40.0\\
 & GRIDIMPORT_{19} \leq 40.0\\
 & GRIDIMPORT_{20} \leq 40.0\\
 & GRIDIMPORT_{21} \leq 40.0\\
 & GRIDIMPORT_{22} \leq 40.0\\
 & GRIDIMPORT_{23} \leq 40.0\\
 & GRIDIMPORT_{24} \leq 40.0\\
 & GRIDIMPORT_{25} \leq 40.0\\
 & GRIDIMPORT_{26} \leq 40.0\\
 & GRIDIMPORT_{27} \leq 40.0\\
 & GRIDIMPORT_{28} \leq 40.0\\
 & GRIDIMPORT_{29} \leq 40.0\\
 & GRIDIMPORT_{30} \leq 40.0\\
 & GRIDIMPORT_{31} \leq 40.0\\
 & GRIDIMPORT_{32} \leq 40.0\\
 & GRIDIMPORT_{33} \leq 40.0\\
 & GRIDIMPORT_{34} \leq 40.0\\
 & GRIDIMPORT_{35} \leq 40.0\\
 & GRIDIMPORT_{36} \leq 40.0\\
 & GRIDIMPORT_{37} \leq 40.0\\
 & GRIDIMPORT_{38} \leq 40.0\\
 & GRIDIMPORT_{39} \leq 40.0\\
 & GRIDIMPORT_{40} \leq 40.0\\
 & GRIDIMPORT_{41} \leq 40.0\\
 & GRIDIMPORT_{42} \leq 40.0\\
 & GRIDIMPORT_{43} \leq 40.0\\
 & GRIDIMPORT_{44} \leq 40.0\\
 & GRIDIMPORT_{45} \leq 40.0\\
 & GRIDIMPORT_{46} \leq 40.0\\
 & GRIDIMPORT_{47} \leq 40.0\\
 & GRIDIMPORT_{48} \leq 40.0\\
 & GRIDIMPORT_{49} \leq 40.0\\
 & GRIDIMPORT_{50} \leq 40.0\\
 & GRIDIMPORT_{51} \leq 40.0\\
 & GRIDIMPORT_{52} \leq 40.0\\
 & GRIDIMPORT_{53} \leq 40.0\\
 & GRIDIMPORT_{54} \leq 40.0\\
 & GRIDIMPORT_{55} \leq 40.0\\
 & GRIDIMPORT_{56} \leq 40.0\\
 & GRIDIMPORT_{57} \leq 40.0\\
 & GRIDIMPORT_{58} \leq 40.0\\
 & GRIDIMPORT_{59} \leq 40.0\\
 & GRIDIMPORT_{60} \leq 40.0\\
 & GRIDIMPORT_{61} \leq 40.0\\
 & GRIDIMPORT_{62} \leq 40.0\\
 & GRIDIMPORT_{63} \leq 40.0\\
 & GRIDIMPORT_{64} \leq 40.0\\
 & GRIDIMPORT_{65} \leq 40.0\\
 & GRIDIMPORT_{66} \leq 40.0\\
 & GRIDIMPORT_{67} \leq 40.0\\
 & GRIDIMPORT_{68} \leq 40.0\\
 & GRIDIMPORT_{69} \leq 40.0\\
 & GRIDIMPORT_{70} \leq 40.0\\
 & GRIDIMPORT_{71} \leq 40.0\\
 & GRIDIMPORT_{72} \leq 40.0\\
 & GRIDIMPORT_{73} \leq 40.0\\
 & GRIDIMPORT_{74} \leq 40.0\\
 & GRIDIMPORT_{75} \leq 40.0\\
 & GRIDIMPORT_{76} \leq 40.0\\
 & GRIDIMPORT_{77} \leq 40.0\\
 & GRIDIMPORT_{78} \leq 40.0\\
 & GRIDIMPORT_{79} \leq 40.0\\
 & GRIDIMPORT_{80} \leq 40.0\\
 & GRIDIMPORT_{81} \leq 40.0\\
 & GRIDIMPORT_{82} \leq 40.0\\
 & GRIDIMPORT_{83} \leq 40.0\\
 & GRIDIMPORT_{84} \leq 40.0\\
 & GRIDIMPORT_{85} \leq 40.0\\
 & GRIDIMPORT_{86} \leq 40.0\\
 & GRIDIMPORT_{87} \leq 40.0\\
 & GRIDIMPORT_{88} \leq 40.0\\
 & GRIDIMPORT_{89} \leq 40.0\\
 & GRIDIMPORT_{90} \leq 40.0\\
 & GRIDIMPORT_{91} \leq 40.0\\
 & GRIDIMPORT_{92} \leq 40.0\\
 & GRIDIMPORT_{93} \leq 40.0\\
 & GRIDIMPORT_{94} \leq 40.0\\
 & GRIDIMPORT_{95} \leq 40.0\\
 & GRIDIMPORT_{96} \leq 40.0\\
 & SOC_{1} \leq 40.0\\
 & SOC_{2} \leq 40.0\\
 & SOC_{3} \leq 40.0\\
 & SOC_{4} \leq 40.0\\
 & SOC_{5} \leq 40.0\\
 & SOC_{6} \leq 40.0\\
 & SOC_{7} \leq 40.0\\
 & SOC_{8} \leq 40.0\\
 & SOC_{9} \leq 40.0\\
 & SOC_{10} \leq 40.0\\
 & SOC_{11} \leq 40.0\\
 & SOC_{12} \leq 40.0\\
 & SOC_{13} \leq 40.0\\
 & SOC_{14} \leq 40.0\\
 & SOC_{15} \leq 40.0\\
 & SOC_{16} \leq 40.0\\
 & SOC_{17} \leq 40.0\\
 & SOC_{18} \leq 40.0\\
 & SOC_{19} \leq 40.0\\
 & SOC_{20} \leq 40.0\\
 & SOC_{21} \leq 40.0\\
 & SOC_{22} \leq 40.0\\
 & SOC_{23} \leq 40.0\\
 & SOC_{24} \leq 40.0\\
 & SOC_{25} \leq 40.0\\
 & SOC_{26} \leq 40.0\\
 & SOC_{27} \leq 40.0\\
 & SOC_{28} \leq 40.0\\
 & SOC_{29} \leq 40.0\\
 & SOC_{30} \leq 40.0\\
 & SOC_{31} \leq 40.0\\
 & SOC_{32} \leq 40.0\\
 & SOC_{33} \leq 40.0\\
 & SOC_{34} \leq 40.0\\
 & SOC_{35} \leq 40.0\\
 & SOC_{36} \leq 40.0\\
 & SOC_{37} \leq 40.0\\
 & SOC_{38} \leq 40.0\\
 & SOC_{39} \leq 40.0\\
 & SOC_{40} \leq 40.0\\
 & SOC_{41} \leq 40.0\\
 & SOC_{42} \leq 40.0\\
 & SOC_{43} \leq 40.0\\
 & SOC_{44} \leq 40.0\\
 & SOC_{45} \leq 40.0\\
 & SOC_{46} \leq 40.0\\
 & SOC_{47} \leq 40.0\\
 & SOC_{48} \leq 40.0\\
 & SOC_{49} \leq 40.0\\
 & SOC_{50} \leq 40.0\\
 & SOC_{51} \leq 40.0\\
 & SOC_{52} \leq 40.0\\
 & SOC_{53} \leq 40.0\\
 & SOC_{54} \leq 40.0\\
 & SOC_{55} \leq 40.0\\
 & SOC_{56} \leq 40.0\\
 & SOC_{57} \leq 40.0\\
 & SOC_{58} \leq 40.0\\
 & SOC_{59} \leq 40.0\\
 & SOC_{60} \leq 40.0\\
 & SOC_{61} \leq 40.0\\
 & SOC_{62} \leq 40.0\\
 & SOC_{63} \leq 40.0\\
 & SOC_{64} \leq 40.0\\
 & SOC_{65} \leq 40.0\\
 & SOC_{66} \leq 40.0\\
 & SOC_{67} \leq 40.0\\
 & SOC_{68} \leq 40.0\\
 & SOC_{69} \leq 40.0\\
 & SOC_{70} \leq 40.0\\
 & SOC_{71} \leq 40.0\\
 & SOC_{72} \leq 40.0\\
 & SOC_{73} \leq 40.0\\
 & SOC_{74} \leq 40.0\\
 & SOC_{75} \leq 40.0\\
 & SOC_{76} \leq 40.0\\
 & SOC_{77} \leq 40.0\\
 & SOC_{78} \leq 40.0\\
 & SOC_{79} \leq 40.0\\
 & SOC_{80} \leq 40.0\\
 & SOC_{81} \leq 40.0\\
 & SOC_{82} \leq 40.0\\
 & SOC_{83} \leq 40.0\\
 & SOC_{84} \leq 40.0\\
 & SOC_{85} \leq 40.0\\
 & SOC_{86} \leq 40.0\\
 & SOC_{87} \leq 40.0\\
 & SOC_{88} \leq 40.0\\
 & SOC_{89} \leq 40.0\\
 & SOC_{90} \leq 40.0\\
 & SOC_{91} \leq 40.0\\
 & SOC_{92} \leq 40.0\\
 & SOC_{93} \leq 40.0\\
 & SOC_{94} \leq 40.0\\
 & SOC_{95} \leq 40.0\\
 & SOC_{96} \leq 40.0\\
\end{alignat*}
 $$




A little more complicated, eh? Now you can see why it is useful to have an algebraic programming language to define more complex models and then hand over to a solver to do the hard math. 

As JuMP enumerates each individual variable when printing the model, here's a more compact algebraic definition of the solar and storage optimal dispatch problem:


$
{\scriptstyle\begin{align*}
& \max \sum_{t \in T} (GRIDEXPORT_t - GRIDIMPORT_t) \times Price_t \times 0.25 && \text{Objective function (revenue)}\\[6pt] 
& \text{s.t.} && \\[6pt]
& eNetSolarStorage_t = SOLAR_t + DISCHARGE_t - CHARGE_t & \forall t \in T &\quad \text{Net solar and storage production (DC MW)} \\[6pt]
& eNetExport_t = \frac{GRIDEXPORT_t}{inverter\_eff} - GRIDIMPORT_t \times inverter\_eff & \forall t \in T &\quad \text{Net grid interchange (DC MW)} \\[6pt]
& eNetSolarStorage_t = eNetExport_t  & \forall t \in T &\quad \text{Energy balance constraint} \\[6pt]
& SOC_1 = start\_charge + 0.25 \big(CHARGE_1 * battery\_eff - \frac{DISCHARGE_1}{battery\_eff}\big)  & &\\[6pt]
& SOC_t = SOC_{t-1} + 0.25 \big(CHARGE_t * battery\_eff - \frac{DISCHARGE_t}{battery\_eff}\big)  & \forall t \in T \text{ & } t > 1 &\quad \text{State of charge constraints}\\[6pt]
& SOLAR_t  \leq time\_series.Solar_t     &\forall t \in T & \quad \text{Solar PV capacity constraints}\\[6pt]
& CHARGE_t     \leq battery\_cap         &\forall t \in T & \quad \text{Charge capacity constraints}\\[6pt]
& DISCHARGE_t    \leq battery\_cap      &\forall t \in T & \quad \text{Discharge capacity constraints}\\[6pt]
& SOC_t    \leq energy\_cap             &\forall t \in T & \quad \text{State of charge capacity constraints}\\[6pt]
& GRIDEXPORT_t    \leq grid\_cap      &\forall t \in T & \quad \text{Grid capacity constraint (exports)}\\[6pt]
& GRIDIMPORT_t    \leq grid\_cap             &\forall t \in T & \quad \text{Grid capacity constraint (imports)}\\[6pt]
& SOLAR_t, CHARGE_t, DISCHARGE_t, &&\\
& SOC_t, GRIDEXPORT_t, GRIDIMPORT_t, \geq 0 &\forall t \in T & \quad \text{Non-negativity constraints}\\[6pt]
\end{align*}}
$




Let's optimize this problem!


```julia
optimize!(PV_model)
```

    Coin0506I Presolve 185 (-103) rows, 472 (-104) columns and 752 (-207) elements
    Clp0006I 0  Obj -0 Primal inf 49.117949 (1) Dual inf 404.78279 (96)
    Clp0006I 78  Obj 10746.24 Primal inf 2214.4864 (108)
    Clp0006I 156  Obj 8082.754 Primal inf 340.06761 (53)
    Clp0006I 206  Obj 8082.754 Primal inf 777.26144 (63)
    Clp0006I 255  Obj 7510.2304 Primal inf 207.0862 (36)
    Clp0006I 293  Obj 7290.961
    Clp0000I Optimal - objective value 7290.961
    Coin0511I After Postsolve, objective 7290.961, infeasibilities - dual 128.28533 (47), primal 0 (0)
    Coin0512I Presolved model was optimal, full model needs cleaning up
    Clp0006I 0  Obj 7290.961
    Clp0000I Optimal - objective value 7290.961
    Clp0032I Optimal objective 7290.960979 - 293 iterations time 0.002, Presolve 0.00


### Results!

We can see from the solver that the optimal revenue is \$7290. 

We can now access the optimal decision variables as well. As these are now arrays of variables, we must use the [vectorized syntax](https://docs.julialang.org/en/v1/manual/functions/#man-vectorized) version of JuMP's `value()` function: `value.(ArrayOfVariablesReference)` 

Similarly, for or arrays of expressions or constraints, use: `value.(ArrayOfExpressionsReference)` or `value.(ArrayOfConstraintsReference)`.

For example, here's the optimal state of charge for the battery across the day:


```julia
value.(SOC)
```




    1-dimensional DenseAxisArray{Float64,1,...} with index sets:
        Dimension 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  87, 88, 89, 90, 91, 92, 93, 94, 95, 96]
    And data, a 96-element Array{Float64,1}:
     17.368421052631575
     14.736842105263154
     12.105263157894735
      9.473684210526313
      6.842105263157893
      4.210526315789473
      1.9999999999999956
      1.9999999999999956
      4.374999999999996
      6.749999999999996
      9.124999999999996
     11.499999999999996
     13.874999999999996
      ⋮
      0.0
      0.0
      2.3749999999999996
      2.3749999999999996
      0.0
      0.0
      0.0
      0.0
      0.0
      0.0
      0.0
      0.0



Additionally, we can compile all of the results into a DataFrame and write to a csv to save our outputs for further analysis.

Note however that `value.(Reference)` will return a JuMP [DenseAxisArray](https://jump.dev/JuMP.jl/dev/variables/#variable_jump_arrays-1) which is not a data format that is compatible with DataFrames. To access the numerical values for an array of JuMP variables or expressions in a DenseAxisArray, you use the syntax `value.(Reference).data`.


```julia
typeof(value.(SOC))
```




    JuMP.Containers.DenseAxisArray{Float64,1,Tuple{Array{Int64,1}},Tuple{Dict{Int64,Int64}}}




```julia
typeof(value.(SOC).data)
```




    Array{Float64,1}



Below we compile the DataFrame and write it to .csv file. Note that we copy in the time intervals and price in each time period from the input time series as well for context.


```julia
results = DataFrame(
    T = time_series.T,
    Price = time_series.Price,
    Solar_Output = value.(SOLAR).data, 
    Storage_Discharge = value.(DISCHARGE).data,
    Storage_Charge = value.(CHARGE).data,
    Storage_SOC = value.(SOC).data,
    Export = value.(GRIDEXPORT).data,
    Import = value.(GRIDIMPORT).data,
    Interval_Revenue = (value.(GRIDEXPORT).data-value.(GRIDIMPORT).data) .* time_series.Price *0.25
    )
```




<table class="data-frame"><thead><tr><th></th><th>T</th><th>Price</th><th>Solar_Output</th><th>Storage_Discharge</th><th>Storage_Charge</th><th>Storage_SOC</th><th>Export</th></tr><tr><th></th><th>Int64</th><th>Float64</th><th>Float64</th><th>Float64</th><th>Float64</th><th>Float64</th><th>Float64</th></tr></thead><tbody><p>96 rows × 9 columns (omitted printing of 2 columns)</p><tr><th>1</th><td>1</td><td>12.77</td><td>0.0</td><td>10.0</td><td>0.0</td><td>17.3684</td><td>9.0</td></tr><tr><th>2</th><td>2</td><td>11.82</td><td>0.0</td><td>10.0</td><td>0.0</td><td>14.7368</td><td>9.0</td></tr><tr><th>3</th><td>3</td><td>12.39</td><td>0.0</td><td>10.0</td><td>0.0</td><td>12.1053</td><td>9.0</td></tr><tr><th>4</th><td>4</td><td>10.17</td><td>0.0</td><td>10.0</td><td>0.0</td><td>9.47368</td><td>9.0</td></tr><tr><th>5</th><td>5</td><td>5.86</td><td>0.0</td><td>10.0</td><td>0.0</td><td>6.84211</td><td>9.0</td></tr><tr><th>6</th><td>6</td><td>2.69</td><td>0.0</td><td>10.0</td><td>0.0</td><td>4.21053</td><td>9.0</td></tr><tr><th>7</th><td>7</td><td>1.46</td><td>0.0</td><td>8.4</td><td>0.0</td><td>2.0</td><td>7.56</td></tr><tr><th>8</th><td>8</td><td>1.41</td><td>0.0</td><td>0.0</td><td>0.0</td><td>2.0</td><td>0.0</td></tr><tr><th>9</th><td>9</td><td>0.03</td><td>0.0</td><td>0.0</td><td>10.0</td><td>4.375</td><td>0.0</td></tr><tr><th>10</th><td>10</td><td>-0.19</td><td>0.0</td><td>0.0</td><td>10.0</td><td>6.75</td><td>23.4</td></tr><tr><th>11</th><td>11</td><td>-0.72</td><td>0.0</td><td>0.0</td><td>10.0</td><td>9.125</td><td>23.4</td></tr><tr><th>12</th><td>12</td><td>-0.54</td><td>0.0</td><td>0.0</td><td>10.0</td><td>11.5</td><td>23.4</td></tr><tr><th>13</th><td>13</td><td>-0.45</td><td>0.0</td><td>0.0</td><td>10.0</td><td>13.875</td><td>23.4</td></tr><tr><th>14</th><td>14</td><td>-0.6</td><td>0.0</td><td>0.0</td><td>10.0</td><td>16.25</td><td>23.4</td></tr><tr><th>15</th><td>15</td><td>-0.72</td><td>0.0</td><td>0.0</td><td>10.0</td><td>18.625</td><td>23.4</td></tr><tr><th>16</th><td>16</td><td>-0.63</td><td>0.0</td><td>0.0</td><td>10.0</td><td>21.0</td><td>23.4</td></tr><tr><th>17</th><td>17</td><td>-0.72</td><td>0.0</td><td>0.0</td><td>10.0</td><td>23.375</td><td>23.4</td></tr><tr><th>18</th><td>18</td><td>-1.19</td><td>0.0</td><td>0.0</td><td>10.0</td><td>25.75</td><td>23.4</td></tr><tr><th>19</th><td>19</td><td>-1.04</td><td>0.0</td><td>0.0</td><td>10.0</td><td>28.125</td><td>23.4</td></tr><tr><th>20</th><td>20</td><td>-0.76</td><td>0.0</td><td>0.0</td><td>10.0</td><td>30.5</td><td>23.4</td></tr><tr><th>21</th><td>21</td><td>-0.47</td><td>0.0</td><td>0.0</td><td>10.0</td><td>32.875</td><td>23.4</td></tr><tr><th>22</th><td>22</td><td>0.68</td><td>0.0</td><td>0.0</td><td>10.0</td><td>35.25</td><td>0.0</td></tr><tr><th>23</th><td>23</td><td>0.78</td><td>0.0</td><td>0.0</td><td>10.0</td><td>37.625</td><td>0.0</td></tr><tr><th>24</th><td>24</td><td>0.09</td><td>0.0</td><td>0.0</td><td>10.0</td><td>40.0</td><td>0.0</td></tr><tr><th>25</th><td>25</td><td>5.51</td><td>0.0</td><td>0.208478</td><td>0.0</td><td>39.9451</td><td>0.18763</td></tr><tr><th>26</th><td>26</td><td>4.66</td><td>0.077</td><td>0.0</td><td>0.077</td><td>39.9634</td><td>0.0</td></tr><tr><th>27</th><td>27</td><td>4.52</td><td>0.154</td><td>0.0</td><td>0.154</td><td>40.0</td><td>0.0</td></tr><tr><th>28</th><td>28</td><td>5.89</td><td>0.232</td><td>0.0</td><td>0.0</td><td>40.0</td><td>0.2088</td></tr><tr><th>29</th><td>29</td><td>8.83</td><td>0.309</td><td>10.0</td><td>0.0</td><td>37.3684</td><td>9.2781</td></tr><tr><th>30</th><td>30</td><td>8.83</td><td>7.94</td><td>8.98164</td><td>0.0</td><td>35.0048</td><td>15.2295</td></tr><tr><th>&vellip;</th><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td><td>&vellip;</td></tr></tbody></table>




```julia
# Let's create a folder for our results
path = "results" # Replace this with a different path if you prefer to write to another location
if !ispath(path) 
    mkdir(path)
end
write_path = joinpath(path, "solar_storage_results.csv") 
CSV.write(write_path, results)
```




    "results/solar_storage_results.csv"



Finally, let's plot the optimal operational decisions for our solar and storage system....


```julia
plot(results.Solar_Output, label="Solar (MW-dc)")
plot!(results.Storage_Discharge, label="Discharge (MW-dc)")
plot!(-1*results.Storage_Charge, label="Charge (MW-dc)")
plot!(results.Storage_SOC, label="State Of Charge (MWh)")
title!("Solar and Storage Operations")
xaxis!("Time Interval (15 mins)")
yaxis!("")
```




<!DOCTYPE html>
<html>
    <head>
        <title>Plots.jl</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
    </head>
    <body>
            <div id="8d9ad5e5-f9d5-4a8f-ada2-b72a245f0b8c" style="width:600px;height:400px;"></div>
    

    </body>
</html>





```julia
plot(results.Price, label="Price (\$/MWh)")
plot!(results.Export- results.Import, label="Net Grid Export (MW-ac)")
title!("Net Grid Export and Price")
xaxis!("Time Interval (15 mins)")
yaxis!("")
```




<!DOCTYPE html>
<html>
    <head>
        <title>Plots.jl</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
    </head>
    <body>
            <div id="501cc6a5-fa3b-40c7-870b-2dcfe36022fd" style="width:600px;height:400px;"></div>
    

    </body>
</html>




You can see that the storage system charges during the morning hours by importing power from the grid when energy prices are zero or slightly negative (which means the storage system gets paid to charge!) and discharges a bit during the morning as solar comes on and prices go positive. Later, the system charges storage from a portion of the solar PV output during the middle of the day to avoid curtailing solar output that peaks at 50 MW-dc and exceeds the grid connection capacity (40 MW-ac or 44.444 MW-dc accounting for inverter losses prior to export). This energy is then discharged and exported during the evening when solar output is gone and electricity prices spike to their highest level of the day.


```julia

```

0a7cca326906b0d108c724b7cf010a86c890217c
ipynb
Jupyter Notebook
Notebooks/02-Anatomy-of-a-Model.ipynb
cristianho3/power-systems-optimization
547e03857a8b7019f507cb88be8efc261799b572
CC-BY-4.0 MIT
Notebooks/02-Anatomy-of-a-Model.ipynb
cristianho3/power-systems-optimization
547e03857a8b7019f507cb88be8efc261799b572
CC-BY-4.0 MIT
Notebooks/02-Anatomy-of-a-Model.ipynb
cristianho3/power-systems-optimization
547e03857a8b7019f507cb88be8efc261799b572
CC-BY-4.0 MIT
Qwen/Qwen-72B
1. YES
2. YES