quintel / refinery

Calculates node demands and edge shares for sparse energy graphs.
2 stars 0 forks source link

Disable sub-sectors in Atlas+Refinery #53

Open wouterterlouw opened 10 years ago

wouterterlouw commented 10 years ago

In https://github.com/quintel/refinery/issues/52 the following was proposed to disable the Metal sub-sector.

I think a good compromise would be a hybrid of the two suggestions; keep the metal sub-sector nodes and edges, but set them all to zero. We could do this within Atlas+Refinery when you set - has_metal = false.

@antw Can you implement this?

wouterterlouw commented 10 years ago

@ChaelKruip Can you have a look on this issue and let us know if you approve with this approach?

ChaelKruip commented 10 years ago

@ChaelKruip Can you have a look on this issue and let us know if you approve with this approach?

:+1:

wouterterlouw commented 10 years ago

@antw What is the status of this issue?

antw commented 10 years ago

I have pushed Atlas and ETSource branches so that you can try out this feature for yourself; you need to use both together:

The ETSource branch moves the "metal" nodes into a new subdirectory: nodes/industry/metal so that we can differentiate them from other industry nodes. The Atlas branch introduces the behaviour that has_metal = false should disable nodes in the "industry.metal" sub-sector; we can make this more general – supporting other sub-sectors – if you like the implementation.

wouterterlouw commented 10 years ago

@antw Looks nice! :+1:

During testing I run into the following:

Refinery::IncalculableGraphError at /data/latest/area
Insufficient data to calculate 5 items: 

  * EdgeDemand for #<Refinery::Edge :industry_other_metals_burner_network_gas -:useable_heat-➤ :industry_other_metals_process_heat_useable_heat (type=flexible)>
  * NodeDemand for #<Refinery::Node key=:industry_other_metals_burner_network_gas>
  * EdgeDemand for #<Refinery::Edge :industry_other_metals_process_heat_useable_heat -:not_defined-➤ :industry_other_metals_production (type=)>
  * NodeDemand for #<Refinery::Node key=:industry_other_metals_process_heat_useable_heat>
  * NodeDemand for #<Refinery::Node key=:industry_other_metals_production>
antw commented 10 years ago

The metal industry has also some converters in the energy part of the graph

In which case I think we'll need something more flexible than placing the node files into subdirectories; perhaps we could create a new node group – "metal" – and use the has_metal = false setting to disable any node belonging to that group...

Running ETengine with the two branches [..] using the industry analysis without importing the metal industry data [..] gives the following error:

That suggests some nodes aren't being disabled, which is odd. I'll look into it now.

antw commented 10 years ago

I have pushed updated ETSource and Atlas branches. In ETSource I moved the metal nodes back into the main "industry" directory, and added them to a new "metal" group (and also the energy nodes listed above). Atlas has been updated so that has_metal = false disables nodes in that group.

As for the IncalculableGraphError, I think you forgot to set has_metal = false in the dataset files; the error is there when the value is true, and disappears when set to false.

wouterterlouw commented 10 years ago

@antw It looks like the ETsource branch is not updated yet...

antw commented 10 years ago

@wouterterlouw My bad; pushed.

wouterterlouw commented 10 years ago

@antw Thanks!

As for the IncalculableGraphError, I think you forgot to set has_metal = false in the dataset files; the error is there when the value is true, and disappears when set to false.

I think it has to do with the input efficiencies. The industry_other_metals_burner_network_gas does have three (?) different carriers as input. If I set all the shares in the metal industry to zero, the input efficiencies cannot be defined. You can have a look using the quintel/etsource@metal-subsector-updated-dataset branch.

ChaelKruip commented 10 years ago

Related: https://github.com/quintel/etsource/issues/326

antw commented 10 years ago

You can have a look using the quintel/etsource@metal-subsector-updated-dataset branch.

@wouterterlouw I can't seem to reproduce the incalculable graph when using this branch with the "disable-subsectors" Atlas branch. I can if I set has_metal to true, or if I run the rake debug task using the Atlas master branch.

Since your earlier post says that you tried this in ETEngine, that might explain the issue since ETE is linked to the Atlas master branch. If you want to try using a local copy of the "disable-subsectors" branch, you need to change the Gemfile in the ETEngine directory;

Remove this:

gem 'atlas', ref: '4885239', git: 'git@github.com:quintel/atlas.git'

Replace it with this:

gem 'atlas', path: 'path/to/your/atlas/clone'

Then run bundle.

wouterterlouw commented 10 years ago

@antw :+1: With the replacement in the Gemfile ETengine works fine!

wouterterlouw commented 10 years ago

@antw Can we merge this implementation or do you want to make it more general before?

@ChaelKruip What do you think?

antw commented 10 years ago

I would like to make it more general – so that it is possible to disable any node group without it having to be hard-coded in Atlas – but that will take a while longer, and will involve some tweaks to ETEngine also. I don't think it's a good idea doing that so close to EC2013, so how about we merge this as-is, and I'll improve it next week once the convention is over?