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 add_out/add_cap variables to results object #58

Closed
c-moeller opened this Issue Jan 21, 2016 · 26 comments

Comments

Projects
None yet
6 participants
@c-moeller
Copy link
Member

c-moeller commented Jan 21, 2016

@gnn Can you add these variables to the results object?

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented Jan 21, 2016

+1

@uvchik uvchik added this to the January 2016 Release milestone Jan 21, 2016

@uvchik uvchik added urgent bug and removed enhancement labels Jan 22, 2016

@c-moeller

This comment has been minimized.

Copy link
Member Author

c-moeller commented Jan 22, 2016

and total costs as the objective value would be great

@c-moeller

This comment has been minimized.

Copy link
Member Author

c-moeller commented Jan 22, 2016

... or the relevant objective value if not cost optimization is chosen.

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 23, 2016

I pushed a few changes on the fixes/58 branch, which hopefully fix this issue.
Could you both please test whether it works? You can access the attributes on the results as follows:
Suppose that a_particular_storage holds the storage object you are interested in, then results[a_particular_storage].add_cap should give you what you want.

For the objective value, I don't know where to get this after a successful solph run. Could you please tell me where the objective value is located after optimization, @simonhilpert ? Probably somewhere on the optimization model, but I guess its faster to ask you then to search around.

@simnh

This comment has been minimized.

Copy link
Member

simnh commented Jan 24, 2016

you can get this via two (or even more ways) different ways:

# first 
obj_value = om.objective()

#second 
obj_value =om.objective.value()

I like the second one...

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 24, 2016

Muchas gracias. Interesting. I'd prefer the first one.
I simply added the objective attribute to the results dictionary so everybody can choose his or her preferred method.
The desired features should be there now. Please test them out.

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented Jan 25, 2016

@caro-rli will not be here this week, may you merge this anyway?

@ckaldemeyer

This comment has been minimized.

Copy link
Member

ckaldemeyer commented Jan 25, 2016

Should we adapt the dataframe creation, too? I guess this would only be consistent

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented Jan 25, 2016

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 25, 2016

@ckaldemeyer sure thing. I still think in the long run the dataframe and the results object should become one anyway if it's possible.
@uvchik yeah, I'm gonna merge it, but I want to check that it works as expected beforehand. I'm currently running the storage_invest.py example for this purpose. How long does that take usually? I'm ~4h into it.

@ckaldemeyer

This comment has been minimized.

Copy link
Member

ckaldemeyer commented Jan 26, 2016

Allright. I'll wait until Martin has merged back into features/outputlib-imprivements, add my changes and merge into dev

@gnn : Yep. Maybe we can have a look at it in the remaster-session in February!

@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented Jan 26, 2016

@gnn : The storage invest example? The first plot appears after about 35 seconds. Just tried it on the fix/58 branch.

It will take 4 hours on the following OS 😏

arrow-down

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 28, 2016

Interesting. Seems to hang for me with glpsol hogging the CPU. examples/storage_optimization/storage_invest.py is the correct file to run though, right?

@simnh

This comment has been minimized.

Copy link
Member

simnh commented Jan 29, 2016

Is this something that will be fixed / merged today or do we set the milestone to february?

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 29, 2016

I'm on it. Finally got the thing to run with the cbc solver and can now check out whether my code works. So we can include this in the current release.

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 29, 2016

Sorry for the delay. It works now and can be merged to be part of the release.

@simnh

This comment has been minimized.

Copy link
Member

simnh commented Jan 29, 2016

ok, then just merge it into dev..I have some changes on an other feature branch that I will merge
and then we can release...

gnn added a commit that referenced this issue Jan 29, 2016

@gnn gnn assigned c-moeller and unassigned gnn Jan 29, 2016

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Jan 29, 2016

According to my tests it should work, but I don't know whether it works the way you expect it to work, @caro-rli . You can try it out and close the issue if you're satisfied, or tell us how to change it otherwise.
If you don't know how to get at the attributes you want, check out the documentation for the results attribute/method on the EnergySystem and OptimizationModel classes respectively.

@cswh

This comment has been minimized.

Copy link
Contributor

cswh commented Mar 3, 2016

@caro-rli: did it work out? if so, please close this issue. if not, just post an update on the matter.

@cswh cswh modified the milestones: March 2016 Release, February 2016 release Mar 3, 2016

@c-moeller

This comment has been minimized.

Copy link
Member Author

c-moeller commented Mar 7, 2016

Ok, I finally tested it and it works for me for the objective and the storage capacity with

print(energysystem.results.objective)
print(energysystem.results[storage].add_cap)

But I have problems with the pv and wind components.

print(energysystem.results[pv].add_out)
print(energysystem.results[wind].add_out)

produces an error

AttributeError: 'UserDict' object has no attribute 'add_out'

And

print(energysystem.results[storage].add_out)

gives me "None". Shouldn't this be the maximum output power of the storage?

@gnn I tried to understand what you did in 863aa1b as described in #74 but this might be only concerned to the objective.

@gnn gnn assigned gnn and unassigned c-moeller Apr 4, 2016

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Apr 4, 2016

Hm. I don't really know whether I addressed add_out. Gotta check. Shouldn't take too long though, so definitely before the April release.

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Apr 28, 2016

Man how fast 24 days pass. Gonna check this out today.

@gnn

This comment has been minimized.

Copy link
Member

gnn commented Apr 28, 2016

Ok. This will definitely take a little bit longer to figure out. I actually did cater for add_out when I first tried to fix this issue. So getting getting "None" for print(energysystem.results[storage].add_out) really shouldn't happen. I'll have to track down where that comes from.

@gnn gnn modified the milestones: May 2016: v0.1.0, April 2016 release Apr 28, 2016

@c-moeller

This comment has been minimized.

Copy link
Member Author

c-moeller commented May 3, 2016

There might be a relation to the problem I mentioned in #149

The last value "energysystem.results[storage].add_cap" somehow can't be addressed when I restore a dumped energy system.

But this is somehow only the case for the storage capacity. The objective for example can be addressed also with a restored energy system.

This is the error message I get:

Traceback (most recent call last):
  File "/home/caro/rlihome/Git/oemof/examples/storage_optimization/storage_invest.py", line 196, in <module>
    print(energysystem.results[storage].add_cap)
  File "/usr/lib/python3.4/collections/__init__.py", line 908, in __getitem__
    raise KeyError(key)
KeyError: <oemof.core.network.entities.components.transformers.Storage object at 0x7f9652357eb8>
@uvchik

This comment has been minimized.

Copy link
Member

uvchik commented Oct 24, 2016

@caro-rli , @gnn Is this still valid for the v0.1 release branch or was it an issue related to the old solph version?

@c-moeller

This comment has been minimized.

Copy link
Member Author

c-moeller commented Oct 31, 2016

I suppose this had been solved. Seems to work now like this:

energysystem.results[component][bus].invest

@c-moeller c-moeller closed this Oct 31, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment