Load Scenario File#46
Conversation
…diverging." This reverts commit e61b89b.
pelesh
left a comment
There was a problem hiding this comment.
I suggest target branch is the one you branched off.
I also made a few comments with suggested improvements.
| char scenfile[PETSC_MAX_PATH_LEN]; | ||
| char loadfile[PETSC_MAX_PATH_LEN]; |
There was a problem hiding this comment.
Why are load files and scenario files different? Shouldn't there be single scenario file format including generation and load?
There was a problem hiding this comment.
Yes, the loadfile variable name is not necessary actually. A single name is fine. I did not want to touch the variable name in the first implementation. I will drop the loadfile and use scenfile only.
Regarding Load and Generator together: It can be done but will require little bit more modification. The first cut focused on changing Load P and Q values. But I see I can use the same template to have different forecast types. Will try to submit the changes.
| scenario_nr,weight,kv_list | ||
| 1,0.101,8_Load_1_185.0_1000,6_Load_1_105.5_2000 | ||
| 2,0.102,6_Load_1_105.0_10 | ||
| 3,0.103,8_Load_1_75.0_20 |
There was a problem hiding this comment.
This is somewhat strange string format. Can't we use simple csv?
There was a problem hiding this comment.
Okay, the issue is similar to the argument for CSR type of file format.
For example, say we have a test case, where we want to add a large load to each bus and say we have 30k eligible buses. So we have 30k such scenarios.
In old format, we need to have 30k columns for each CSV file, and all will have original model values except 1 column for each scenario of the existing CSV format.
In this new format, we are just keeping the bus which need to be changes.
But I agree the format is a bit strange and I am open to suggestions for input format. We can rewrite the parser accordingly.
There was a problem hiding this comment.
How about we use JSON format?
@PhilipFackler, please chime in.
| PetscScalar *val1 = nullptr; /* forecast values */ | ||
| PetscScalar *val2 = nullptr; /* 2nd set of forecast values */ |
There was a problem hiding this comment.
What are forecast values and "2nd set of forecast values"? This is somewhat counterintuitive.
There was a problem hiding this comment.
In current format, Forecast have a single value. But for a load, we want to change P and Q values simultaneously. So, either we can change the data type of val, or we can add add a second list of values. I used the second list here.
There was a problem hiding this comment.
I am not sure we want to change P & Q simultaneously. They often change together but sometimes they don't as far as I know.
| FORECAST_LOAD_P = 2, | ||
| FORECAST_LOAD_Q = 3 | ||
| FORECAST_LOAD_PQ = 3 |
There was a problem hiding this comment.
Why is FORECAST_LOAD_Q changed into FORECAST_LOAD_PQ?
There was a problem hiding this comment.
I wanted to have the ability to change PQ value as a set. In later iterations, we can drop FORECAST_LOAD_P and use just FORECAST_GEN (after renaming FORECAST_WIND) and and FORECAST_LOAD.
There was a problem hiding this comment.
I don't see why one would want to change P and Q as a set. They can and they occasionally do change separately.
@hambrickjc and @tsybinae: please chime in.
| ps->numits = opflow->numits; | ||
|
|
There was a problem hiding this comment.
Why numits? Why not spell it out number_iterations?
There was a problem hiding this comment.
That was my doing. opflow->numits was already defined, so I kept ps->numits. I agree we should rename both.
| // Body Example | ||
| // 1,0.1,8_Load_1_185.0_10,6_Load_1_105.5_20 | ||
| while ((out = fgets(line, MAXLINE, fp)) != NULL) { | ||
| if (strcmp(line, "\r\n") == 0 || strcmp(line, "\n") == 0) { | ||
| continue; /* Skip blank lines */ | ||
| } |
There was a problem hiding this comment.
This is unintuitive way to define and parse input. Since we are creating new input file and matching parser, we don't need to use C string operations.
There was a problem hiding this comment.
Okay, we can have a better parser to replace this code.
| vector<GenData> gendata; | ||
|
|
||
| tok = strtok(NULL, sep_comma); | ||
| sscanf(tok, "%lf", &weight); |
There was a problem hiding this comment.
I think mixing STL and C standard library is not the best way to proceed.
There was a problem hiding this comment.
Ok, I will replace the STL from here.
I tried to change the target branch but it does not look great. Should I create another MR and close this one? |
Yeah, this looks like a rebase to |
@maksud You should now be able to rebase you branch on |
Merge request type
Relates to
This MR updates
Summary
Added an implementation of incorporating P and Q load scenarios. Created a file format for the load scenarios in:
datafiles/case9/10_scenarios_9bus_load.txtFor each scenario in the file, it changes the load values of the bus list mentioned in the file.The format of each scenario is like this:
1,0.101,8_Load_1_185.0_1000,6_Load_1_105.5_20001 = Scenario Number
0.101 = Weight
8_Load_1_185.0_1000,6_Load_1_105.5_2000 = list of load values
8_Load_1_185.0_1000 = Set Bus 8 with P = 185.0 and Q = 1000
6_Load_1_105.5_2000= Set Bus 6 with P = 105.0 and Q = 2000