def bus_zsc_refresh(self) -> int: """Recomputes Zsc for active bus for present circuit configuration. Return 1 if the procedure was successful.""" result = self.dss_obj.BUSI(1, 0) Base.check_assertion_result(result, "Zsc recomputes failed!", "Zsc can not be recomputed!", expected_value=1) return result
def bus_coord_defined(self) -> int: """Returns 1 if a coordinate has been defined for this bus; otherwise, it will return 0.""" result = self.dss_obj.BUSI(2, 0) Base.check_assertion_result(result, "Bus coordinate not defined!", "Bus coordinates not find! The program " "will run normally", expected_value=1) return result
def ctrlqueue_pop_action(self) -> int: """Pops next action off the action list and makes it the active action. Returns zero if none.""" try: return self.dss_obj.CtrlQueueI(ctypes.c_int32(9), ctypes.c_int32(0)) except Exception as e: Base.warn_msg( "An error occur when tried to *Pop Next Action of CrlQueue* check if *Queue* is NOT empty", e)
def ctrlqueue_do_all_queue(self) -> int: """Forces the execution of all control actions stored at the control queue. Returns 0.""" try: return self.dss_obj.CtrlQueueI(ctypes.c_int32(11), ctypes.c_int32(0)) except Exception as e: Base.warn_msg( "An error occur when tried to *Do All Control Actions of CrlQueue* check if *Queue* is NOT " "empty", e)
def ctrlqueue_show(self, dss) -> int: """Shows the entire control queue in CSV format.""" try: return self.dss_obj.CtrlQueueI(ctypes.c_int32(7), ctypes.c_int32(0)) except Exception as e: Base.warn_msg( "An error occur when tried to get *Num Actions of CrlQueue* check if *Queue* is NOT empty", e)
def ctrlqueue_num_actions(self) -> int: """Gets the number of actions on the current action list (that have been popped off the control queue by CheckControlActions).""" try: return self.dss_obj.CtrlQueueI(ctypes.c_int32(2), ctypes.c_int32(0)) except Exception as e: Base.warn_msg( "An error occur when tried to get *Num Actions of CrlQueue* check if *Queue* is NOT empty", e)
def capacitors_subtract_step(self) -> int: """Subtracts one step of the capacitor if available. If no more steps, returns 0.""" result = self.dss_obj.CapacitorsI(8, 0) Base.check_assertion_result(result, "Capacitor step problem detect!", "A problem occur when tried to subtract " "step to a capacitor. Check capacitor/" "bank capacitor existence or available " "steps!", expected_value=1) return result
def capacitors_add_step(self) -> int: """Adds one step of the capacitor if available. If successful returns 1.""" result = self.dss_obj.CapacitorsI(7, 0) Base.check_assertion_result(result, "Capacitor step problem detect!", "A problem occur when tried to adds " "step to a capacitor. Check capacitor/" "bank capacitor existence or available " "steps!", expected_value=1) return result
def bus_write_y(self, param_coordinate: float) -> int: """Allows to write the Y coordinate for the bus. Returns 0. :param param_coordinate: The Y coordinate, if it's None, Y will be 0.0 """ param_coordinate = Base.check_float_param(param_coordinate) result = self.dss_obj.BUSF(4, ctypes.c_double(param_coordinate)) Base.check_assertion_result( result, "Write Y coordinate failed!", "Something wrong when tried defined the Y " "coordinate!") return result
def transformers_write_kva(self, argument) -> float: """Sets the active winding kVA rating. On winding 1, this also determines normal and emergency current ratings for all windings. """ argument = Base.check_float_param(argument) return float( self.dss_obj.TransformersF(ctypes.c_int32(11), ctypes.c_double(argument)))
def circuit_all_node_vmag_pu_by_phase(self, argument: int = 1) -> List[float]: """Returns array of doubles representing the voltage magnitudes (in per unit) for nodes on the specified phase. The phase must be specified in the Argument2.""" argument = Base.check_int_param(argument, default=1) # Phase 1 as default return Bridge.VarArrayFunction(self.dss_obj.CircuitV, 15, argument, '')
def pdelements_write_pct_permanent(self, argument) -> float: """Sets the percent of faults that are permanent (require repair). Otherwise, fault is assumed to be transient/temporary. """ argument = Base.check_float_param(argument) return float( self.dss_obj.PDElementsF(ctypes.c_int32(3), ctypes.c_double(argument)))
def vsources_write_name(self, argument): """Sets the name of the active VSource.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.VsourcesS(ctypes.c_int32(1), argument.encode('ascii'))) return result.value.decode('ascii')
def regcontrols_write_monitored_bus(self, argument): """Sets the name of the remote regulated bus, in lieu of LDC settings.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.RegControlsS(ctypes.c_int32(3), argument.encode('ascii'))) return result.value.decode('ascii')
def lines_write_cmatrix(self, argument) -> int: """Sets the capacitance matrix (full), nanofarads per unit length. Variant array of doubles.""" argument = Base.check_string_param(argument) t = Text(self.dss_obj) lc = Lines.LinesS(self.dss_obj) lc_name = lc.lines_read_name() return t.text(f'edit Line.{lc_name} Cmatrix = {argument}')
def cktelement_write_display(self, argument: str) -> str: """Allows to modify the name of the active circuit element (not necessarily unique).""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.CktElementS(ctypes.c_int32(2), argument.encode('ascii'))) return result.value.decode('ascii')
def regcontrols_write_delay(self, argument) -> float: """Sets the time delay [s] after arming before the first tap change. Control may reset before actually changing taps. """ argument = Base.check_float_param(argument) return float( self.dss_obj.RegControlsF(ctypes.c_int32(13), ctypes.c_double(argument)))
def regcontrols_write_tap_delay(self, argument) -> float: """Sets the time delay [s] for subsequent tap changes in a set. Control may reset before actually changing taps.""" argument = Base.check_float_param(argument) return float( self.dss_obj.RegControlsF(ctypes.c_int32(15), ctypes.c_double(argument)))
def transformers_write_name(self, argument): """Sets the active transformer by name.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.TransformersS(ctypes.c_int32(3), argument.encode('ascii'))) return result.value.decode('ascii')
def lines_write_xmatrix(self, argument) -> List[float]: """Sets the reactance matrix (full), ohms per unit length. Variant array of doubles.""" argument = Base.check_string_param(argument) t = Text(self.dss_obj) lc = Lines.LinesS(self.dss_obj) lc_name = lc.lines_read_name() return t.text(f'edit Line.{lc_name} Xmatrix = {argument}')
def transformers_write_xfmr_code(self, argument): """Sets the name of an XfrmCode that supplies electrical parameters for this transformer.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.TransformersS(ctypes.c_int32(1), argument.encode('ascii'))) return result.value.decode('ascii')
def meters_write_peak_current(self, argument): """Receives an array of doubles to set values of Peak Current Property.""" argument = Base.check_string_param(argument) t = Text(self.dss_obj) mt = MetersS(self.dss_obj) mt_name = mt.meters_read_name() return t.text(f'edit EnergyMeter.{mt_name} peakcurrent = {argument}')
def regcontrols_write_name(self, argument): """Sets the active RegControl name.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.RegControlsS(ctypes.c_int32(1), argument.encode('ascii'))) return result.value.decode('ascii')
def reclosers_write_name(self, argument): """Sets the name of the active Recloser Object.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.ReclosersS(ctypes.c_int32(1), argument.encode('ascii'))) return result.value.decode('ascii')
def regcontrols_write_transformer(self, argument): """Sets the name of the transformer this regulator controls.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.RegControlsS(ctypes.c_int32(5), argument.encode('ascii'))) return result.value.decode('ascii')
def reclosers_write_monitored_obj(self, argument): """Sets the full name of object this Recloser is monitoring.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.ReclosersS(ctypes.c_int32(3), argument.encode('ascii'))) return result.value.decode('ascii')
def linecodes_write_name(self, argument: str) -> str: """Sets the name of the active LineCode element. The new value must be specified in the argument as a string.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.LineCodesS(ctypes.c_int32(1), argument.encode('ascii'))) return result.value.decode('ascii')
def reclosers_write_switched_obj(self, argument): """Sets the full name of the circuit element that is being switched by this Recloser.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.ReclosersS(ctypes.c_int32(5), argument.encode('ascii'))) return result.value.decode('ascii')
def settings_write_auto_bus_list(self, argument): """Sets the list of Buses or (File=xxxxx) syntax for the AutoAdd solution mode.""" argument = Base.check_string_param(argument) result = ctypes.c_char_p( self.dss_obj.SettingsS(ctypes.c_int32(1), argument.encode('ascii'))) return result.value.decode('ascii')
def transformers_write_xlt(self, argument) -> float: """Sets the percent reactance between windings 2 and 3, on winding 1 kVA base. Use for 3 winding transformers only. """ argument = Base.check_float_param(argument) return float( self.dss_obj.TransformersF(ctypes.c_int32(21), ctypes.c_double(argument)))