Skip to content

Commit 3e48fa8

Browse files
committed
Removed some unused variables and constants
1 parent 5875434 commit 3e48fa8

File tree

3 files changed

+86
-107
lines changed

3 files changed

+86
-107
lines changed

include/constants.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
#define NLOAD_AT_BUS_MAX 32 /**< Maximum number of loads allowed at a bus */
2020
#define NPHASE 1 /**< Per-phase analysis */
21-
#define MAX_KV_LEVELS 200 /**< Maximum KV levels */
21+
#define MAX_KV_LEVELS 200 /**< Maximum KV (voltage) levels allowed in input file */
2222

2323
/* Fuel types for generators */
2424
#define GENFUEL_COAL 0 /* Coal */
@@ -43,9 +43,6 @@
4343

4444
#define EXAGO_IGNORE -1000000 /* Ignore value */
4545

46-
#define BAD_INPUT_DATA "Bad Input Data :"
47-
#define INCORRECT_BOUNDS "Incorrect Bounds :"
48-
4946
/*
5047
* We often want a char[] with enough space to handle any solver or model name.
5148
* These sizes are greater than the greatest of the model or solver name,

src/pflow/pflow.cpp

+84-85
Original file line numberDiff line numberDiff line change
@@ -295,91 +295,90 @@ PetscErrorCode PFLOWJacobian(SNES snes, Vec X, Mat J, Mat Jpre, void *ctx) {
295295
thetatf = thetat - thetaf;
296296
flps += 2;
297297

298-
if (!line->isdcline) {
299-
PetscScalar Gff, Bff, Gft, Bft, Gtf, Btf, Gtt, Btt;
300-
Gff = line->yff[0];
301-
Bff = line->yff[1];
302-
Gft = line->yft[0];
303-
Bft = line->yft[1];
304-
Gtf = line->ytf[0];
305-
Btf = line->ytf[1];
306-
Gtt = line->ytt[0];
307-
Btt = line->ytt[1];
308-
309-
if (bus == busf) {
310-
if (bus->ide != REF_BUS) {
311-
row[0] = locglobf;
312-
col[0] = locglobf;
313-
col[1] = locglobf + 1;
314-
col[2] = locglobt;
315-
col[3] = locglobt + 1;
316-
val[0] = Vmf * Vmt * (-Gft * sin(thetaft) + Bft * cos(thetaft));
317-
val[1] =
318-
2 * Gff * Vmf + Vmt * (Gft * cos(thetaft) + Bft * sin(thetaft));
319-
val[2] = Vmf * Vmt * (Gft * sin(thetaft) - Bft * cos(thetaft));
320-
val[3] = Vmf * (Gft * cos(thetaft) + Bft * sin(thetaft));
321-
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
322-
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
323-
CHKERRQ(ierr);
324-
325-
if (bus->ide != PV_BUS) {
326-
row[0] = locglobf + 1;
327-
val[0] = Vmf * Vmt * (Bft * sin(thetaft) + Gft * cos(thetaft));
328-
val[1] = -2 * Bff * Vmf +
329-
Vmt * (-Bft * cos(thetaft) + Gft * sin(thetaft));
330-
val[2] = Vmf * Vmt * (-Bft * sin(thetaft) - Gft * cos(thetaft));
331-
val[3] = Vmf * (-Bft * cos(thetaft) + Gft * sin(thetaft));
332-
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
333-
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
334-
CHKERRQ(ierr);
335-
}
336-
}
337-
} else {
338-
if (bus->ide != REF_BUS) {
339-
row[0] = locglobt;
340-
col[0] = locglobt;
341-
col[1] = locglobt + 1;
342-
col[2] = locglobf;
343-
col[3] = locglobf + 1;
344-
val[0] = Vmt * Vmf * (-Gtf * sin(thetatf) + Btf * cos(thetatf));
345-
val[1] =
346-
2 * Gtt * Vmt + Vmf * (Gtf * cos(thetatf) + Btf * sin(thetatf));
347-
val[2] = Vmt * Vmf * (Gtf * sin(thetatf) - Btf * cos(thetatf));
348-
val[3] = Vmt * (Gtf * cos(thetatf) + Btf * sin(thetatf));
349-
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
350-
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
351-
CHKERRQ(ierr);
352-
353-
if (bus->ide != PV_BUS) {
354-
row[0] = locglobt + 1;
355-
val[0] = Vmt * Vmf * (Btf * sin(thetatf) + Gtf * cos(thetatf));
356-
val[1] = -2 * Btt * Vmt +
357-
Vmf * (-Btf * cos(thetatf) + Gtf * sin(thetatf));
358-
val[2] = Vmt * Vmf * (-Btf * sin(thetatf) - Gtf * cos(thetatf));
359-
val[3] = Vmt * (-Btf * cos(thetatf) + Gtf * sin(thetatf));
360-
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
361-
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
362-
CHKERRQ(ierr);
363-
}
364-
}
365-
}
366-
} else if (line->isdcline) {
367-
/* DC line */
368-
if (bus == busf) {
369-
row[0] = locglobf + 1;
370-
col[0] = locglobf + 1;
371-
val[0] = 1.0;
372-
ierr = MatSetValues(J, 1, row, 1, col, val, ADD_VALUES);
373-
CHKERRQ(ierr);
374-
} else {
375-
row[0] = locglobt + 1;
376-
col[0] = locglobt + 1;
377-
val[0] = 1.0;
378-
ierr = MatSetValues(J, 1, row, 1, col, val, ADD_VALUES);
379-
CHKERRQ(ierr);
380-
}
381-
} else {
382-
/* For future use */
298+
if(!line->isdcline) {
299+
PetscScalar Gff, Bff, Gft, Bft, Gtf, Btf, Gtt, Btt;
300+
Gff = line->yff[0];
301+
Bff = line->yff[1];
302+
Gft = line->yft[0];
303+
Bft = line->yft[1];
304+
Gtf = line->ytf[0];
305+
Btf = line->ytf[1];
306+
Gtt = line->ytt[0];
307+
Btt = line->ytt[1];
308+
309+
310+
if (bus == busf) {
311+
if (bus->ide != REF_BUS) {
312+
row[0] = locglobf;
313+
col[0] = locglobf;
314+
col[1] = locglobf + 1;
315+
col[2] = locglobt;
316+
col[3] = locglobt + 1;
317+
val[0] = Vmf * Vmt * (-Gft * sin(thetaft) + Bft * cos(thetaft));
318+
val[1] =
319+
2 * Gff * Vmf + Vmt * (Gft * cos(thetaft) + Bft * sin(thetaft));
320+
val[2] = Vmf * Vmt * (Gft * sin(thetaft) - Bft * cos(thetaft));
321+
val[3] = Vmf * (Gft * cos(thetaft) + Bft * sin(thetaft));
322+
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
323+
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
324+
CHKERRQ(ierr);
325+
326+
if (bus->ide != PV_BUS) {
327+
row[0] = locglobf + 1;
328+
val[0] = Vmf * Vmt * (Bft * sin(thetaft) + Gft * cos(thetaft));
329+
val[1] = -2 * Bff * Vmf +
330+
Vmt * (-Bft * cos(thetaft) + Gft * sin(thetaft));
331+
val[2] = Vmf * Vmt * (-Bft * sin(thetaft) - Gft * cos(thetaft));
332+
val[3] = Vmf * (-Bft * cos(thetaft) + Gft * sin(thetaft));
333+
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
334+
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
335+
CHKERRQ(ierr);
336+
}
337+
}
338+
} else {
339+
if (bus->ide != REF_BUS) {
340+
row[0] = locglobt;
341+
col[0] = locglobt;
342+
col[1] = locglobt + 1;
343+
col[2] = locglobf;
344+
col[3] = locglobf + 1;
345+
val[0] = Vmt * Vmf * (-Gtf * sin(thetatf) + Btf * cos(thetatf));
346+
val[1] =
347+
2 * Gtt * Vmt + Vmf * (Gtf * cos(thetatf) + Btf * sin(thetatf));
348+
val[2] = Vmt * Vmf * (Gtf * sin(thetatf) - Btf * cos(thetatf));
349+
val[3] = Vmt * (Gtf * cos(thetatf) + Btf * sin(thetatf));
350+
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
351+
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
352+
CHKERRQ(ierr);
353+
354+
if (bus->ide != PV_BUS) {
355+
row[0] = locglobt + 1;
356+
val[0] = Vmt * Vmf * (Btf * sin(thetatf) + Gtf * cos(thetatf));
357+
val[1] = -2 * Btt * Vmt +
358+
Vmf * (-Btf * cos(thetatf) + Gtf * sin(thetatf));
359+
val[2] = Vmt * Vmf * (-Btf * sin(thetatf) - Gtf * cos(thetatf));
360+
val[3] = Vmt * (-Btf * cos(thetatf) + Gtf * sin(thetatf));
361+
flps += 21 + (4 * EXAGO_FLOPS_SINOP) + (4 * EXAGO_FLOPS_COSOP);
362+
ierr = MatSetValues(J, 1, row, 4, col, val, ADD_VALUES);
363+
CHKERRQ(ierr);
364+
}
365+
}
366+
}
367+
} else if(line->isdcline) {
368+
/* DC line */
369+
if(bus == busf) {
370+
row[0] = locglobf+1;
371+
col[0] = locglobf+1;
372+
val[0] = 1.0;
373+
ierr = MatSetValues(J,1,row,1,col,val,ADD_VALUES);
374+
CHKERRQ(ierr);
375+
} else {
376+
row[0] = locglobt+1;
377+
col[0] = locglobt+1;
378+
val[0] = 1.0;
379+
ierr = MatSetValues(J,1,row,1,col,val,ADD_VALUES);
380+
CHKERRQ(ierr);
381+
}
383382
}
384383
}
385384
}

src/ps/psreaddata.cpp

+1-18
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,8 @@ PetscErrorCode PSReadMatPowerData(PS ps, const char netfile[]) {
527527
/* Number of blank lines in bus, gen, br, gencost, and genfuel branch arrays
528528
*/
529529
PetscInt bus_nblank_lines = 0, gen_nblank_lines = 0;
530-
PetscInt br_nblank_lines = 0, gencost_nblank_lines = 0;
530+
PetscInt br_nblank_lines = 0;
531531
PetscInt dcline_nblank_lines = 0;
532-
PetscInt genfuel_nblank_lines = 0;
533-
PetscInt loadcost_nblank_lines = 0;
534532

535533
char line[MAXLINE];
536534
PetscInt loadi = 0, geni = 0, bri = 0, busi = 0, gencosti = 0, genfueli = 0,
@@ -644,21 +642,6 @@ PetscErrorCode PSReadMatPowerData(PS ps, const char netfile[]) {
644642
dcline_nblank_lines = dcline_nblank_lines + 1;
645643
}
646644

647-
if (gencost_start_line != -1 && gencost_end_line == -1) {
648-
if (strcmp(line, "\n") == 0 || strcmp(line, "\r\n") == 0)
649-
gencost_nblank_lines = gencost_nblank_lines + 1;
650-
}
651-
652-
if (loadcost_start_line != -1 && loadcost_end_line == -1) {
653-
if (strcmp(line, "\n") == 0 || strcmp(line, "\r\n") == 0)
654-
loadcost_nblank_lines = loadcost_nblank_lines + 1;
655-
}
656-
657-
if (genfuel_start_line != -1 && genfuel_end_line == -1) {
658-
if (strcmp(line, "\n") == 0 || strcmp(line, "\r\n") == 0)
659-
genfuel_nblank_lines = genfuel_nblank_lines + 1;
660-
}
661-
662645
/* Count the number of pq loads */
663646
if (bus_start_line != -1 && line_counter >= bus_start_line &&
664647
bus_end_line == -1) {

0 commit comments

Comments
 (0)