API commands to color certain circuits
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...
First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
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...
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?
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.
Asked: 2026-05-04 22:57:35 -0500
Seen: 125 times
Last updated: May 11
whit loves you. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.