Skip to content

Commit

Permalink
If needed, initialize individual load cost parameters (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
wperkins committed Dec 28, 2023
1 parent 7d0659e commit 66aa1b2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/opflow/interface/opflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,20 +1620,22 @@ PetscErrorCode OPFLOWSetUp(OPFLOW opflow) {
ierr = OPFLOWGetLinesMonitored(opflow);
CHKERRQ(ierr);
}

/* Set individual load cost parameters to the blanket values if they
were not read from the input network */
if (opflow->include_loadloss_variables) {
PS ps;
PSBUS bus;
PSLOAD load;

ierr = OPFLOWGetPS(opflow, &ps);
CHKERRQ(ierr);

for (int i = 0; i < ps->nbus; i++) {
bus = &(ps->bus[i]);
for (int l = 0; l < bus->nload; l++) {
ierr = PSBUSGetLoad(bus, l, &load);
CHKERRQ(ierr);
if (load->loss_cost == BOGUSLOSSCOST) {
if (!ps->read_load_cost) {
for (int i = 0; i < ps->nbus; i++) {
PSBUS bus = &(ps->bus[i]);
for (int l = 0; l < bus->nload; l++) {
PSLOAD load;
ierr = PSBUSGetLoad(bus, l, &load);
CHKERRQ(ierr);
load->loss_frac = 1.0;
load->loss_cost = opflow->loadloss_penalty;
}
}
Expand Down

0 comments on commit 66aa1b2

Please sign in to comment.