Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tsam to datapackage #141

Draft
wants to merge 24 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
856a126
Merge branch 'dev' into features/add-tsam-to-datapackage
nailend Nov 10, 2023
a6481b9
Add tsam to reading module
nailend Nov 10, 2023
dc78863
Add tsam multi-period example
nailend Nov 10, 2023
bb0a97a
Remove timesteps from tsa_parameters
nailend Dec 4, 2023
268f940
Adjust timeseries data for tsam example
nailend Dec 4, 2023
8b16116
Remove timeindex.csv
nailend Dec 4, 2023
5fc423e
Add changelog entry
nailend Dec 4, 2023
ae5f159
Remove timeindex.csv from datapackage.json
nailend Dec 4, 2023
21b0159
Add tsam resource to infer_metadata
nailend Dec 4, 2023
5567933
Merge branch 'dev' into features/add-tsam-to-datapackage
nailend Dec 4, 2023
054ade0
Merge branch 'dev' into features/add-tsam-to-datapackage
nailend Dec 5, 2023
87afb28
Add further exceptions for not converted periodic values
nailend Dec 11, 2023
447546f
Make lifetime parameter a constant value
nailend Dec 11, 2023
32dc918
Raise error if length mismatches periods or index
nailend Dec 11, 2023
c6fddca
Merge branch 'features/add-tsam-to-datapackage' of github.com:oemof/o…
nailend Dec 11, 2023
1345f7b
tsam period order 2-0
FelixMau Jan 23, 2024
d84168b
Solph dependency
FelixMau Jan 23, 2024
cb8d058
Sepcify oemof.solph and oemof.network
FelixMau Jan 23, 2024
4bcbfb0
Solph dependency
FelixMau Jan 23, 2024
a7e9548
Merge remote-tracking branch 'origin/features/add-tsam-to-datapackage…
FelixMau Jan 31, 2024
7034337
Merge branch 'dev' into features/add-tsam-to-datapackage
FelixMau Feb 7, 2024
11c432c
Linting
FelixMau Feb 7, 2024
99681e4
Add option to set up TSAM Model without multi period mode
henhuy Apr 15, 2024
8c9fcc0
Read TSAM parameters for all timeindex options
henhuy Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions src/oemof/tabular/datapackage/reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,44 @@ def create_yearly_values(values, years):
else:
# look for periods resource and if present, take periods from it
if package.get_resource("periods"):
es = cls(
timeindex=period_data["timeindex"],
timeincrement=period_data["timeincrement"],
periods=period_data["periods"],
infer_last_interval=False,
)
# look for tsa_parameters resource and if present, get
# tsa_parameters from it
# currently only works for multi-period
if package.get_resource("tsa_parameters"):
df_tsa_parameters = pd.DataFrame.from_dict(
package.get_resource("tsa_parameters").read(keyed=True)
).set_index("period", drop=True)

df_timeindex = pd.DataFrame.from_dict(
package.get_resource("timeindex").read(keyed=True)
)
tsa_parameters = []
for p, data in df_tsa_parameters.sort_index().iterrows():
tsa_parameters.append(
{
"timesteps_per_period": data[
"timesteps_per_period"
],
"order": data["order"],
"timeindex": pd.to_datetime(
df_timeindex.loc[:, f"period_{p}"].values
),
}
)
es = cls(
timeindex=period_data["timeindex"],
timeincrement=period_data["timeincrement"],
periods=period_data["periods"],
tsa_parameters=tsa_parameters,
infer_last_interval=False,
)
else:
es = cls(
timeindex=period_data["timeindex"],
timeincrement=period_data["timeincrement"],
periods=period_data["periods"],
infer_last_interval=False,
)

# if lst is not empty
elif lst:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Dispatch example for oemof-tabular

Run `scripts/infer.py` from the datapackage root directory to add the
meta data file `datapackage.json` after updating the resources of the
datapackage.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name;type;balanced
bus0;bus;true
bus1;bus;true
heat-bus;bus;false
gas-bus;bus;false
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name;type;carrier;tech;capacity;bus;marginal_cost;profile;output_parameters
gas;dispatchable;gas;gt;100;bus1;40;1;{"full_load_time_max": 2000}
coal;dispatchable;coal;st;100;bus0;40;1;{}
lignite;dispatchable;lignite;st;50;bus0;20;1;{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name;type;capacity;capacity_cost;loss;from_bus;to_bus
conn1;link;100;10;0.05;bus0;bus1
conn2;link;10;0;0.05;heat-bus;gas-bus
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name;amount;profile;type;bus
demand0;5000;electricity-load-profile;load;bus0
demand1;1000;electricity-load-profile;load;bus1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name,carrier,tech,storage_capacity,capacity,capacity_cost,storage_capacity_initial,type,bus
el-storage1,lithium,battery,100,10,10,0.5,storage,bus0
el-storage2,lithium,battery,200,20,15,0.2,storage,bus0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name;type;carrier;tech;capacity;capacity_cost;bus;marginal_cost;profile;output_parameters
wind;volatile;wind;onshore;50;;bus0;0;wind-profile;{}
pv;volatile;solar;pv;20;;bus1;0;pv-profile;{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
timeindex;periods;timeincrement
2011-01-01T00:00:00Z;0;1
2011-01-01T01:00:00Z;0;1
2011-01-01T02:00:00Z;0;1
2011-01-01T03:00:00Z;0;1
2035-01-01T00:00:00Z;1;1
2035-01-01T01:00:00Z;1;1
2035-01-01T02:00:00Z;1;1
2035-01-01T03:00:00Z;1;1
2050-01-01T00:00:00Z;2;1
2050-01-01T01:00:00Z;2;1
2050-01-01T02:00:00Z;2;1
2050-01-01T03:00:00Z;2;1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
timeindex;electricity-load-profile
2011-01-01T00:00:00Z;0.000745659236
2011-01-01T01:00:00Z;0.000709651546
2011-01-01T02:00:00Z;0.00068564642
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
timeindex;wind-profile;pv-profile
2011-01-01T00:00:00Z;0.147532;0
2011-01-01T01:00:00Z;0.184181;0
2011-01-01T02:00:00Z;0.223937;0
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
period_0;period_1;period_2
2011-01-01T00:00:00Z;2035-01-01T00:00:00Z;2050-01-01T00:00:00Z
2011-01-01T01:00:00Z;2035-01-01T01:00:00Z;2050-01-01T01:00:00Z
2011-01-01T02:00:00Z;2035-01-01T02:00:00Z;2050-01-01T02:00:00Z
2011-01-01T03:00:00Z;2035-01-01T03:00:00Z;2050-01-01T03:00:00Z
2011-01-01T04:00:00Z;2035-01-01T04:00:00Z;2050-01-01T04:00:00Z
2011-01-01T05:00:00Z;2035-01-01T05:00:00Z;2050-01-01T05:00:00Z
2011-01-01T06:00:00Z;2035-01-01T06:00:00Z;2050-01-01T06:00:00Z
2011-01-01T07:00:00Z;2035-01-01T07:00:00Z;2050-01-01T07:00:00Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
period;timesteps_per_period; order
0; 2; [0, 1, 1, 0]
1; 2; [0, 1, 1, 1]
2; 2; [0, 0, 1, 2]
Loading
Loading