Skip to content

Commit 17045e3

Browse files
committed
Avoid shedding for loads that have negative values in datafile
1 parent b6c5282 commit 17045e3

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

include/private/psimpl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* @brief A bogus value for load loss cost
2626
*/
27-
#define BOGUSLOSSCOST -1234.0
27+
#define BOGUSLOSSCOST 12345.0
2828

2929
/**
3030
* @brief private bus data struct

src/opflow/interface/opflow.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,11 @@ PetscErrorCode OPFLOWSetUp(OPFLOW opflow) {
16941694
PSLOAD load;
16951695
ierr = PSBUSGetLoad(bus, l, &load);
16961696
CHKERRQ(ierr);
1697-
load->loss_frac = 1.0;
1697+
if(load->pl < 0.0 || load->ql < 0.0) {
1698+
load->loss_frac = 0.0;
1699+
} else {
1700+
load->loss_frac = 1.0;
1701+
}
16981702
load->loss_cost = opflow->loadloss_penalty;
16991703
}
17001704
}

src/ps/psreaddata.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,11 @@ PetscErrorCode PSReadMatPowerData(PS ps, const char netfile[]) {
797797
Load[loadi].pl = Pd / ps->MVAbase;
798798
Load[loadi].ql = Qd / ps->MVAbase;
799799
/* Some defaults for load shed */
800-
Load[loadi].loss_frac = 1.0;
800+
if(Pd < 0.0 || Qd <= 0.0) {
801+
Load[loadi].loss_frac = 0.0;
802+
} else {
803+
Load[loadi].loss_frac = 1.0;
804+
}
801805
Load[loadi].loss_cost = BOGUSLOSSCOST;
802806
Load[loadi].area = Bus[busi].area;
803807
Load[loadi].internal_i = busi;

0 commit comments

Comments
 (0)