master:var_switch parametersPSCAD Two State Switch

Every parameter of the PSCAD Two State Switch (master:var_switch): 9 names, with the unit, the default and the meaning PSCAD gives each one. Copy a name into parameters().

What master:var_switch is

The two state switch: an input control that gives one of two values, which a script can set before a run.

Definition
master:var_switch
PSCAD name
Two State Switch
Category
Faults and switching
Parameters
9, in 1 group
Read from
PSCAD 5.0.0, 2026-11-07

Most used master:var_switch parameters

ParameterUnitDescription
Value·Initial Statethe state it starts in
Max·Output Value in On Statethe value in the on state
Min·Output Value in Off Statethe value in the off state

Read and write master:var_switch in Python

import mhi.pscad

pscad = mhi.pscad.connect()              # the PSCAD that is open; launch() starts one
project = pscad.project("my_case")       # a case loaded in the workspace

for comp in project.find_all("master:var_switch"):   # the exact definition, namespace first
    params = comp.parameters()           # every parameter, as PSCAD holds it
    print(str(params["Value"]))          # Initial State

comp = project.find_all("master:var_switch")[0]
comp.parameters(Value="ON")              # a Choice is written as its symbol
  • A parameter is named exactly as in the table, letter case included: parameters() gives every one of them in a dictionary, and a name the component does not have is refused.
  • A value that carries a unit comes back as a number whose unit is only in its text, so read it as text first (str(...)) or the unit is lost. PSCAD keeps a written unit as it is given: "2500 [mohm]" stays in mohm.
  • A Choice is read and written as its symbol (the capitals in "Written as"), not as the words PSCAD shows in the dialog.
  • find_all() takes the exact definition only. A wildcard or a bare name without master: comes back empty; the Builder's px_find walks the pages for those.

The Builder's runtime does the same with the unit handled for you: px_get(comp, "Value") and px_set(...), which also records the old value so the case is put back at the end. Getting started shows them.

Configuration

ParameterUnitDefaultDescription
DisplayChoice·YESDisplay Title on Icon?Written as NO (No), YES (Yes)
GroupText··Group
MaxReal·1.0Output Value in On State
MinReal·0.0Output Value in Off State
NameText·VarTitleThis is used for display in control panel
ToffText·OFFText for Off Position
TonText·ONText for On Position
ValueChoice·OFFInitial StateWritten as OFF (Off), ON (On)
convChoice·NOConvert Output to the Nearest IntegerWritten as NO (No), YES (Yes)

Related

← master:tfaultn Timed Fault Logic · master:ct_double 2 CT model →