Skip to content
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

Transport consumption reporting #485

Open
2 tasks done
trevorb1 opened this issue Nov 30, 2024 · 0 comments
Open
2 tasks done

Transport consumption reporting #485

trevorb1 opened this issue Nov 30, 2024 · 0 comments
Labels
bug Something isn't working Sector Sector Coupling Issue

Comments

@trevorb1
Copy link
Collaborator

Checklist

  • I am using the current master branch
  • I am running on an up-to-date pypsa-usa environment. Update via conda env update -f envs/environment.yaml

The Issue

I believe the plotter for transport consumption is double counting the non-road transport. It is grabbing both the individual links and the aggregators. The Sankey diagram PR has a potential solution.

def get_transport_consumption(
n: pypsa.Network,
state: Optional[str] = None,
) -> pd.DataFrame:
"""
Takes load from p0 link as loads are in kVMT or similar.
"""
loads = n.links[
(n.links.carrier.str.startswith("trn-"))
& ~(n.links.carrier.str.endswith("-veh"))
& ~(n.links.carrier == ("trn-air"))
& ~(n.links.carrier == ("trn-rail"))
& ~(n.links.carrier == ("trn-boat"))
]
if state:
l = _get_links_in_state(n, state)
loads = loads[loads.index.isin(l)]
df = n.links_t.p0[loads.index].mul(n.snapshot_weightings["objective"], axis=0).T
df.index = df.index.map(lambda x: x.split("trn-")[1])
return df.groupby(level=0).sum().T
match sector:
case "res" | "com" | "ind":
return get_service_consumption(n, sector, state)
case "trn":
return get_transport_consumption(n, state)
case _:
raise NotImplementedError

Steps To Reproduce

No response

Expected Behavior

No response

Error Message

No response

Anything else?

No response

@trevorb1 trevorb1 added bug Something isn't working Sector Sector Coupling Issue labels Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Sector Sector Coupling Issue
Projects
None yet
Development

No branches or pull requests

1 participant