Ask Your Question
1

API commands to color certain circuits

asked 2026-05-04 22:57:35 -0500

Yoyo gravatar image

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...

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2026-05-11 23:07:18 -0500

Yoyo gravatar image

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?

edit flag offensive delete link more

Comments

Maybe it can be done with module sliderPy.

perolofl gravatar imageperolofl ( 2026-05-12 07:28:00 -0500 )edit
0

answered 2026-05-11 19:47:21 -0500

QuinnP gravatar image

updated 2026-05-11 19:49:57 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2026-05-04 22:57:35 -0500

Seen: 125 times

Last updated: May 11