-
Notifications
You must be signed in to change notification settings - Fork 251
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 endogenous transport option #734
base: master
Are you sure you want to change the base?
Conversation
- select with endogenous_transport in config file - it is possible to select transport shares for part of the fuel types - creates ICE-fleet for baseyear if myopic is selected and no transport share is defined - adds constraints for endogenously chosen EVs in solve_network
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks @s8au , this looks great!
I still need to run the new code and I'll do it soon, but in the meantime see some suggestions based on reading the changes.
I think you can check "Changed dependencies are added to envs/environment.yaml." since no changes are required.
Try also to add a release note to doc/release_notes.rst
rhs = n.links.p_nom[gas_pipes_i].rename_axis("Link-ext") | ||
|
||
n.model.add_constraints(lhs == rhs, name="Link-pipe_retrofit") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do lines 572 to 668 appear as new additions? They are not related to the endogenous transport
The current definition of p_nom for the link "land transport EV" needs to be changed.
This represents the minimum number of cars needed to supply that demand, but in reality, cars are most of the time parked and we should use the total number of cars, as it was done before pypsa-eur/scripts/prepare_sector_network.py Line 1501 in 7069429
This is important to avoid problems when calculating the cost associated with cars. |
There is a bug when adding the storage for EVs exogenous. The following code
Should be:
|
The constraint relating the BEV charge rate and the storage capacity of the batteries, needs to take into account that in the config file it can be selected that only a percentage of the BEV provides flexibility
should be:
|
EDITED on 20/09/2023 at 8:35 I found a bug in the definition of p_max_pu and p_min_pu of the link "land transport oil"
should be:
otherwise, since p_nom and p_set are defined to be equal on a previous line, p_max_pu becomes a constant number and the flow of energy through that link is not able to supply the land transport demand. The definition of the efficiency in the link should also be modified: the current definition:
should be:
IMPORTANT: This should be changed for p_max_pu and p_min pu of both links 'land transport oil' and 'land transport fuel cell' |
Fixed efficiencies, captial costs, p_max_pu/p_min_pu of exogenous land transport, removed redundant variable Fixed EV constraint to only select Links with p_nom_extendable=True
516aec3
to
239bee9
Compare
@martavp @s8au thanks a lot for all your work on this! Tom and I just had a look at the code since we would like to have the endogenous land transport in the main repository quite soon. Two main points came to our mind: 1.) As a first step it made make sense to fix the number of cars and not allow switching between cars by assuming a @s8au would you have time to include it in the next two weeks or should we give it a try? Did you have time to check also for newer cost assumptions for EVs? |
Thank you both for looking over it and your suggestions. I will try to include the p_min_pu/p_max_pu constraint and remove the smoothing next week. |
Great! I think the technology data is a good source for the heavy duty vehicles. For the light vehicles I guess there is a Bloomberg report for at least EVs. But I think every source for light vehicles which is a bit more up to date (like after 2020) should be fine! |
…ization - remove smoothing of land transport demand - merge with more recent pypsa-eur version - fix some efficiencies in prepare_sector_network for land transport - make minor changes for better readability - fix land transport efficiency in base year
BNEF include cost assumption for trucks in Figure 4 in and cost assumptions for EVs until 2030 in Figure 28. https://www.transportenvironment.org/discover/hitting-the-ev-inflection-point/ But you are totally right @lisazeyen that is too pessimistic about EV costs. See below the cost comparison for EVs between our current assumptions and BNEF (red dots). We will implement a cost sensitivity analysis soon so that we can learn about the impacts. |
Yes, I guess a cost sensitivity is the best way! |
I updated it for the exogenous land transport EV |
scripts/prepare_sector_network.py
Outdated
# set p_nom to fulfill electric share, capital cost to 0 | ||
n.links.loc[n.links.carrier=='land transport EV', "p_nom_extendable"] = False | ||
|
||
p_nom = number_cars * options.get("bev_charge_rate", 0.011) * electric_share #electric_share * p_set.max(axis=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link represents the "capacity" of EVs to supply transport demand.
However, the current definition represents the capacity for charging the cars
since options.get("bev_charge_rate", 0.011)
is the capacity to charge a car.
@s8au can you change this? (similarly to the exogenous capacity definition for H2 and ICE cars)?
Hi @s8au , I mentioned to @lisazeyen yesterday that she can start reviewing this. There are two additional small issues: [ ] 1. I think the link representing the "capacity" of EVs to supply transport demand is not correct. [] 2. I understand how you estimated the capacity of the "land transport oil." In essence, you calculate the minimum capacity needed to supply the demand for land transport today and then decommission a percentage of it in every future planning horizon. The approach is fine for me. However, in reality, we have many more cars than "needed". Can you calculate the ratio between the existing number of cars and the cars that you calculate that are needed to supply the demand and write it as a log message? |
- Merge branch 'master' of https://github.com/PyPSA/pypsa-eur into endogenous-transport - fix EV land transport capacity - fix brownfield for exogenous land transport bug - add logger information for baseyear in endogenous land transport Conflicts: .pre-commit-config.yaml doc/configtables/sector.csv doc/release_notes.rst scripts/add_existing_baseyear.py scripts/prepare_sector_network.py scripts/solve_network.py
@martavp @lisazeyen I updated the branch with the master branch and I ran a test case for the exogenous and the endogenous transport each (resulting in again being behind by 4 commits). Since these are only minor changes I would prefer to update them with additional changes to my code. |
scripts/prepare_sector_network.py
Outdated
p_set = ( | ||
( | ||
transport[nodes] | ||
+ cycling_shift(transport[nodes], 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shift of demand was done to reflect that EV charging is smoothed out and not done exactly when the car is driven but it is not necessary e.g. for internal combustion cars. I would suggest in a first step to leave the cycling_shift out of the transport demand. In a second step one could think about adding a time-dependent efficiency to the BEV link to account for different charging times
lifetime = costs.at['Battery electric (passenger cars)', 'lifetime'], | ||
#lifetime? | ||
) | ||
|
||
n.madd( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest adding a p_max_pu
and p_min_pu
which are equal and both follow the demand profile from p_set
. The same should be done for the links of the ICE and the H2 fuel cell cars to keep the share constant. I know we discussed that people are also switching cars (e.g. they have an EV for short distances and an ICE for longer distances) but as a first step I think that is the easiest way and might speed up the optimisation as well since there are less decision variables.
scripts/prepare_sector_network.py
Outdated
carrier="BEV charger", | ||
p_max_pu=avail_profile[nodes], | ||
efficiency=options.get("bev_charge_efficiency", 0.9), | ||
efficiency=1, # instead of options.get("bev_charge_efficiency", 0.9) -> efficiency already accounted for in build_transport_demand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build_transport_demand
script did not change in your PR, so shouldn't it stay as before efficiency=options.get("bev_charge_efficiency", 0.9)
?
- calcualte transport demand in MWh of propulsion - calculate temperature dependance for land transport in vehicle efficiencies in prepare_sector_network - recalculate p_min_pu,p_max_pu after temporal_resolution is set in prepare_sector_network - update p_min_pu,p_max_pu in add_brownfield - update to newer pypsa-eur version - Add clean up suggestions and comments from lisazeyen Conflicts: config/config.default.yaml doc/configtables/sector.csv doc/release_notes.rst scripts/prepare_sector_network.py scripts/solve_network.py
I updated the PR with the newest version, so we can discuss the changes, but I still have to check if the added code in the add_brownfield works because the Gurobi license on our cluster has expired. |
@martavp I added a commit with the fixed bug, so it should run now |
Temperature influence on efficiency is moved from efficiency to p_min_pu constraint in the land transport
- Land transport demand corrected by temperature and in MWh units - efficiencies for land transport links include temperature dependencies
Removed land transport constraints except storage constraints, v2g and bev charger are constrained by p_nom_max
constraints that includes n.stores optimize all stores to the same value, split EV storage constraint in individual constraints to avoid that
e_nom_max of EV battery depends on previously installed capacity
relies on PR in technology-data repository: BertoGBG:master
Closes #507.
Changes proposed in this Pull Request
Checklist
envs/environment.yaml
.config.default.yaml
.doc/configtables/*.csv
.doc/release_notes.rst
is added.