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_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_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 cktelement_controller(self, argument: int) -> str: """Delivers the Full name of the i-th controller attached to the active circuit element. The i-th controller index must be specified in the argument arg. Ex: Str = Controller(2). See NumControls to determine valid index range.""" try: result = ctypes.c_char_p( self.dss_obj.CktElementS(ctypes.c_int32(5), ctypes.c_int32(argument))) result = result.value.decode('ascii') except Exception as e: result = Base.warn_msg( "Check if exist at least one *Controller* in your circuit", e) return result
def cktelement_write_bus_names(self, dss, argument: List[str]): """Allows to fix an array of strings with the names of all the buses connected to the active circuit element.""" # 1 get size of number of elements conected to the active circuit total_connected = len(self.cktelement_read_bus_names()) result = 0 for _ in range(total_connected): result = dss.text( f"Edit {dss.cktelement_name()} Bus1={argument[0]} Bus2={argument[1]}" ) if not result == 0: result = Base.warn_msg( f"An error occur when tried to *rename Buses* connected to " f"*{dss.cktelement_name()}*", Exception) return result