1

API commands to color certain circuits

  • retag add tags

Is there a way using API commands to color certain circuits in a different color in the sld file? For example, to color certain lines red by choice...

Yoyo's avatar
71
Yoyo
asked 2026-05-04 22:57:35 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

Thanks

Maybe I didn't make myself clear.

I'm interested in coloring circuits regardless of another factor such as voltage or load received. For example, I'm writing a script that runs 2 scenarios, one without a certain generator and the other after adding it. It checks n-1 and gets the differences. I'm now interested in coloring all circuits where the load increased due to the generator in red, while all circuits where the load decreased due to the addition of the generator in green, for example.

Is there a command to color circuits according to choice and without any other constraint?

Yoyo's avatar
71
Yoyo
answered 2026-05-11 23:07:18 -0500
edit flag offensive 0 remove flag delete link

Comments

Maybe it can be done with module sliderPy.

perolofl's avatar perolofl (2026-05-12 07:28:00 -0500) edit
add a comment see more comments
0

There is! To colour branches, buses, etc based on nominal voltage, you can use psspy.setdiagresvrcs. Some example code is below (code was written for PSSE 34, it's possible this may need tweaking in the latest version of PSSE):

# Set voltage limits and colours
voltage_lims = [21,65,109,219,274,329,499]
reds = [128,0,128,255,0,128,255,255]
blues = [128,255,64,0,255,255,64,0]
greens = [128,255,64,0,0,0,128,255]
# Colours are [grey, light blue, brown, red, blue, purple, orange, yellow]

psspy.setdiagresvrcs_2(setscope = 1, usevolt = 1, vltval = voltage_lims, vlnclrr = reds, vlnclrb = blues, vlnclrg = greens, usevoltlay = 1)

Note that the setscope argument determines whether the colours apply to the active SLD only, or whether they apply to all new SLDs.

QuinnP's avatar
71
QuinnP
answered 2026-05-11 19:47:21 -0500, updated 2026-05-11 19:49:57 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer