Commit e488e1f7 authored by Alén Arias Vázquez's avatar Alén Arias Vázquez 😎

added option to use both channels

parent c698cd5a
......@@ -64,18 +64,28 @@ class CPX400DP(object):
cmd ='IFLOCK\n'
self.send_cmd(cmd)
def turn_on(self, chan=1):
def turn_on_chan(self, chan=1):
cmd ='OP'+str(chan)+' 1\n'
self.log.info("Turning ON Channel {}".format(chan))
self.send_cmd(cmd)
self.CHAN_STATUS[chan-1]=True
def turn_off(self, chan=1):
def turn_off_chan(self, chan=1):
cmd ='OP'+str(chan)+' 0\n'
self.log.info("Turning OFF Channel {}".format(chan))
self.send_cmd(cmd)
self.CHAN_STATUS[chan-1]=False
def turn_on(self):
self.log.info("Turning On Both Channels")
self.turn_on_chan(chan=1)
self.turn_on_chan(chan=2)
def turn_off(self):
self.log.info("Turning Off Both Channels")
self.turn_off_chan(chan=1)
self.turn_off_chan(chan=2)
def get_status_chan(self, chan=1):
cmd ='OP'+str(chan)+'?\n'
self.send_cmd(cmd)
......@@ -97,6 +107,11 @@ class CPX400DP(object):
self.set_current(amps=amps, chan=chan)
self.turn_on(chan=chan)
def setup(self, volts_1=10.0, amps_1=0.3, volts_2=10.0, amps_2=0.3):
self.log.info("Setup Both Channels")
self.setup_chan(self, chan=1, volts=volts_1, amps=amps_1)
self.setup_chan(self, chan=2, volts=volts_2, amps=amps_2)
def get_parameters_chan(self, chan=1):
V = self.get_voltage(chan=chan)
I = self.get_current(chan=chan)
......@@ -122,7 +137,7 @@ def main():
if args.powerup:
psu.setup_chan(chan=args.chan, volts=args.volts, amps=args.amps)
else:
psu.turn_off(chan=args.chan)
psu.turn_off_chan(chan=args.chan)
psu.close()
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment