Old post I know, but for anyone else chasing this like I was: setdiagresvrcs () and a few other sld settings-related functions have a keyword 'scope' which determines whether to edit settings for active, global (i.e. default) or both. From what I've found there are a handful of settings that will need to be done manually no matter what, but these are generally global settings or context dependent (like animating flows) so despite the frustration you will get a habit for which ones are the common culprits.
I've made a script for changing what require the most fiddling. As stated in the module description it's written to be loaded directly into PSSE, or drag and drop while having the active SLD open. The global parameter SCOPE = 2 will change only the active sld by default. This is still a personal WIP- see comments for things that aren't working yet or contradict the API based on testing.
Godspeed.
"""
This script was written for PSSE v34.5.1 in Python 2.7.18
Drag and drop into the PSSE GUI to run, ideally with an active SLD,
Although you can load using the TEST_SLD_FILE variable.
! IMPORTANT:
! These functions behave strangely and the API is *INCORRECT* in several
! areas.
! For some reason the default values (_i, _f, _s) do not work for
! these sld functions for some keywords.
! Make sure to set Diagram Items are NOT bound in Edit-> Preferences
This version is customized to be specifically for printing.
NOTE: If you wish to include animated flows and current loadings
they must first be enabled in the active case!
GLOBAL Arguments:
SCOPE {int} --
0: default settings only
1: default settings and active sld
2: active sld only
TEST_SLD_FILE {str} --
Mainly for debugging. NOTE: do not include '.sld'
"""
SCOPE = 2
TEST_SLD_FILE = None
# ENTER sld path\\name to test - only for debugging
# TEST_SLD_FILE = "C:\\your project\\your beautiful sld""
def voltage_thresholds(scope=2):
"""
Enabling voltage thresholds in Slider Diagrams. Default settings
match NEM SLD colours (exception: 500 kV. Because yellow on
white should be illegal)
v_th {dict} -- [kV, rgb(0,0,0), linewidth]
'V0': [0.00, (1, 1, 1), 1] is not a specific voltage,
it serves as the colour for below minimum defined in V1
"""
v_th = {
'V0': [0.00, (230, 1, 1), 1],
'V1': [11.0, (1, 1, 1), 1],
'V2': [33.0, (119, 65, 16), 1],
'V3': [66.0, (192, 2, 45), 1],
'V4': [132.0, (0, 0, 255), 2],
'V5': [220.0, (229, 0, 126), 2],
'V6': [275.0, (242, 170, 45), 3],
'V7': [330.0, (0, 255, 255), 3]
}
v_ranges = [v[0] for v in v_th.values()]
v_ranges.remove(0.00) # drop as it is not part of the range
rgb_red = [rgb[1][0] for rgb in v_th.values()]
rgb_green = [rgb[1][1] for rgb in v_th.values()]
rgb_blue = [rgb[1][2] for rgb in v_th.values()]
linewidths = [w[2] for w in v_th.values()]
psspy.setdiagresvrcs_2(
setscope=scope,
usevolt=1,
vlnwdt=linewidths,
vltval=v_ranges,
vlnclrr=rgb_red ...
(more)