예제 #1
0
def main(args):

    # CHECKS
    args.monitor = checkGUIMode(not args.monitor)

    # CONNECT
    print "Connecting to climate chamber..."
    chamber = connectClimateChamber()
    ymeteo1 = connectYoctoMeteo(YOCTO.ymeteo1)
    ymeteo2 = connectYoctoMeteo(YOCTO.ymeteo2)

    # STOP & MONITOR
    if args.warmup:
        chamber.forceWarmUp(args.target, args.gradient)
    else:
        chamber.stop()
    monitor(chamber,
            ymeteo1,
            ymeteo2,
            batch=args.monitor,
            out=args.output,
            nsamples=args.nsamples,
            tstep=args.stepsize,
            twidth=args.twidth)

    # DISCONNECT
    print "Closing connection..."
    chamber.disconnect()
    disconnectYoctoMeteo()
예제 #2
0
def main(args):
  
  # CHECKS
  args.batchmode = not checkGUIMode(args.batchmode)
  
  # CONNECT
  print "Connecting to climate chamber..."
  chamber = connectClimateChamber()
  ymeteo1 = connectYoctoMeteo(YOCTO.ymeteo1)
  ymeteo2 = connectYoctoMeteo(YOCTO.ymeteo2)
  
  # RUN & MONITOR
  target   = args.target
  gradient = args.gradient
  airon    = not args.noair
  dryeron  = not args.nodryer
  startManualRun(chamber,target=target,gradient=gradient,air=airon,dryer=dryeron)
  monitor(chamber,ymeteo1,ymeteo2,batch=args.batchmode,out=args.output,
                 nsamples=args.nsamples,tstep=args.stepsize,twidth=args.twidth)
  stopManualRun(chamber)
  
  # DISCONNECT
  print "Closing connection..."
  chamber.disconnect()
  disconnectYoctoMeteo()
예제 #3
0
def main(args):

    # CHECKS
    args.batchmode = not checkGUIMode(args.batchmode)

    # CONNECT
    print "Connecting to climate chamber..."
    chamber = connectClimateChamber()
    ymeteo1 = connectYoctoMeteo(YOCTO.ymeteo1)
    ymeteo2 = connectYoctoMeteo(YOCTO.ymeteo2)

    # RUN & MONITOR
    prgmid = args.prgmid
    nruns = args.nruns
    startProgram(chamber, prgmid, nruns)
    monitor(chamber,
            ymeteo1,
            ymeteo2,
            batch=args.batchmode,
            out=args.output,
            nsamples=args.nsamples,
            tstep=args.stepsize,
            twidth=args.twidth)
    stopProgram(chamber)

    # DISCONNECT
    print "Closing connection..."
    chamber.disconnect()
    disconnectYoctoMeteo()
예제 #4
0
def main(args):

    # CHECKS
    args.batchmode = not checkGUIMode(args.batchmode)

    # PARAMETERS
    kwargs = {
        'batch': args.batchmode,
        'out': args.output,  # name of log file
        'dtime': args.dtime,  # duration of datataking
        'nsamples': args.nsamples,  # number of readings
        'tstep': args.stepsize,  # seconds
        'twidth': args.twidth,  # width of time axis in seconds
        'warmup': args.warmup  # force warm-up during interlock
    }

    # CONNECT
    print "Connecting to climate chamber..."
    chamber = connectClimateChamber()
    ymeteo1 = connectYoctoMeteo(YOCTO.ymeteo1)
    ymeteo2 = connectYoctoMeteo(YOCTO.ymeteo2)

    # MONITOR
    monitor(chamber, ymeteo1, ymeteo2, **kwargs)

    # DISCONNECT
    print "Closing connection..."
    chamber.disconnect()
    disconnectYoctoMeteo()
예제 #5
0
def getCurrentStatus(**kwargs):
    """Get current status."""

    # SETTINGS
    ip = kwargs.get('ip', defaultip)
    logname = kwargs.get('out', "status.txt")
    tformat = '%d-%m-%Y %H:%M:%S'

    # CONNECT
    print "Connecting to climate chamber..."
    chamber = connectClimateChamber(ip=ip)
    ymeteo1 = connectYoctoMeteo(YOCTO.ymeteo1)
    ymeteo2 = connectYoctoMeteo(YOCTO.ymeteo2)

    # GET STATUS
    print "Checking status..."
    tnow = datetime.datetime.now()
    nalarms, nwarns, nmsgs = 0, 0, 0
    if chamber == None:
        string = "  Climate chamber not found in network."
        string += addRow("IP address:  %s" % (ip))
        string += addRow("Time stamp:  %s" % (tnow.strftime(tformat)))
        string += addRow("Setpoint:    ", "Compr. air:  ")
        string += addRow("Temperature: ", "Dryer:       ")
        string += addRow("Temp. YM1:   ", "Messages:    ")
        string += addRow("Temp. YM2:   ", "Warnings:    ")
        string += addRow("Dewp. YM1:   ", "Alarms:      ")
        string += addRow("Dewp. YM2:   ")
    else:
        temp_YM1, temp_YM2, dewp_YM1, dewp_YM2 = "", "", "", ""
        if ymeteo1:
            temp_YM1 = "%.3f" % ymeteo1.getTemp()
            dewp_YM1 = "%.3f" % ymeteo1.getDewp()
        if ymeteo2:
            temp_YM2 = "%.3f" % ymeteo2.getTemp()
            dewp_YM2 = "%.3f" % ymeteo2.getDewp()
        nalarms = checkActiveWarnings(chamber, type=1)
        nwarns = checkActiveWarnings(chamber, type=2)
        nmsgs = checkActiveWarnings(chamber, type=4)
        string = "  Climate chamber's currect status: %s" % (
            getRunStatus(chamber))
        string += addRow("IP address:  %s" % (ip))
        string += addRow("Time stamp:  %s" % (tnow.strftime(tformat)))
        string += addRow(
            "Setpoint:    %8.3f" % (chamber.getSetp()),
            "Compr. air:  %4s" % ('ON' if chamber.getAir() == 1 else 'OFF'))
        string += addRow(
            "Temperature: %8.3f" % (chamber.getTemp()),
            "Dryer:       %4s" % ('ON' if chamber.getDryer() == 1 else 'OFF'))
        string += addRow("Temp. YM1:   %8s" % (temp_YM1),
                         "Messages:    %4d" % (nmsgs))
        string += addRow("Temp. YM2:   %8s" % (temp_YM2),
                         "Warnings:    %4d" % (nwarns))
        string += addRow("Dewp. YM1:   %8s" % (dewp_YM1),
                         "Alarms:      %4d" % (nalarms))
        string += addRow("Dewp. YM2:   %8s" % (dewp_YM2))
    print "Status check finished!"

    # WRITE STATUS
    if logname:
        with open(logname, 'w+') as logfile:
            print "Writing to '%s'" % logname
            print string
            print "Writing status to '%s'..." % logname
            logfile.write(string)
        if nalarms > 0:
            messages = getActiveWarnings(chamber, type=1)
            writeMessages(logname, messages, tag="alarms")
        if nwarns > 0:
            messages = getActiveWarnings(chamber, type=2)
            writeMessages(logname, messages, tag="warnings")
        if nmsgs > 0:
            messages = getActiveWarnings(chamber, type=4)
            writeMessages(logname, messages, tag="messages")

    # DISCONNECT
    print "Closing connection..."
    chamber.disconnect()
    disconnectYoctoMeteo()