A simple EV (ex. 52)
Overview
The relevant section of the top-level YAML looks like this:
components:
# ... other stuff ...
# NOTE: This could be a `Unit` instead, to allow more complex behaviours.
# This assumes a rated power of "40 kW" and only allows charging while the EV is actually connected.
charger:
type: Connection
node_from: grid
node_to: ev
loss: 0.05
lb: 0
ub: 40.0 * connected@data
ev:
type: Node
carrier: electricity
has_state: true
state_lb: 0
state_ub: 100
ev_demand:
type: Profile
carrier: electricity
node_from: ev
value: demand@data
This models the EV as a storage that is sometimes connected to the grid - if it is, with a maximum power of 40 kW. The EV has a state of charge that can vary between 0 and 100 kWh. The demand of the EV is given by the ev_demand
profile and taken out of the storage. Check the config file as well as the data file for more details.
Running the example
First, import iesopt
.
import iesopt
Then, create a local copy of the IESopt example.
config = iesopt.make_example("52_simple_ev", "opt")
INFO:iesopt:Data folder for examples does not exist; creating it, and copying contents
INFO:iesopt:Creating example ('52_simple_ev') at: 'opt/52_simple_ev.iesopt.yaml'
INFO:iesopt:Set write permissions for example ('opt/52_simple_ev.iesopt.yaml'), and data folder ('opt/files')
Finally, run the model and observe some results.
model = iesopt.run(config, config={"general.verbosity.core": "error"})
model.results.to_pandas().query(
"component == 'ev' and field == 'state' and mode == 'primal'"
)
snapshot | component | fieldtype | field | value | mode | |
---|---|---|---|---|---|---|
169 | t1 | ev | var | state | 55.0 | primal |
170 | t2 | ev | var | state | 55.0 | primal |
171 | t3 | ev | var | state | 55.0 | primal |
172 | t4 | ev | var | state | 55.0 | primal |
173 | t5 | ev | var | state | 55.0 | primal |
174 | t6 | ev | var | state | 55.0 | primal |
175 | t7 | ev | var | state | 55.0 | primal |
176 | t8 | ev | var | state | 50.0 | primal |
177 | t9 | ev | var | state | 45.0 | primal |
178 | t10 | ev | var | state | 40.0 | primal |
179 | t11 | ev | var | state | 35.0 | primal |
180 | t12 | ev | var | state | 30.0 | primal |
181 | t13 | ev | var | state | 25.0 | primal |
182 | t14 | ev | var | state | 20.0 | primal |
183 | t15 | ev | var | state | 15.0 | primal |
184 | t16 | ev | var | state | 10.0 | primal |
185 | t17 | ev | var | state | 5.0 | primal |
186 | t18 | ev | var | state | -0.0 | primal |
187 | t19 | ev | var | state | 17.0 | primal |
188 | t20 | ev | var | state | 17.0 | primal |
189 | t21 | ev | var | state | 17.0 | primal |
190 | t22 | ev | var | state | 17.0 | primal |
191 | t23 | ev | var | state | 17.0 | primal |
192 | t24 | ev | var | state | 17.0 | primal |