Skip to content

Commit 248903d

Browse files
committed
Fix bug in parsing data
1 parent 64e2c34 commit 248903d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/opflow/model/power_bal_polar/pbpol.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,7 @@ PetscErrorCode OPFLOWComputeObjective_PBPOL(OPFLOW opflow, Vec X,
14661466
if (opflow->objectivetype == MIN_GEN_COST) {
14671467
loc = gen->startxpowloc;
14681468
Pg = x[loc] * ps->MVAbase;
1469+
14691470
*obj +=
14701471
gen->cost_alpha * Pg * Pg + gen->cost_beta * Pg + gen->cost_gamma;
14711472
flps += 7.0;

src/ps/psreaddata.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ PetscErrorCode PSReadMatPowerData(PS ps, const char netfile[]) {
745745
generators in gencost data
746746
*/
747747
PetscInt temp_geni[200]; // Assume there are max 200 generators
748+
for(i=0; i < 200; i++) temp_geni[i] = line_counter+1;// initialize
749+
748750
PetscInt i_idx=-1,isol_idx=0,isol_idx2=0,isol_idx3=0;
749751

750752
fp = fopen(netfile, "r");
@@ -954,7 +956,7 @@ PetscErrorCode PSReadMatPowerData(PS ps, const char netfile[]) {
954956
&Gen[gencosti].cost_ncoeffs, &Gen[gencosti].cost_alpha,
955957
&Gen[gencosti].cost_beta, &Gen[gencosti].cost_gamma);
956958
} else if(num_max_cost_coeffs == 4) {
957-
sscanf(line, "%d %lf %lf %d %*lf %lf %lf %lf", &Gen[gencosti].cost_model,
959+
sscanf(line, "%d %lf %lf %d %*f %lf %lf %lf", &Gen[gencosti].cost_model,
958960
&Gen[gencosti].cost_startup, &Gen[gencosti].cost_shutdown,
959961
&Gen[gencosti].cost_ncoeffs, &Gen[gencosti].cost_alpha,
960962
&Gen[gencosti].cost_beta, &Gen[gencosti].cost_gamma);

0 commit comments

Comments
 (0)