-
Notifications
You must be signed in to change notification settings - Fork 26
TDR Implementation in Macro #150
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
Open
Junwenlaw
wants to merge
2
commits into
macroenergy:main
Choose a base branch
from
Junwenlaw:TDR
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1,318
−6
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TDR with Extreme Periods New time_domain_reduction folder in src - run_time_domain_reduction.jl: master script - pre_clustering_tdr.jl for loading and pre-processing - clustering_tdr.jl to call algorithms in MacroEnergyTimeReduction package (kmeans, kmedoids, autoencoder_sequential, autoencoder_simultanous etc., autoencoder methods require additional inputs in TDR_settings.json - refer to "TDR_settings_for_autoencoder_method_change_name_before_use.json" in attached in example. - post_clustering_tdr.jl for post-processing and period map - write_outputs_tdr.jl for time_data.json, period_map.csv and reduced files csv output in a new folder: “system/TDR_results” New write_time_weights.jl - Write the time weight of each period Modified run_tools.jl - Global flag for TDR based on TimeDomainReduction in TDR_settings.json and If TDR is on (flag = 1), go to run_time_domain_reduction.jl script Modified load_json_inputs - Read time series “TDR_path” for assets.json and nodes.json instead of time series “path” if TDR flag = 1 Modified load_tine_data.jl - Read time_data.json in system”TDR_Results” folder if TDR flag = 1 How TDR will work: - User to create add time series “TDR_path” in assets.json and nodes.json, refer the time series of the system/TDR_results folder (See modified load_json_inputs and refer to attached example) - User to create TDR_settings.json file in “system” folder - TDR will not run if there is existing “system/TDR_results” folder (Use existing TDR files) - If TDR = 0, model will run according to time_data.json file in “system” folder and read “path” of time series in assets.json and nodes.json files - If TDR = 1, model will run according to time_data.json file in “system/TDR_Results” folder and read “TDR_path” of time series in assets.json and nodes.json files Attached Example - 8 zones power sector, use "system/TDR_settings.json" to turn on TDR, then run the case to see "system/TDR_Results" created and Macro will use the files there to run the model Done Checks - Checked time weights - Compare with Dolphyn TDR – Period map exact match with and without extreme periods!
Utilize CEM output features for clustering, in addition to existing input time series of availability, demand, and fuel prices.
run_subperiod_cases.jl: Run individual subperiods independently to obtain individual CEM results (optimal flow) for each subperiod, and stacked together to a full year series to include in clustering. Each subperiod will be weighted to represent the full model hours. This is like solving 1 representative day or week for the year, using the input time series of the particular day or week.
For example, if we are modeling 24 hours in each subperiod for 1 full year, there will be 365 CEMs to run (can be done in parallel, to implement threads in a next update, similar to Benders approach), and each of the 24 hours in each CEM will have a weight of 365 when solved independently. Note that if we use 168 hours in each subperiod, there will be a 53rd subperiod of 24 hours, but it does not have effect in the clustering, since the TDR script will drop any incomplete last subperiods - Only use 8736 hours for clustering in a 8760 hours timseries if modeling representative weeks with 168 hours each.
Users to specify in TDR_settings.json which output feature to include for TDR, at the commodity and asset level, such as VRE and battery electricity edge flow results
In addition, users can choose to turn on policy or not for each subperiod solve.
The output feature flows will be created in a subperiod_results.csv in the system folder with the other time series for clustering, and loaded in the TDR script for parsing and clustering to choose representative weeks.
In addition, a bug in the TDR script is fixed by ensuring that TDR will not run only if required files exists in addition to the folder, or the TDR will run to generate the required files.
Also updated the solar and wind columns such that it does not identify the edges columns in the parsed dataframe when identifying extreme periods for solar and wind.
The new TDR settings include:
"ClusterSubperiodResults": 1,
"ClusterSubperiodFileName": "subperiod_results.csv",
"Zero_Threshold": 0.1, #This is an optional feature to set a threshold that set all output features value to zero if smaller, to prevent very small values in clustering.
"SubperiodPolicyConstraints": 1,
"SubperiodResults" : {
"Commodities" : {
"Electricity" : {
"Include": 1,
"Assets": {
"VRE": 1,
"Battery": 1,
"ThermalPower": 0,
"ThermalPowerCCS": 0,
"HydroRes": 0,
"MustRun": 0
}
},
"Hydrogen" : {
"Include": 0,
"Assets": {
"Electrolyzer": 0,
"ThermalHydrogen": 0,
"ThermalHydrogenCCS": 0,
"GasStorage": 0
}
}
}
}
Collaborator
Author
|
Updated TDR_settings.json to run output based TDR, refer to latest commit on details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
8_Zones_Power.zip
TDR with Extreme Periods
New time_domain_reduction folder in src
New write_time_weights.jl
Modified run_tools.jl
Modified load_json_inputs
Modified load_tine_data.jl
How TDR will work:
Attached Example
Done Checks
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
Type of change
Please delete options that are not relevant.
Related Issues
Link to any related issues using one of the following keywords:
Fixes #123- Closes the issue when the PR is mergedCloses #123- Same as FixesResolves #123- Same as FixesAddresses #123- References the issue but doesn't close itRelated to #123- For issues that are related but not directly addressedYou can link multiple issues by using multiple lines:
Checklist:
How to test the code
Reference to an example case or a test case that can be run to verify the changes.
Additional context
Add any other context about the PR here. If you have any questions, please contact the maintainers.