Skip to content

Commit

Permalink
Avoid shedding for loads that have negative values in datafile
Browse files Browse the repository at this point in the history
  • Loading branch information
abhyshr committed Sep 20, 2024
1 parent b6c5282 commit 17045e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/private/psimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* @brief A bogus value for load loss cost
*/
#define BOGUSLOSSCOST -1234.0
#define BOGUSLOSSCOST 12345.0

/**
* @brief private bus data struct
Expand Down
6 changes: 5 additions & 1 deletion src/opflow/interface/opflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,11 @@ PetscErrorCode OPFLOWSetUp(OPFLOW opflow) {
PSLOAD load;
ierr = PSBUSGetLoad(bus, l, &load);
CHKERRQ(ierr);
load->loss_frac = 1.0;
if(load->pl < 0.0 || load->ql < 0.0) {
load->loss_frac = 0.0;
} else {
load->loss_frac = 1.0;
}
load->loss_cost = opflow->loadloss_penalty;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/ps/psreaddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,11 @@ PetscErrorCode PSReadMatPowerData(PS ps, const char netfile[]) {
Load[loadi].pl = Pd / ps->MVAbase;
Load[loadi].ql = Qd / ps->MVAbase;
/* Some defaults for load shed */
Load[loadi].loss_frac = 1.0;
if(Pd < 0.0 || Qd <= 0.0) {
Load[loadi].loss_frac = 0.0;
} else {
Load[loadi].loss_frac = 1.0;
}
Load[loadi].loss_cost = BOGUSLOSSCOST;
Load[loadi].area = Bus[busi].area;
Load[loadi].internal_i = busi;
Expand Down

0 comments on commit 17045e3

Please sign in to comment.