@@ -234,7 +234,7 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
234234
235235 PSBUS bus = &(ps->bus [ibus]);
236236
237- // Nonzero entries used by each *bus* starts here
237+ // Nonzero entries used by each *bus* starts here
238238
239239 // no matter what, each bus uses 2 rows and 2 columns
240240 // row 1 = real, row2 = reactive
@@ -243,11 +243,11 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
243243 nnz_eqjac += 2 ;
244244 busparams->jacsq_idx [ibus] = nnz_eqjac;
245245 nnz_eqjac += 2 ;
246-
246+
247247 if (bus->ide == ISOLATED_BUS) {
248248 continue ;
249249 }
250-
250+
251251 if (opflow->include_powerimbalance_variables ) {
252252 // 2 more entries on both real and reactive
253253 nnz_eqjac += 4 ;
@@ -264,7 +264,7 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
264264 genparams->eqjacsqbus_idx [igen1] = nnz_eqjac++;
265265 igen1++;
266266 }
267-
267+
268268 if (opflow->include_loadloss_variables ) {
269269 // each load adds one real and reactive entry on each bus row
270270 // NOTE: iload is a system load counter
@@ -275,13 +275,12 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
275275 }
276276 }
277277
278-
279278 if (opflow->has_gensetpoint ) {
280279 for (int bgen = 0 ; bgen < bus->ngen ; ++bgen) {
281280 PSGEN gen;
282281 ierr = PSBUSGetGen (bus, bgen, &gen);
283282 CHKERRQ (ierr);
284-
283+
285284 if (!gen->status || gen->isrenewable )
286285 continue ;
287286
@@ -297,10 +296,10 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
297296
298297 for (int iline = 0 ; iline <= ps->nline ; ++iline) {
299298 PSLINE line = &(ps->line [iline]);
300-
299+
301300 if (!line->status )
302301 continue ;
303-
302+
304303 // each line adds 4 (off-diagonal) entries for the to bus and 4
305304 // entries for the from bus. Each line also modifies 4 existing
306305 // to and from bus entries.
@@ -338,11 +337,11 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
338337 PSBUS bus = &(ps->bus [ibus]);
339338 if (bus->ide == PV_BUS || bus->ide == REF_BUS) {
340339 for (int bgen = 0 ; bgen < bus->ngen ; ++bgen) {
341- PSGEN gen;
342- ierr = PSBUSGetGen (bus, bgen, &gen);
343- CHKERRQ (ierr);
344- if (!gen->status )
345- continue ;
340+ PSGEN gen;
341+ ierr = PSBUSGetGen (bus, bgen, &gen);
342+ CHKERRQ (ierr);
343+ if (!gen->status )
344+ continue ;
346345 }
347346 nnz_ineqjac += 2 ;
348347 }
@@ -357,8 +356,8 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
357356 }
358357 }
359358
360- std::cout << " Inequality Jacobian nonzero count: " << nnz_ineqjac << std::endl;
361-
359+ std::cout << " Inequality Jacobian nonzero count: " << nnz_ineqjac
360+ << std::endl;
362361
363362 // Count non-zeros in *upper triangular* Hessian
364363
@@ -375,7 +374,6 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
375374 if (opflow->include_powerimbalance_variables ) {
376375 nnz_hesssp += 2 ;
377376 }
378-
379377 }
380378
381379 for (int i = 0 , igen = 0 ; i < ps->ngen ; ++i) {
@@ -402,19 +400,18 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
402400 igen++;
403401 }
404402
405- for (int iline= 0 ; iline < ps->nline ; ++iline) {
403+ for (int iline = 0 ; iline < ps->nline ; ++iline) {
406404 PSLINE line = &(ps->line [iline]);
407405
408406 if (!line->status )
409407 continue ;
410-
408+
411409 lineparams->hesssp_idx [iline] = nnz_hesssp;
412410
413411 // 3 diagonal entries for on the from-bus rows (already defined)
414412 // 3 diagonal entries for on the to-bus rows (already defined)
415413 // 4 off-diagonal entries in upper part
416414 nnz_hesssp += 4 ;
417-
418415 }
419416
420417 if (opflow->include_loadloss_variables ) {
@@ -426,7 +423,6 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
426423
427424 std::cout << " Hessian nonzero count: " << nnz_hesssp << std::endl;
428425
429-
430426 ierr = busparams->copy (opflow);
431427 ierr = genparams->copy (opflow);
432428 ierr = lineparams->copy (opflow);
0 commit comments