TulipaEnergy / TulipaIO.jl

Apache License 2.0
0 stars 3 forks source link

ESDL to JSON to Julia graph structure #1

Open suvayu opened 6 months ago

suvayu commented 6 months ago
clizbe commented 6 months ago

Related to: TulipaEnergy/TulipaEnergyModel.jl#89 TulipaEnergy/TulipaEnergyModel.jl#289

datejada commented 5 months ago

Comments from the workday meeting:

assets_data.csv

Tulipa ESDL
active state
peak_demand power
Tulipa ESDL Comment
active state
investable Ask to add it in ESDL
investment_cost asset.CostInformation.investmentCosts the unit doesn't match
variable_cost asset.CostInformation.variableOperationalAndMaintenanceCosts If there is no data, we put zero for the time being
lifetime TechnicalLifetime
investment_limit Potential? We need to include it in ESDL or try to use Potential property of the area
capacity power
initial_capacity There is no data in ESDL; ask to add it
Tulipa ESDL Comment
capacity maxDischargeRate and maxChargeRate Tulipa uses only one value, but might change it to consider both
initial_storage_level fillLevel ESDL uses p.u., Tulipa uses MW
energy_to_power_ratio ? Include in ESDL? or calculate it from the ratio of capacity (MWh)/maxDischargeRate (MW)
initial_storage_capacity capacity double-check the units ESDL uses J and we use MWh

The charging and discharging efficiencies are defined in the asset but must be mapped to the flow asset data.

flows_data.csv

is_transport: false, then get the efficiencies from the asset is_transport: true is similar to producers, but we need to create two new parameters: initial_import_capacity and initial_export_capacity instead of only the initial_capacity

datejada commented 5 months ago

@wcoenraads, we need to add data to the Norse Case Study from a random sample of one of our TNO databases. Could you help us with that?

wcoenraads commented 5 months ago

Sure! We need two things for this:

The first is pretty straightforward (I can provide examples). The second is also reasonably easy - if the database is InfluxDB I have some existing code we could use for this. Do you have specific data (or a specific database) in mind?

suvayu commented 5 months ago

Looks like there is no reliable Julia client for InfluxDB. @wcoenraads, I presume your existing code is in Python?

My questions:

wcoenraads commented 5 months ago

Oh true, it's Python. Shame that there's no library for Julia, in that case we'll indeed have to use the REST API. I have no experience using it, but it should be straightforward enough.

With regards to authentication, I believe many TNO databases (like the EDR) don't require a token - they are freely accessible from the TNO network. But that depends on the specific database you want to pull data from, and users outside of TNO would not be able to access those DBs anyway so we'll need to think about the situation there.

suvayu commented 5 months ago

Hmm, if the DBs are internal only, we need to find a way for eSci people to work with it during the development phase at least (VPN?).

@datejada @clizbe could you have a look? Either choose a DB without this restriction, or figure out if there's some paperwork to be done.

suvayu commented 5 months ago

Oh true, it's Python. Shame that there's no library for Julia, in that case we'll indeed have to use the REST API. I have no experience using it, but it should be straightforward enough.

I created an issue and assigned it to you. Please let me know if something is unclear.

lsoucasse commented 5 months ago

@suvayu: Attached an esdl file with some data for the tiny test case. This was created some time ago so I might have chosen some fields that are not in agreement with what we discussed last week. TinyTest.txt

clizbe commented 4 months ago

@lsoucasse Thanks! But this doesn't cover all the features in the table above. @wcoenraads I'll try making one, but can you also help with this?

clizbe commented 4 months ago

For "investable" - maybe that shouldn't be in ESDL, but rather a scenario parameter?

clizbe commented 4 months ago

Using this to track my progress updating the ESDL file:

Tulipa ESDL Comment Added to Norse ESDL
CONSUMERS
active state (ENABLED/DISABLED) X
peak_demand power X
:--------------- :---------- :---------- :------
PRODUCERS
active state X
investable Not in ESDL - add or have separate file?
investment_cost (kEUR/MW/year) asset.CostInformation.investmentCosts (EUR/MWh/yr) the unit doesn't match X
variable_cost asset.CostInformation.variableOperationalAndMaintenanceCosts If there is no data, we put zero for the time being X
lifetime TechnicalLifetime X
investment_limit Potential? Not in ESDL - add or have separate file or try to use Potential property of the area
capacity Not in ESDL - ask to add This is the upgrade increment when invested in
initial_capacity power X
:--------------- :---------- :---------- :------
CONVERSION
active state X
investment_cost (kEUR/MW/year) asset.CostInformation.investmentCosts (EUR/MWh/yr) the unit doesn't match X
variable_cost asset.CostInformation.variableOperationalAndMaintenanceCosts If there is no data, we put zero for the time being X
lifetime TechnicalLifetime X
investment_limit Potential? We need to include it in ESDL or try to use Potential property of the area
capacity Not in ESDL - ask to add This is the upgrade increment when invested in
initial_capacity power X
efficiency efficiency or InputOutputRelation * See below
:--------------- :---------- :---------- :------
STORAGE
active state X
investment_cost asset.CostInformation.investmentCosts the unit doesn't match X
variable_cost asset.CostInformation.variableOperationalAndMaintenanceCosts If there is no data, we put zero for the time being X
lifetime TechnicalLifetime X
investment_limit Potential? We need to include it in ESDL or try to use Potential property of the area
capacity Not in ESDL - ask to add This is the upgrade increment when invested in
capacity (charge/discharge) maxDischargeRate and maxChargeRate Tulipa uses only one value, but might change it to consider both ** X
initial_storage_level fillLevel ESDL uses p.u., Tulipa uses MW X
energy_to_power_ratio ? Include in ESDL? or calculate it from the ratio of capacity (MWh)/maxDischargeRate (MW)
initial_storage_capacity capacity double-check the units ESDL uses J and we use MWh X

*The efficiency from the asset goes to the outgoing flow. For assets connected to two carriers, then, we need two different efficiencies between the input and outputs; ESDL has electrical efficiency and heat efficiency (but not for all assets; we need to double-check), For heat pumps -> COP to efficiency and other conventions assets -> Efficiency to efficiency ** The charging and discharging efficiencies are defined in the asset but must be mapped to the flow asset data.

We can do multiple efficiencies using this InputOutputRelation feature. It doesn't exist yet in the MapEditor, but it's in ESDL and we can push for it to be added to the MapEditor:

Image

Image

clizbe commented 4 months ago

Things ESDL appears to be missing. We can either ask them to add these, or they should be in a different file:

clizbe commented 4 months ago

@suvayu Here's the new ESDL with as many features as I could include (see table above).

Norse Mythology.txt

suvayu commented 4 months ago

@datejada @clizbe I found an instance where merging the attributes from the "from" and "to" nodes has conflicts (see the norse mythology file, also in the repo):

ERROR: DomainError with Following fields have conflicting values:
┌──────────────────┬────────────┬───────────────┐
│           fields │ Waste heat │ HeatPump_4b33 │
├──────────────────┼────────────┼───────────────┤
│ initial_capacity │      100.0 │          10.0 │
│  investment_cost │       14.0 │          16.0 │
│    variable_cost │        2.0 │          15.0 │
└──────────────────┴────────────┴───────────────┘

Is this realistic? Any thoughts how to resolve this kind of conflicts?

suvayu commented 4 months ago
Type Tulipa ESDL
Storage capacity (charge/discharge) maxDischargeRate and maxChargeRate

@clizbe I'm not sure I understand this entry from the table. ESDL has two different rates, whereas Tulipa has one. How does that map?

clizbe commented 4 months ago

That's up for debate. We'll most likely change Tulipa to 2.

clizbe commented 4 months ago

@datejada @clizbe I found an instance where merging the attributes from the "from" and "to" nodes has conflicts (see the norse mythology file, also in the repo):

ERROR: DomainError with Following fields have conflicting values:
┌──────────────────┬────────────┬───────────────┐
│           fields │ Waste heat │ HeatPump_4b33 │
├──────────────────┼────────────┼───────────────┤
│ initial_capacity │      100.0 │          10.0 │
│  investment_cost │       14.0 │          16.0 │
│    variable_cost │        2.0 │          15.0 │
└──────────────────┴────────────┴───────────────┘

Is this realistic? Any thoughts how to resolve this kind of conflicts?

Ah this is just because I filled in random numbers. You guys said that was fine! Is it just a value conflict that doesn't make sense?

suvayu commented 4 months ago

Is it just a value conflict that doesn't make sense?

Yes. Basically the logic is:

This is mostly to be conservative yet reasonable. If the rubric above looks good, I'll just make the esdl file conformant and proceed.

suvayu commented 4 months ago

We'll most likely change Tulipa to 2.

In that case, for now I'll just pick one, and implement the other one but leave it commented out.

clizbe commented 2 months ago

Last step is testing with existing input flow.

abelsiqueira commented 2 months ago

Some comments on the ESDL/Tulipa compatibility were added here: https://github.com/TulipaEnergy/TulipaEnergyModel.jl/discussions/606