Objective function

The variable total system cost \(\zeta\) is calculated by the cost function. The cost function is the objective function of the optimization model. Minimizing the value of the variable total system cost would give the most reasonable solution for the modelled energy system The formula of the cost function expressed in mathematical notation is as following:

\[\zeta = \zeta_\text{inv} + \zeta_\text{fix} + \zeta_\text{var} + \zeta_\text{fuel} + \zeta_\text{rev} + \zeta_\text{pur} + \zeta_\text{startup}\]

The calculation of the variable total system cost is given in urbs.py by the following code fragment.

The variable total system cost \(\zeta\) is basically calculated by the summation of every type of total costs. As previously mentioned in section Cost Types, these cost types are : Investment, Fix, Variable, Fuel, Revenue, Purchase. The calculation of each single cost types are listed below.

Investment Costs

The variable investment costs \(\zeta_\text{inv}\) represent the required annual expenses made, in the hope of future benefits. These expenses are made on every new investment. The possible investments of an energy system in this model are:

  1. Additional throughput capacity for process technologies.
  2. Additional power capacity for storage technologies and additional storage content capacity for storage technologies.
  3. Additional power capacity for transmission technologies.

The calculation of total annual investment cost \(\zeta_\text{inv}\) is expressed by the formula:

\[\begin{split}\zeta_\text{inv} = \sum_{\substack{v \in V\\ p \in P}} \hat{\kappa}_{vp} k_p^\text{inv} + \sum_{\substack{v \in V\\ s \in S}} \left( \hat{\kappa}_{vs}^\text{c} k_{vs}^\text{c,inv} + \hat{\kappa}_{vs}^\text{p} k_{vs}^\text{p,inv}\right) + \sum_{\substack{a \in A\\ f \in F}} \hat{\kappa}_{af} k_{af}^\text{inv}\end{split}\]

Total annual investment cost is calculated by the sum of three main summands, these are the investment costs for processes, storages, and transmissions.

  1. The first summand of the formula calculates the required annual investment expenses to install the additional process capacity for every member of the set process tuples \(\forall p_v \in P_v\). Total process investment cost for all process tuples is defined by the sum of all possible annual process investment costs, which are calculated seperately for each process tuple ( \(p_v\), m.pro_tuples) consisting of process \(p\) in site \(v\). Annual process investment cost for a given process tuple \(p_v\) is calculated by the product of the variable new process capacity ( \(\hat{\kappa}_{vp}\),``m.cap_pro_new``) and the parameter annualised process capacity investment cost ( \(k_{vp}^\text{inv}\), m.process.loc[p]['inv-cost'] * m.process.loc[p]['annuity-factor']). In mathematical notation this summand is expressed as:
\[\begin{split}\sum_{\substack{v \in V\\ p \in P}} \hat{\kappa}_{vp} k_p^\text{inv}\end{split}\]
  1. The second summand of the formula calculates the required investment expenses to install additional power output capacity and storage content capacity to storage technologies for every member of the set storage tuples ( \(\forall s_{vc} \in S_{vc}\)). This summand consists of two products:
  • The first product calculates the required annual investment expenses to install an additional storage content capacity to a given storage tuple . This is calculated by the product of the variable new storage size ( \(\hat{\kappa}_{vs}^\text{c}\), cap_sto_c_new) and the parameter annualised storage size investment costs ( \(k_{vs}^\text{c,inv}\), m.storage.loc[s]['inv-cost-c'] * m.storage.loc[s]['annuity-factor']).
  • The second product calculates the required annual investment expenses to install an additional power output capacity to a given storage tuple. This is calculated by the product of the variable new storage power ( \(\hat{\kappa}_{vs}^\text{p}\), cap_sto_p_new) and the parameter annualised storage power investment costs ( \(k_{vs}^\text{p,inv}\), m.storage.loc[s]['inv-cost-p'] * m.storage.loc[s]['annuity-factor']).

These two products for a given storage tuple are than added up. The calculation of investment costs for a given storage tuple is than repeated for every single storage tuple and summed up to calculate the total investment costs for storage technologies. In mathematical notation this summand is expressed as:

\[\begin{split}\sum_{\substack{v \in V\\ s \in S}} ( \hat{\kappa}_{vs}^\text{c} k_{vs}^\text{c,inv} + \hat{\kappa}_{vs}^\text{p} k_{vs}^\text{p,inv})\end{split}\]
  1. The third and the last summand of the formula calculates the required investment expenses to install additional power capacity to transmission technologies for every member of the set transmission tuples \(\forall f_{ca} \in F_{ca}\). Total transmission investment cost for all transmission tuples is defined by the sum of all possible annual transmission investment costs, which are calculated seperately for each transmission tuple ( \(f_{ca}\)). Annual transmission investment cost for a given transmission tuple is calculated by the product of the variable new transmission capacity ( \(\hat{\kappa}_{af}\), cap_tra_new) and the parameter annualised transmission capacity investment costs ( \(k_{af}^\text{inv}\), m.transmission.loc[t]['inv-cost'] * m.transmission.loc[t]['annuity-factor']) for the given transmission tuple. In mathematical notation this summand is expressed as:
\[\begin{split}\sum_{\substack{a \in A\\ f \in F}} \hat{\kappa}_{af} k_{af}^\text{inv}\end{split}\]

As mentioned above the variable investment costs \(\zeta_\text{inv}\) is calculated by the sum of these 3 summands.

In script urbs.py the value of the total investment cost is calculated by the following code fragment:

if cost_type == 'Invest':
    return m.costs[cost_type] == \
        sum(m.cap_pro_new[p] *
            m.process.loc[p]['inv-cost'] *
            m.process.loc[p]['annuity-factor']
            for p in m.pro_tuples) + \
        sum(m.cap_tra_new[t] *
            m.transmission.loc[t]['inv-cost'] *
            m.transmission.loc[t]['annuity-factor']
            for t in m.tra_tuples) + \
        sum(m.cap_sto_p_new[s] *
            m.storage.loc[s]['inv-cost-p'] *
            m.storage.loc[s]['annuity-factor'] +
            m.cap_sto_c_new[s] *
            m.storage.loc[s]['inv-cost-c'] *
            m.storage.loc[s]['annuity-factor']
            for s in m.sto_tuples)

Fix Costs

The variable fix costs \(\zeta_\text{fix}\) represents the total annual fixed costs for all used storage, process and transmission technologies. The possible fix costs of an energy system in this model can be divided into sections, these are:

  1. Fix costs for process technologies
  2. Fix costs for storage technologies
  3. Fix costs for transmission technologies.

The calculation of total annual fix cost \(\zeta_\text{fix}\) is expressed by the formula:

\[\begin{split}\zeta_\text{fix} = \sum_{\substack{v \in V\\ p \in P}} \kappa_{vp} k_{vp}^\text{fix} + \sum_{\substack{v \in V\\ s \in S}} \left( \kappa_{vs}^\text{c} k_{vs}^\text{c,fix} + \kappa_{vs}^\text{p} k_{vs}^\text{p,fix} \right) + \sum_{\substack{a \in A\\ f \in F}} \kappa_{af} k_{af}^\text{fix}\end{split}\]

Total annual fix cost \(\zeta_\text{fix}\) is calculated by the sum of three main summands, these are the fix costs for process, storage and transmission technologies.

  1. The first summand of the formula calculates the required annual fix cost to keep all the process technologies maintained. This is calculated for every member of the set process tuples \(\forall p_v \in P_v\). Total process fix cost for all process tuples is defined by the sum of all possible annual process fix costs, which are calculated seperately for each process tuple ( \(p_v\), m.pro_tuples) consisting of process \(p\) in site \(v\). Annual process fix cost for a given process tuple is calculated by the product of the variable total process capacity ( \(\kappa_{vp}\), cap_pro) and process capacity fixed cost ( \(k_{vp}^\text{fix}\), m.process.loc[p]['fix-cost']). In mathematical notation this summand is expressed as:
\[\begin{split}\sum_{\substack{v \in V\\ p \in P}} \kappa_{vp} k_{vp}^\text{fix}\end{split}\]
  1. The second summand of the formula calculates the required fix expenses to keep the power capacity and storage content capacity of storage technologies maintained. The present storage technologies comprise the members of the set storage tuples \(\forall s_{vc} \in S_{vc}\). This summand consists of two products:
  • The first product calculates the required annual fix expenses to keep the storage content capacity of a given storage tuple maintained. This is calculated by the product of the variable total storage size ( \(\kappa_{vs}^\text{c}\), cap_sto_c) and the parameter annual storage size fixed costs ( \(k_{vs}^\text{c,fix}\), m.storage.loc[s]['fix-cost-c']).
  • The second product calculates the required annual fix expenses to keep the power capacity of a given storage tuple maintained. This is calculated by the product of the variable total storage power ( \(\kappa_{vs}^\text{p}\), cap_sto_p) and the parameter annual storage power fixed costs (\(k_{vs}^\text{p,fix}\), m.storage.loc[s]['fix-cost-p']).

These two products for a given storage tuple are than added up. The calculation of fix costs for a storage tuple is then repeated for every single storage tuple and summed up to calculate the total fix costs for storage technologies. In mathematical notation this summand is expressed as:

\[\begin{split}\sum_{\substack{v \in V\\ s \in S}} (\kappa_{vs}^\text{c} k_{vs}^\text{c,fix} + \kappa_{vs}^\text{p} k_{vs}^\text{p,fix})\end{split}\]
  1. The third and the last summand of the formula calculates the required fix expenses to keep the power capacity of transmission technologies maintained. The transmission technologies comprise the members of the set transmission tuples \(\forall f_{ca} \in F_{ca}\). Total transmission fix cost for all transmission tuples is defined by the sum of all possible annual transmission fix costs, which are calculated seperately for each transmission tuple \(f_{ca}\). Annual transmission fix cost for a given transmission tuple is calculated by the product of the variable total transmission capacity ( \(\kappa_{af}\), cap_tra) and the parameter annual transmission capacity fixed costs ( \(k_{af}^\text{fix}\), m.transmission.loc[t]['fix-cost']) for the given transmission tuple \(f_{ca}\). In mathematical notation this summand is expressed as:
\[\begin{split}\sum_{\substack{a \in A\\ f \in F}} \kappa_{af} k_{af}^\text{fix}\end{split}\]

As mentioned above, the fix costs \(\zeta_\text{fix}\) are calculated by the sum of these 3 summands.

In script urbs.py the value of the total fix cost is calculated by the following code fragment:

elif cost_type == 'Fixed':
    return m.costs[cost_type] == \
        sum(m.cap_pro[p] * m.process.loc[p]['fix-cost']
            for p in m.pro_tuples) + \
        sum(m.cap_tra[t] * m.transmission.loc[t]['fix-cost']
            for t in m.tra_tuples) + \
        sum(m.cap_sto_p[s] * m.storage.loc[s]['fix-cost-p'] +
            m.cap_sto_c[s] * m.storage.loc[s]['fix-cost-c']
            for s in m.sto_tuples)

Variable Costs

\[\begin{split}\zeta_\text{var} = w \sum_{t \in T_\text{m}} &\left( \sum_{\substack{v \in V\\ p \in P}} \tau_{vpt} k_{vp}^\text{var} \Delta t + \sum_{\substack{a \in a\\ f \in F}} \pi_{af}^\text{in} k_{af}^\text{var} \Delta t + \right.\nonumber \\ &\left.\phantom{\Big(} % invisible left parenthesis for horizontal alignment \sum_{\substack{v \in V\\ s \in S}} \left[ \epsilon_{vst}^\text{con} k_{vs}^\text{c,var} + \left( \epsilon_{vst}^\text{in} + \epsilon_{vst}^\text{out} \right) k_{vs}^\text{p,var} \Delta t \right] \right)\end{split}\]
elif cost_type == 'Variable':
    return m.costs[cost_type] == \
        sum(m.tau_pro[(tm,) + p] * m.dt *
            m.process.loc[p]['var-cost'] *
            m.weight
            for tm in m.tm
            for p in m.pro_tuples) + \
        sum(m.e_tra_in[(tm,) + t] * m.dt *
            m.transmission.loc[t]['var-cost'] *
            m.weight
            for tm in m.tm
            for t in m.tra_tuples) + \
        sum(m.e_sto_con[(tm,) + s] *
            m.storage.loc[s]['var-cost-c'] * m.weight +
            (m.e_sto_in[(tm,) + s] + m.e_sto_out[(tm,) + s]) * m.dt *
            m.storage.loc[s]['var-cost-p'] * m.weight
            for tm in m.tm
            for s in m.sto_tuples)

Fuel Costs

The variable fuel costs \(\zeta_\text{fuel}\) represents the total annual expenses that are required to be made to buy stock commodities \(c \in C_\text{stock}\). The calculation of the variable total annual fuel cost \(\zeta_\text{fuel}\) is expressed by the following mathematical notation:

\[\zeta_\text{fuel} = w \sum_{t\in T_\text{m}} \sum_{v \in V} \sum_{c \in C_\text{stock}} \rho_{vct} k_{vc}^\text{fuel} \Delta t\]

The variable \(\zeta_\text{fuel}\) is calculated by the sum of all possible annual fuel costs, defined by the combinations of commodity tuples of commodity type ‘Stock’( \(\forall c_{vq} \in C_{vq} \land q = \text{'Stock'}\)) and timesteps( \(\forall t \in T_m\)). These annual fuel costs are calculated by the product of the following elements:

  • The parameter stock commodity fuel cost for a given stock commodity \(c\) in a site \(v\).( \(k_{vc}^\text{fuel}\), m.commodity.loc[c]['price'])
  • The variable stock commodity source term for a given stock commodity \(c\) in a site \(v\) at a timestep \(t\).( \(\rho_{vct}\), e_co_stock)
  • The variable timestep duration.( \(\Delta t\), dt)
  • The variable weight.( \(w\), weight)

In script urbs.py the value of the total fuel cost is calculated by the following code fragment:

elif cost_type == 'Fuel':
    return m.costs[cost_type] == sum(
        m.e_co_stock[(tm,) + c] * m.dt *
        m.commodity.loc[c]['price'] *
        m.weight
        for tm in m.tm for c in m.com_tuples
        if c[1] in m.com_stock)

Revenue Costs

The variable revenue costs \(\zeta_\text{rev}\) represents the total annual expenses that are required to be made to sell sell commodities \(c \in C_\text{sell}\). The calculation of the variable total annual revenue cost \(\zeta_\text{rev}\) is expressed by the following mathematical notation:

\[\zeta_\text{rev} = -w \sum_{t\in T_\text{m}} \sum_{v \in V} \sum_{c \in C_\text{sell}} \varrho_{vct} k_{vct}^\text{bs} \Delta t\]

The variable \(\zeta_\text{rev}\) is calculated by the sum of all possible annual revenue costs, defined by the combinations of commodity tuples of commodity type ‘Sell’( \(\forall c_{vq} \in C_{vq} \land q = \text{'Sell'}\)) and timesteps (\(\forall t \in T_m\)). These annual revenue costs are calculated by the product of the following elements:

  • The parameter sell commodity sell cost for given sell commodity \(c\) in a site \(v\).( \(k_{vct}^\text{bs}\), com_prices[c].loc[tm] )
  • The variable sell commodity source term for a given sell commodity \(c\) in a site \(v\) at a timestep \(t\).( \(\varrho_{vct}\), e_co_sell)
  • The variable timestep duration.( \(\Delta t\), dt)
  • The variable weight.( \(w\), weight)
  • Coefficient [-1].

Since this variable is an income for the energy system, it is multiplied by the value -1 to be able to express it in the cost function as a summand. In script urbs.py the value of the total revenue cost is calculated by the following code fragment:

elif cost_type == 'Revenue':
    sell_tuples = commodity_subset(m.com_tuples, m.com_sell)
    com_prices = get_com_price(m, sell_tuples)

    return m.costs[cost_type] == -sum(
        m.e_co_sell[(tm,) + c] *
        com_prices[c].loc[tm] *
        m.weight * m.dt
        for tm in m.tm
        for c in sell_tuples)

Purchase Costs

The variable purchase costs \(\zeta_\text{pur}\) represents the total annual expenses that are required to be made to purchase buy commodities \(c \in C_\text{buy}\). The calculation of the variable total annual purchase cost \(\zeta_\text{pur}\) is expressed by the following mathematical notation:

\[\zeta_\text{pur} = w \sum_{t\in T_\text{m}} \sum_{v \in V} \sum_{c \in C_\text{buy}} \psi_{vct} k_{vct}^\text{bs} \Delta t\]

The variable \(\zeta_\text{pur}\) is calculated by the sum of all possible annual purchase costs, defined by the combinations of commodity tuples of commodity type ‘Buy’( \(\forall c_{vq} \in C_{vq} \land q = \text{'Buy'}\)) and timesteps (\(\forall t \in T_m\)). These annual purchase costs are calculated by the product of the following elements:

  • The parameter buy commodity buy cost for a given buy commodity \(c\) in a site \(v\). ( \(k_{vct}^\text{bs}\), com_prices[c].loc[tm] )
  • The variable buy commodity source term for a given buy commodity \(c\) in a site \(v\) at a timestep \(t\).( \(\psi_{vct}\), e_co_buy)
  • The variable timestep duration.( \(\Delta t\), dt)
  • The variable weight.( \(w\), weight)

In script urbs.py the value of the total purchase cost is calculated by the following code fragment:

elif cost_type == 'Purchase':
    buy_tuples = commodity_subset(m.com_tuples, m.com_buy)
    com_prices = get_com_price(m, buy_tuples)

    return m.costs[cost_type] == sum(
        m.e_co_buy[(tm,) + c] *
        com_prices[c].loc[tm] *
        m.weight * m.dt
        for tm in m.tm
        for c in buy_tuples)

Startup Costs

The variable startup costs \(\zeta_\text{startup}\) represents the total annual expenses that are required for the startup occurences of processes with the partial & startup feature activated. The calculation of the total annual startup costs is expressed by the following mathematical notation:

\[\zeta_\text{startup} = w \sum_{t\in T_\text{m}} \sum_{v \in V} \sum_{p \in P} \phi_{vpt} k_{vp}^\text{st} \Delta t\]

In script urbs.py the value of the total startup cost is calculated by the following code fragment:

elif cost_type == 'Startup':
    return m.costs[cost_type] == sum(
        m.startup_pro[(tm,) + p] *
        m.process.loc[p]['startup-cost'] *
        m.weight * m.dt
        for tm in m.tm
        for p in m.pro_partial_tuples)

Environmental Costs

Environmental costs \(\zeta_\text{env}\) represent the total annual taxes for created emissions/pollutions in form of environmental commodities. The total annual costs are calculated by summing the negative commodity balance \(\textrm{CB}\) of all environmental commodities, multiplied by their respective price

\[\zeta_\text{env} = - w \sum_{t\in T_\text{m}} \sum_{v\in V} \sum_{c \in C_\text{env}} \textrm{CB}(v,c,t) \Delta t\]

In script urbs.py the value of the total environmental cost is calculated by the following code fragment:

elif cost_type == 'Environmental':
    return m.costs[cost_type] == sum(
        - commodity_balance(m, tm, sit, com) *
        m.weight * m.dt *
        m.commodity.loc[sit, com, com_type]['price']
        for tm in m.tm
        for sit, com, com_type in m.com_tuples
        if com in m.com_env)