Breakthrough-Energy / SwitchWrapper

Wrapper for Switch
MIT License
1 stars 2 forks source link

Get time series of results #50

Closed rouille closed 3 years ago

rouille commented 3 years ago

Build data frames:

danielolsen commented 3 years ago

102 should help us extract storage dispatch. It looks like storage energy (our STORAGE_E) is in keys that start with StateOfCharge, and birectional storage dispatch can be constructed using the values in DispatchGen (for positive STORAGE_PG) and ChargeStorage (for negative STORAGE_PG).

Here's what I get when parsing the results file from @YifanLi86's example storage run:

>>> import pickle
>>> import re
>>> from switchwrapper.switch_to_grid import construct_grids_from_switch_results
>>> filename = "path_to_storage_results_file/results_storage.pickle"
>>> with open(filename, "rb") as f:
...     results = pickle.load(f)
... 
>>> sorted({re.search(r"(.*)\[", v).group(1) for v in results.solution._list[0]["Variable"]})
['BuildGen', 'BuildLocalTD', 'BuildStorageEnergy', 'BuildTx', 'ChargeStorage', 'DispatchBaseloadByPeriod', 'DispatchGen', 'DispatchTx', 'GenFuelUseRate', 'StateOfCharge', 'UnservedLoad', 'WithdrawFromCentralGrid']