-
Notifications
You must be signed in to change notification settings - Fork 12
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
ValueError: Pipe id <built-in function id> already has an investment > 0! #66
Comments
I think in this early stages of the package, it is fine. By this direct user feedback, in many cases, we come to an issue or we might want to improve something else, like an additional warning or check. So, the optimization itself is running, right? The error is caused by the processing of results .. The thing is that the way you define the pipes, first, a small pipe is installed, because it is cheapest. Then, if the demand is > 27, the next cheapest pipe is installed, so DN32, and so on ... This way, for a single edge, multiple pipes are installed. That's why I put an error there, in my opinion it does not make sense to have multiple types for a single edge. And be aware, that the capex_pipes are defined per kW_installed. And isn't it the case that small DN numbers are more expensive per kW?! For now, you can still check and evaluate the "raw" oemof results then .. For the near future, a warning would be a good solution as well, and the processing of the results could be adapted for the case of multiple investments for each pipe. you can start a PR for that, if you want ... |
Thank you! Oh, I think there is a misunderstanding in what the pipes.csv should look like. Multiple pipe types should be different pipe manufactures rather than different sizes of pipes right? I thought an installed pipe-type replaces a previously assigned pipe-type! I think a small tutorial for an optimisation problem with multiple pipe types would be benefitial! |
Both is possible. You can use the pipes types table for discrete DN numbers, or piecewise linearized, and so on. You can also think of different manufacturer data ... this is up to the user. Be aware that each row creates an oemof-solph heatpipeline investment object for each edges of the network. That means that the mathematical problem will increase as well.
Yes, I also think this would help. Do you want to do that? 😉 |
"This way, for a single edge, multiple pipes are installed." > But shouldn't only one pipe type be installed ultimately even when I have multiple pipe types to choose from? I'll see if I can add an example when I have mine running correctly! |
At the moment, it is possible that there are multiple pipes "installed" per edges. There is no additional constraint, which forces only one investment for each edges. Maybe you think of a constraint like this:
This is not implemented. I think in 99 % of cases it is not economically better to install two small instead of one bigger pipe. This is why I think that such a constraint is not necessary. Maybe, we need to be more precise on what we mean by "installed": that the investment capacity of one of the oemof-solph heatpipeline options is > 0 after the optimisation. The oemof-solph heatpipeline components themselves exists for all types given.
Yeah sure, take your time, it would be very interesting! |
@FruitVul so, the acutal issue is solved for you? Then, I would close this issue. For your interest, there will be a DHNx seesion at the next oemof meeting, please see: https://github.com/oemof/oemof/wiki/Meeting-December-2020-%28online%29 you are welcome to join! |
@joroeder haven't solved it, but I think it's just a misunderstanding of how to use the invest/network/pipes.csv table. Maybe for you to clarify what I want to do: I want to have the network typology and diameters optimized for my dhn network on the basis of pipe parameters. I thought that I have to add all the available pipes to choose from to the pipes.csv, but from what you have said It seems to be the wrong way to go about this. |
@FruitVul Are you still working on that? In the pipes tables, you insert the coefficients for linearized function of the pipeline costs and pipeline thermal loss. You could have a look at https://journals.aau.dk/index.php/sepm/article/view/6248/5826, Figure 6, that shows an example for the linearization of the costs and losses. You could also add multiple rows to use a piecewise linearization. Or use a heatpipeline component for every DN number, as in your example above. This is up to the user. If you could provide a small example, that would also help. I agree that the input format might be confusing at the moment. I plan to add further pre-processing for the optimization, that might help. If you want you could support the development, I would be happy about feedback ... |
@joroeder yes I will eventually work on it again! Will update you when I find the time. Thanks! |
Hello @joroeder and @FruitVul, im facing the same error when running introduction.py. For understanding if "Optimize_Investment()" would also choose the cheapest pipe when creating a thermal network i added a second Pipe with lower capex and (much) lower cap_max resulting in the same warning as @FruitVul had. Thank you for the suggestion of the paper - DHNx, as well as the cost-linearisation is much clearer to me now. Still I don't understand how to solve the problem that, that Optimize_Investment() not only chooses the route of the network , but also decides between different pipe types the DN that is cheapest but still allowing sufficient heat supply. I would expect an output maybe like in the example provided (introduction.py), where not only pipe-type-A is chosen as a hp-type but also other options are possible corresponding to the chosen DN for each pipe. I was thinking what you could mean by your suggestion of "use a heatpipeline component for every DN number, as in your example above", but it was hard for me to find an answer/solution..could you maybe elaborate a bit more what you mean by that? Or maybe you found a different approach ? Im currently writing my masterthesis about rural district heating networks and would like to use DHNx for the optimization of the network design. I just started to find my way through DHNx and its possibilities - still i would be very happy to contribute to further development. Thank you and kind regards Luise |
Could you provide the input data and script? So long, you could proceed with one-segement linearization as provided in the example or paper (so just use one line in the pipes data table: here ). I think the solving time is much shorter than providing specific DN numbers, or multiple segments. Especially in large networks, a more detailed segmentation would lead to long calculation times. And I also think that the results do not largly change. from the resulting capacities (which have the unit thermal power), you need to back-calculate to a DN number with your assumptions about temperature spread and specific pressure drop, you use as design criterion. We are at the moment adding some pre-calculation, this might also be interesting .. see #83 #82 |
Thank you for your comment! Yes, that would be great. Contributions are welcome. And also by using and testing the tool, errors might be detected and the process will be improved. |
Thank you for answering so fast: I think i get your point and it makes sense to me. I refered to the provided investment_optimization/introduction example provided here. I used its input data about "twn" and "investment". I invested some time into understanding the results of the mentioned example (in its original version, no changes added). Attached I'm providing you the .xlsx doc - maybe its helping someone whos facing similar questions. Thanks for the hint to use the capacity as a base for choosing the pipe-types (DN) that sufficient for the transportation of the heat - I wasnt considering that. I will keep on working on an approach to use deltaT, approved velocity range corresponding to inner diameter,... to get back the cheapest/smallest, but technically feasible pipes to meet the heatdemand of the consumers. I will keep you updated when i have results! |
I tested a segment-wise and a discrete pipes table with the example introduction and it worked. Also an example with 2-segments worked. Please find attached the two pipes.csv parameter tables. I further added an excel sheet with the pipeline data, which is the basis. Maybe, this makes things more clear. Everybody must think himself about the thermal capacities for each DN number, which is the reference basis for the costs and losses, this is not part of DHNx yet, but will be added as mentioned above. |
Hello everyone, since this Issue was already used to discuss the optimization of the network, I am wondering if somebody could help me out. I run a small example with every building having the same P_heat_max. On the attached picture I visualized the potential pipes before the optimisation and after. In red I coulored how I thought the grid would look like since I thought the optimisation tries to minimize the investment costs, but instead a very long second branch is used for the routing. I get this warning in my log: Can you help me out what the log means and what am I missing about the routing problem? Thank you very much, this Thread already helped a lot for a deeper understanding of the investment options. Best regards Lars |
Maybe also a great example would be if you @joroeder could quickly show how the pipes.csv must have looked like for the linearization in your publication (http://doi.org/10.5278/ijsepm.6248), I think this will answer a lot of questions for future readers. I assume it must have looked something like this?: Please correct me if I have a misunderstanding. |
Please see here #100 |
Thanks a lot for the answer! Here is the data of the example: Apparently I get the same result with nonconvex = 1 and additional fix costs, no matter how high I choose the additional fix costs. Best regards and thanks for the support! Lars |
I will close this issue, as the different issues seem to be solved, or addressed in separate issues:
|
I hope it's okay to more or less ask a support question here, but I'm kinda lost at this error.
I'm getting "ValueError: Pipe id already has an investment > 0!" when trying to optimise my district heating network. It is probably an issue regarding the structure of my investment/pipes.csv table:
(Disregard the capex)
Its running with nonconvex 0 and cap_min == 0, but I'd like to have cap_min > 0.
The text was updated successfully, but these errors were encountered: