Ejemplo n.º 1
0
 def set_pv_volt(self, volt1, volt2, volt3):
     ps.gom_logger.debug("Setting PV voltage: %s, %s, %s", volt1, volt2,
                         volt3)
     if volt1 > MAX_PV_VOLTAGE or volt2 > MAX_PV_VOLTAGE or volt3 > MAX_PV_VOLTAGE:
         ps.gom_logger.error(
             "PV volt is attempting to be set above MAX_PV_VOLTAGE")
         raise PowerInputError(
             "Invalid Input: voltages must be below %i mV" % MAX_PV_VOLTAGE)
     else:
         v = bytearray(6)
         v[0:2] = ps.toBytes(volt1, 2)
         v[2:4] = ps.toBytes(volt2, 2)
         v[4:] = ps.toBytes(volt3, 2)
         self.write(CMD_SET_PV_VOLT, list(v))
Ejemplo n.º 2
0
    def set_single_output(self, channel, value, delay):
        ps.gom_logger.debug(
            "Setting single channel %s output to value %s after delay %s",
            channel,
            value,
            delay,
        )

        if value not in [0, 1]:
            raise PowerInputError("Invalid Input: value must be 0 or 1")
        else:
            channel_num = GomOutputs[channel].value
            d = ps.toBytes(delay, 2)

            self.write(CMD_SET_SINGLE_OUTPUT, [channel_num, value] + list(d))