Reformulating a simple cost function - combining 2 variables

  • Thread starter bradyj7
  • Start date
  • #1
122
0
Hi there,

I have an equation below for the cost of energy for a house per hour. The house has an energy storage system (i.e.a very large battery) installed. You can charge the battery up and energy from the battery can be used to power the building. For example you can charge the battery when electricity prices are low and then you can use the energy in the battery to supply energy to the building when electricity prices are high so that the building does not have to purchase electricity at expensive times.

The equation is written in terms of the price of electricity, the energy consumed, efficiency constant and the variables energy_in and energy_out of the battery.

c(t) = Price(t) * (Energy_consumed(t) - eff*Energy_out + (1/eff)*Energy_out)

In a single hour energy can only enter of or be discharged from the battery. Therefore, when energy_in is positive, energy_out will always be zero and vice versa. You'll notice that this equation is written in terms of energy_in and energy_out, both variables can only be positive.

My question is as follows: I'd like to reformulate the equation to be only written in terms of the variable "energy" instead of as it is currently with energy_in and nergy_out. The new variable will be >0 when energy is discharged (out) and <0 when it is charged (in).

I was hoping if somebody could tell me if this possible?

Thank you for reading this.

Sincerely
 

Answers and Replies

  • #2
34,688
6,394
Hi there,

I have an equation below for the cost of energy for a house per hour. The house has an energy storage system (i.e.a very large battery) installed. You can charge the battery up and energy from the battery can be used to power the building. For example you can charge the battery when electricity prices are low and then you can use the energy in the battery to supply energy to the building when electricity prices are high so that the building does not have to purchase electricity at expensive times.

The equation is written in terms of the price of electricity, the energy consumed, efficiency constant and the variables energy_in and energy_out of the battery.

c(t) = Price(t) * (Energy_consumed(t) - eff*Energy_out + (1/eff)*Energy_out)

In a single hour energy can only enter of or be discharged from the battery. Therefore, when energy_in is positive, energy_out will always be zero and vice versa. You'll notice that this equation is written in terms of energy_in and energy_out, both variables can only be positive.

My question is as follows: I'd like to reformulate the equation to be only written in terms of the variable "energy" instead of as it is currently with energy_in and energy_out. The new variable will be >0 when energy is discharged (out) and <0 when it is charged (in).

I was hoping if somebody could tell me if this possible?
Sure, you can write the definition of the function using cases.
$$c(t) = \begin{cases} \text{Price(t)} * (\text{E}_{\text{ext}}(t) -\text{eff} * \text{E}_{\text{batt}}) & \text{if E}_{\text{batt}} \ge 0 \\
\text{Price(t)} * (\text{E}_{\text{ext}}(t) + \frac 1 {\text{eff}} * \text{E}_{\text{batt}}) & \text{if E}_{\text{batt}} \lt 0 \end{cases}$$

For the sake of simplifying the equation, I replaced Energy_consumed by Eext, and Energy by Ebatt.
 

Related Threads on Reformulating a simple cost function - combining 2 variables

  • Last Post
Replies
10
Views
2K
Replies
21
Views
3K
Replies
5
Views
2K
Replies
1
Views
989
Replies
9
Views
1K
Replies
6
Views
934
Replies
1
Views
2K
Replies
9
Views
2K
Replies
9
Views
6K
Top