pypsa-usa icon indicating copy to clipboard operation
pypsa-usa copied to clipboard

Refactor cost multiplier functions

Open trevorb1 opened this issue 2 years ago • 1 comments

Feature Request

We can combine quite a bit of the cost multiplier functions (update_marginal_costs(...) and update_capital_costs(...)). Specifically, the logic that maps each generator to a state, as it needs to extract out the state label from the bus dataframe. If this logic is packaged into its own function, it may be useful later in the workflow as well :)

Suggested Solution

Here is the code that I think should be simplified.

https://github.com/PyPSA/pypsa-usa/blob/6f37e32de0b19b349e6ba134e1bcfa0f48e5b93a/workflow/scripts/add_electricity.py#L312-L420

Moreover, here is the portion that I think should be extracted into its own funtion

https://github.com/PyPSA/pypsa-usa/blob/6f37e32de0b19b349e6ba134e1bcfa0f48e5b93a/workflow/scripts/add_electricity.py#L315-L324

Additional Info

No response

trevorb1 avatar Sep 25 '23 19:09 trevorb1

#209 Address some of this refactoring

ktehranchi avatar Mar 05 '24 02:03 ktehranchi