Esempio n. 1
0
    # Object holding actual state and work logic.
    # May be anything that will be passed by reference - list, dict, object etc
    obj = {
        'hw_connected': 0,
        'position': 'nan',
        'uposition': 'nan',
        'encposition': 'nan',
        'speed': 'nan',
        'uspeed': 'nan',
        'accel': 'nan',
        'decel': 'nan',
        'anti_play_speed': 'nan',
        'uanti_play_speed': 'nan',
    }

    daemon = SimpleFactory(DaemonProtocol, obj)
    daemon.name = options.name
    obj['daemon'] = daemon

    proto = StandaRSProtocol(serial_num=options.serial_num,
                             obj=obj,
                             debug=options.debug)

    if options.debug:
        daemon._protocol._debug = True

    # Incoming connections
    daemon.listen(options.port)

    daemon._reactor.run()
Esempio n. 2
0
        'hw_connected': 0,
        'addr': options.addr,
        'Current': 0,
        'Voltage': 0,
        'zero_check': '-',
        'zero_check_performed': 'no',
        'V_source': '-',
        'I_auto_range': '-',
        'I_range': '-',
        'V_range': '-',
        'I_limit': '-',
    }

    # Factories for daemon and hardware connections
    # We need two different factories as the protocols are different
    daemon = SimpleFactory(DaemonProtocol, obj)
    hw = SimpleFactory(KeithleyProtocol, obj)

    if options.debug:
        daemon._protocol._debug = True
        hw._protocol._debug = True

    daemon.name = options.name

    obj['daemon'] = daemon
    obj['hw'] = hw

    obj['hw_last_reply_time'] = datetime.datetime(
        1970, 1, 1)  # Arbitrarily old time moment

    # Incoming connections
Esempio n. 3
0
        id = int(string[1:3], 16)
        command = string[3:]

        reply = command

        # print ">", ch, id, command

        if command == 'STATUS':
            if id % 3 == 0:
                reply = 'VALID=1 COUNT=2156 LOG=0 POWER=1 POWERGOOD=1 OVERHEAT=0 BACKPLANE_TEMP=28.187 P2V5_V=2.555 P2V5_I=2.838 P5V_V=4.997 P5V_I=2.745 P6V_V=5.933 P6V_I=0.038 N6V_V=-6.046 N6V_I=0.116 P17V_V=16.955 P17V_I=0.212 N17V_V=-17.080 N17V_I=0.090 P35V_V=34.945 P35V_I=0.031 N35V_V=0.000 N35V_I=0.000 P100V_V=0.000 P100V_I=0.000 N100V_V=0.000 N100V_I=0.000 USER_V=0.000 USER_I=0.000 HEATER_V=27.883 HEATER_I=0.003 MOD2/TEMP=26.250 MOD2/TEMPA=-273.150016 MOD2/TEMPB=-273.150016 MOD2/TEMPC=-273.150016 MOD2/HEATERAOUTPUT=0.900 MOD2/HEATERBOUTPUT=0.900 MOD2/HEATERAP=0 MOD2/HEATERAI=0 MOD2/HEATERAD=0 MOD2/HEATERBP=0 MOD2/HEATERBI=0 MOD2/HEATERBD=0 MOD2/DINPUTS=00000000 MOD2/VCPU_OUTREG0=0 MOD2/VCPU_OUTREG1=0 MOD2/VCPU_OUTREG2=0 MOD2/VCPU_OUTREG3=0 MOD2/VCPU_OUTREG4=0 MOD2/VCPU_OUTREG5=0 MOD2/VCPU_OUTREG6=0 MOD2/VCPU_OUTREG7=0 MOD2/VCPU_OUTREG8=0 MOD2/VCPU_OUTREG9=0 MOD2/VCPU_OUTREG10=0 MOD2/VCPU_OUTREG11=0 MOD2/VCPU_OUTREG12=0 MOD2/VCPU_OUTREG13=0 MOD2/VCPU_OUTREG14=0 MOD2/VCPU_OUTREG15=0 MOD3/TEMP=24.937 MOD4/TEMP=26.562 MOD4/LVLC_V1=0.012 MOD4/LVLC_I1=-0.007 MOD4/LVLC_V2=0.011 MOD4/LVLC_I2=0.000 MOD4/LVLC_V3=0.004 MOD4/LVLC_I3=0.007 MOD4/LVLC_V4=-0.008 MOD4/LVLC_I4=0.005 MOD4/LVLC_V5=-0.002 MOD4/LVLC_I5=-0.003 MOD4/LVLC_V6=0.002 MOD4/LVLC_I6=0.001 MOD4/LVLC_V7=-0.006 MOD4/LVLC_I7=0.019 MOD4/LVLC_V8=0.011 MOD4/LVLC_I8=-0.006 MOD4/LVLC_V9=0.017 MOD4/LVLC_I9=-0.008 MOD4/LVLC_V10=0.008 MOD4/LVLC_I10=0.002 MOD4/LVLC_V11=0.008 MOD4/LVLC_I11=0.000 MOD4/LVLC_V12=0.010 MOD4/LVLC_I12=0.003 MOD4/LVLC_V13=0.016 MOD4/LVLC_I13=0.002 MOD4/LVLC_V14=0.010 MOD4/LVLC_I14=-0.002 MOD4/LVLC_V15=0.011 MOD4/LVLC_I15=0.004 MOD4/LVLC_V16=0.010 MOD4/LVLC_I16=-0.018 MOD4/LVLC_V17=-0.001 MOD4/LVLC_I17=0.002 MOD4/LVLC_V18=0.011 MOD4/LVLC_I18=0.001 MOD4/LVLC_V19=0.008 MOD4/LVLC_I19=-0.003 MOD4/LVLC_V20=0.002 MOD4/LVLC_I20=0.004 MOD4/LVLC_V21=-0.006 MOD4/LVLC_I21=0.003 MOD4/LVLC_V22=-0.001 MOD4/LVLC_I22=-0.003 MOD4/LVLC_V23=0.013 MOD4/LVLC_I23=-0.006 MOD4/LVLC_V24=0.008 MOD4/LVLC_I24=-0.005 MOD4/LVHC_V1=0.000 MOD4/LVHC_I1=-0.013 MOD4/LVHC_V2=0.000 MOD4/LVHC_I2=0.093 MOD4/LVHC_V3=0.000 MOD4/LVHC_I3=0.069 MOD4/LVHC_V4=0.000 MOD4/LVHC_I4=-0.054 MOD4/LVHC_V5=0.000 MOD4/LVHC_I5=-0.098 MOD4/LVHC_V6=0.000 MOD4/LVHC_I6=0.016 MOD4/DINPUTS=00000000 MOD4/VCPU_OUTREG0=0 MOD4/VCPU_OUTREG1=0 MOD4/VCPU_OUTREG2=0 MOD4/VCPU_OUTREG3=0 MOD4/VCPU_OUTREG4=0 MOD4/VCPU_OUTREG5=0 MOD4/VCPU_OUTREG6=0 MOD4/VCPU_OUTREG7=0 MOD4/VCPU_OUTREG8=0 MOD4/VCPU_OUTREG9=0 MOD4/VCPU_OUTREG10=0 MOD4/VCPU_OUTREG11=0 MOD4/VCPU_OUTREG12=0 MOD4/VCPU_OUTREG13=0 MOD4/VCPU_OUTREG14=0 MOD4/VCPU_OUTREG15=0 MOD5/TEMP=26.062 MOD6/TEMP=26.000 MOD7/TEMP=26.062 MOD8/TEMP=26.250 MOD9/TEMP=26.625 MOD9/HVLC_V1=0.020 MOD9/HVLC_I1=-0.018 MOD9/HVLC_V2=0.020 MOD9/HVLC_I2=-0.016 MOD9/HVLC_V3=0.022 MOD9/HVLC_I3=-0.029 MOD9/HVLC_V4=0.021 MOD9/HVLC_I4=-0.005 MOD9/HVLC_V5=0.020 MOD9/HVLC_I5=-0.003 MOD9/HVLC_V6=0.021 MOD9/HVLC_I6=-0.001 MOD9/HVLC_V7=0.020 MOD9/HVLC_I7=-0.009 MOD9/HVLC_V8=0.022 MOD9/HVLC_I8=-0.006 MOD9/HVLC_V9=0.022 MOD9/HVLC_I9=-0.007 MOD9/HVLC_V10=0.022 MOD9/HVLC_I10=-0.024 MOD9/HVLC_V11=0.020 MOD9/HVLC_I11=-0.017 MOD9/HVLC_V12=0.021 MOD9/HVLC_I12=-0.013 MOD9/HVLC_V13=0.019 MOD9/HVLC_I13=-0.020 MOD9/HVLC_V14=0.022 MOD9/HVLC_I14=-0.004 MOD9/HVLC_V15=0.019 MOD9/HVLC_I15=-0.017 MOD9/HVLC_V16=0.020 MOD9/HVLC_I16=-0.020 MOD9/HVLC_V17=0.017 MOD9/HVLC_I17=-0.009 MOD9/HVLC_V18=0.020 MOD9/HVLC_I18=-0.010 MOD9/HVLC_V19=0.022 MOD9/HVLC_I19=-0.011 MOD9/HVLC_V20=0.022 MOD9/HVLC_I20=-0.016 MOD9/HVLC_V21=0.022 MOD9/HVLC_I21=-0.022 MOD9/HVLC_V22=0.022 MOD9/HVLC_I22=-0.011 MOD9/HVLC_V23=0.021 MOD9/HVLC_I23=-0.012 MOD9/HVLC_V24=0.022 MOD9/HVLC_I24=-0.007 MOD9/HVHC_V1=0.001 MOD9/HVHC_I1=-0.021 MOD9/HVHC_V2=0.001 MOD9/HVHC_I2=-0.051 MOD9/HVHC_V3=0.001 MOD9/HVHC_I3=-0.082 MOD9/HVHC_V4=0.001 MOD9/HVHC_I4=-0.111 MOD9/HVHC_V5=0.001 MOD9/HVHC_I5=-0.039 MOD9/HVHC_V6=0.001 MOD9/HVHC_I6=-0.060 MOD10/TEMP=25.000 MOD11/TEMP=25.062'
            elif id % 3 == 1:
                reply = 'VALID=1 COUNT=2111 LOG=0 POWER=1 POWERGOOD=1 OVERHEAT=0 BACKPLANE_TEMP=28.125 P2V5_V=2.556 P2V5_I=2.840 P5V_V=4.997 P5V_I=2.746 P6V_V=5.935 P6V_I=0.038 N6V_V=-6.048 N6V_I=0.116 P17V_V=16.955 P17V_I=0.213 N17V_V=-17.080 N17V_I=0.091 P35V_V=34.947 P35V_I=0.031 N35V_V=0.000 N35V_I=0.000 P100V_V=0.000 P100V_I=0.000 N100V_V=0.000 N100V_I=0.000 USER_V=0.000 USER_I=0.000 HEATER_V=27.858 HEATER_I=0.002 MOD2/TEMP=26.250 MOD2/TEMPA=-273.150016 MOD2/TEMPB=-273.150016 MOD2/TEMPC=-273.150016 MOD2/HEATERAOUTPUT=0.900 MOD2/HEATERBOUTPUT=0.900 MOD2/HEATERAP=0 MOD2/HEATERAI=0 MOD2/HEATERAD=0 MOD2/HEATERBP=0 MOD2/HEATERBI=0 MOD2/HEATERBD=0 MOD2/DINPUTS=00000000 MOD2/VCPU_OUTREG0=0 MOD2/VCPU_OUTREG1=0 MOD2/VCPU_OUTREG2=0 MOD2/VCPU_OUTREG3=0 MOD2/VCPU_OUTREG4=0 MOD2/VCPU_OUTREG5=0 MOD2/VCPU_OUTREG6=0 MOD2/VCPU_OUTREG7=0 MOD2/VCPU_OUTREG8=0 MOD2/VCPU_OUTREG9=0 MOD2/VCPU_OUTREG10=0 MOD2/VCPU_OUTREG11=0 MOD2/VCPU_OUTREG12=0 MOD2/VCPU_OUTREG13=0 MOD2/VCPU_OUTREG14=0 MOD2/VCPU_OUTREG15=0 MOD3/TEMP=24.875 MOD4/TEMP=26.562 MOD4/LVLC_V1=0.013 MOD4/LVLC_I1=-0.001 MOD4/LVLC_V2=0.012 MOD4/LVLC_I2=-0.004 MOD4/LVLC_V3=0.004 MOD4/LVLC_I3=0.011 MOD4/LVLC_V4=-0.008 MOD4/LVLC_I4=0.008 MOD4/LVLC_V5=-0.002 MOD4/LVLC_I5=-0.007 MOD4/LVLC_V6=0.002 MOD4/LVLC_I6=0.001 MOD4/LVLC_V7=-0.006 MOD4/LVLC_I7=0.010 MOD4/LVLC_V8=0.011 MOD4/LVLC_I8=-0.009 MOD4/LVLC_V9=0.017 MOD4/LVLC_I9=-0.010 MOD4/LVLC_V10=0.008 MOD4/LVLC_I10=-0.007 MOD4/LVLC_V11=0.008 MOD4/LVLC_I11=-0.010 MOD4/LVLC_V12=0.010 MOD4/LVLC_I12=-0.008 MOD4/LVLC_V13=0.016 MOD4/LVLC_I13=0.002 MOD4/LVLC_V14=0.010 MOD4/LVLC_I14=-0.004 MOD4/LVLC_V15=0.012 MOD4/LVLC_I15=-0.006 MOD4/LVLC_V16=0.010 MOD4/LVLC_I16=-0.013 MOD4/LVLC_V17=-0.001 MOD4/LVLC_I17=-0.008 MOD4/LVLC_V18=0.011 MOD4/LVLC_I18=-0.008 MOD4/LVLC_V19=0.008 MOD4/LVLC_I19=0.004 MOD4/LVLC_V20=0.003 MOD4/LVLC_I20=-0.002 MOD4/LVLC_V21=-0.006 MOD4/LVLC_I21=-0.002 MOD4/LVLC_V22=-0.001 MOD4/LVLC_I22=-0.013 MOD4/LVLC_V23=0.013 MOD4/LVLC_I23=-0.010 MOD4/LVLC_V24=0.008 MOD4/LVLC_I24=-0.004 MOD4/LVHC_V1=0.000 MOD4/LVHC_I1=0.000 MOD4/LVHC_V2=0.000 MOD4/LVHC_I2=0.044 MOD4/LVHC_V3=0.000 MOD4/LVHC_I3=0.093 MOD4/LVHC_V4=0.000 MOD4/LVHC_I4=-0.125 MOD4/LVHC_V5=0.001 MOD4/LVHC_I5=-0.058 MOD4/LVHC_V6=0.000 MOD4/LVHC_I6=-0.079 MOD4/DINPUTS=00000000 MOD4/VCPU_OUTREG0=0 MOD4/VCPU_OUTREG1=0 MOD4/VCPU_OUTREG2=0 MOD4/VCPU_OUTREG3=0 MOD4/VCPU_OUTREG4=0 MOD4/VCPU_OUTREG5=0 MOD4/VCPU_OUTREG6=0 MOD4/VCPU_OUTREG7=0 MOD4/VCPU_OUTREG8=0 MOD4/VCPU_OUTREG9=0 MOD4/VCPU_OUTREG10=0 MOD4/VCPU_OUTREG11=0 MOD4/VCPU_OUTREG12=0 MOD4/VCPU_OUTREG13=0 MOD4/VCPU_OUTREG14=0 MOD4/VCPU_OUTREG15=0 MOD5/TEMP=26.062 MOD6/TEMP=25.937 MOD7/TEMP=26.000 MOD8/TEMP=26.187 MOD9/TEMP=26.625 MOD9/HVLC_V1=0.020 MOD9/HVLC_I1=-0.022 MOD9/HVLC_V2=0.020 MOD9/HVLC_I2=-0.020 MOD9/HVLC_V3=0.022 MOD9/HVLC_I3=-0.022 MOD9/HVLC_V4=0.021 MOD9/HVLC_I4=-0.005 MOD9/HVLC_V5=0.020 MOD9/HVLC_I5=-0.002 MOD9/HVLC_V6=0.020 MOD9/HVLC_I6=-0.004 MOD9/HVLC_V7=0.020 MOD9/HVLC_I7=-0.010 MOD9/HVLC_V8=0.022 MOD9/HVLC_I8=0.000 MOD9/HVLC_V9=0.021 MOD9/HVLC_I9=-0.007 MOD9/HVLC_V10=0.022 MOD9/HVLC_I10=-0.020 MOD9/HVLC_V11=0.020 MOD9/HVLC_I11=-0.015 MOD9/HVLC_V12=0.021 MOD9/HVLC_I12=-0.011 MOD9/HVLC_V13=0.019 MOD9/HVLC_I13=-0.014 MOD9/HVLC_V14=0.022 MOD9/HVLC_I14=-0.005 MOD9/HVLC_V15=0.019 MOD9/HVLC_I15=-0.018 MOD9/HVLC_V16=0.020 MOD9/HVLC_I16=-0.013 MOD9/HVLC_V17=0.017 MOD9/HVLC_I17=-0.010 MOD9/HVLC_V18=0.021 MOD9/HVLC_I18=-0.012 MOD9/HVLC_V19=0.022 MOD9/HVLC_I19=-0.013 MOD9/HVLC_V20=0.022 MOD9/HVLC_I20=-0.015 MOD9/HVLC_V21=0.022 MOD9/HVLC_I21=-0.016 MOD9/HVLC_V22=0.022 MOD9/HVLC_I22=-0.012 MOD9/HVLC_V23=0.021 MOD9/HVLC_I23=-0.015 MOD9/HVLC_V24=0.022 MOD9/HVLC_I24=-0.005 MOD9/HVHC_V1=0.001 MOD9/HVHC_I1=-0.047 MOD9/HVHC_V2=0.001 MOD9/HVHC_I2=0.017 MOD9/HVHC_V3=0.001 MOD9/HVHC_I3=-0.031 MOD9/HVHC_V4=0.001 MOD9/HVHC_I4=-0.086 MOD9/HVHC_V5=0.001 MOD9/HVHC_I5=-0.034 MOD9/HVHC_V6=0.001 MOD9/HVHC_I6=-0.086 MOD10/TEMP=25.000 MOD11/TEMP=25.062'
            else:
                reply = 'VALID=1 COUNT=2133 LOG=0 POWER=1 POWERGOOD=1 OVERHEAT=0 BACKPLANE_TEMP=28.125 P2V5_V=2.556 P2V5_I=2.838 P5V_V=4.995 P5V_I=2.745 P6V_V=5.933 P6V_I=0.038 N6V_V=-6.047 N6V_I=0.116 P17V_V=16.955 P17V_I=0.212 N17V_V=-17.080 N17V_I=0.090 P35V_V=34.945 P35V_I=0.031 N35V_V=0.000 N35V_I=0.000 P100V_V=0.000 P100V_I=0.000 N100V_V=0.000 N100V_I=0.000 USER_V=0.000 USER_I=0.000 HEATER_V=27.881 HEATER_I=0.001 MOD2/TEMP=26.250 MOD2/TEMPA=-273.150016 MOD2/TEMPB=-273.150016 MOD2/TEMPC=-273.150016 MOD2/HEATERAOUTPUT=0.900 MOD2/HEATERBOUTPUT=0.900 MOD2/HEATERAP=0 MOD2/HEATERAI=0 MOD2/HEATERAD=0 MOD2/HEATERBP=0 MOD2/HEATERBI=0 MOD2/HEATERBD=0 MOD2/DINPUTS=00000000 MOD2/VCPU_OUTREG0=0 MOD2/VCPU_OUTREG1=0 MOD2/VCPU_OUTREG2=0 MOD2/VCPU_OUTREG3=0 MOD2/VCPU_OUTREG4=0 MOD2/VCPU_OUTREG5=0 MOD2/VCPU_OUTREG6=0 MOD2/VCPU_OUTREG7=0 MOD2/VCPU_OUTREG8=0 MOD2/VCPU_OUTREG9=0 MOD2/VCPU_OUTREG10=0 MOD2/VCPU_OUTREG11=0 MOD2/VCPU_OUTREG12=0 MOD2/VCPU_OUTREG13=0 MOD2/VCPU_OUTREG14=0 MOD2/VCPU_OUTREG15=0 MOD3/TEMP=24.937 MOD4/TEMP=26.562 MOD4/LVLC_V1=0.013 MOD4/LVLC_I1=-0.008 MOD4/LVLC_V2=0.012 MOD4/LVLC_I2=0.004 MOD4/LVLC_V3=0.004 MOD4/LVLC_I3=0.004 MOD4/LVLC_V4=-0.008 MOD4/LVLC_I4=0.001 MOD4/LVLC_V5=-0.002 MOD4/LVLC_I5=-0.006 MOD4/LVLC_V6=0.002 MOD4/LVLC_I6=-0.007 MOD4/LVLC_V7=-0.006 MOD4/LVLC_I7=0.012 MOD4/LVLC_V8=0.011 MOD4/LVLC_I8=-0.014 MOD4/LVLC_V9=0.017 MOD4/LVLC_I9=-0.007 MOD4/LVLC_V10=0.008 MOD4/LVLC_I10=-0.005 MOD4/LVLC_V11=0.008 MOD4/LVLC_I11=-0.008 MOD4/LVLC_V12=0.010 MOD4/LVLC_I12=-0.004 MOD4/LVLC_V13=0.016 MOD4/LVLC_I13=0.000 MOD4/LVLC_V14=0.010 MOD4/LVLC_I14=-0.005 MOD4/LVLC_V15=0.012 MOD4/LVLC_I15=-0.007 MOD4/LVLC_V16=0.010 MOD4/LVLC_I16=-0.010 MOD4/LVLC_V17=-0.001 MOD4/LVLC_I17=-0.005 MOD4/LVLC_V18=0.011 MOD4/LVLC_I18=-0.005 MOD4/LVLC_V19=0.008 MOD4/LVLC_I19=-0.003 MOD4/LVLC_V20=0.003 MOD4/LVLC_I20=-0.002 MOD4/LVLC_V21=-0.006 MOD4/LVLC_I21=-0.004 MOD4/LVLC_V22=-0.001 MOD4/LVLC_I22=-0.011 MOD4/LVLC_V23=0.013 MOD4/LVLC_I23=-0.002 MOD4/LVLC_V24=0.008 MOD4/LVLC_I24=-0.006 MOD4/LVHC_V1=0.000 MOD4/LVHC_I1=0.077 MOD4/LVHC_V2=0.000 MOD4/LVHC_I2=0.061 MOD4/LVHC_V3=0.000 MOD4/LVHC_I3=0.083 MOD4/LVHC_V4=0.000 MOD4/LVHC_I4=-0.122 MOD4/LVHC_V5=0.001 MOD4/LVHC_I5=-0.147 MOD4/LVHC_V6=0.000 MOD4/LVHC_I6=-0.016 MOD4/DINPUTS=00000000 MOD4/VCPU_OUTREG0=0 MOD4/VCPU_OUTREG1=0 MOD4/VCPU_OUTREG2=0 MOD4/VCPU_OUTREG3=0 MOD4/VCPU_OUTREG4=0 MOD4/VCPU_OUTREG5=0 MOD4/VCPU_OUTREG6=0 MOD4/VCPU_OUTREG7=0 MOD4/VCPU_OUTREG8=0 MOD4/VCPU_OUTREG9=0 MOD4/VCPU_OUTREG10=0 MOD4/VCPU_OUTREG11=0 MOD4/VCPU_OUTREG12=0 MOD4/VCPU_OUTREG13=0 MOD4/VCPU_OUTREG14=0 MOD4/VCPU_OUTREG15=0 MOD5/TEMP=26.062 MOD6/TEMP=25.937 MOD7/TEMP=26.062 MOD8/TEMP=26.187 MOD9/TEMP=26.625 MOD9/HVLC_V1=0.019 MOD9/HVLC_I1=-0.013 MOD9/HVLC_V2=0.020 MOD9/HVLC_I2=-0.019 MOD9/HVLC_V3=0.022 MOD9/HVLC_I3=-0.024 MOD9/HVLC_V4=0.021 MOD9/HVLC_I4=0.000 MOD9/HVLC_V5=0.021 MOD9/HVLC_I5=0.007 MOD9/HVLC_V6=0.020 MOD9/HVLC_I6=0.002 MOD9/HVLC_V7=0.020 MOD9/HVLC_I7=-0.003 MOD9/HVLC_V8=0.022 MOD9/HVLC_I8=0.000 MOD9/HVLC_V9=0.021 MOD9/HVLC_I9=0.011 MOD9/HVLC_V10=0.022 MOD9/HVLC_I10=-0.020 MOD9/HVLC_V11=0.021 MOD9/HVLC_I11=-0.009 MOD9/HVLC_V12=0.021 MOD9/HVLC_I12=-0.015 MOD9/HVLC_V13=0.019 MOD9/HVLC_I13=-0.014 MOD9/HVLC_V14=0.022 MOD9/HVLC_I14=-0.001 MOD9/HVLC_V15=0.019 MOD9/HVLC_I15=-0.020 MOD9/HVLC_V16=0.020 MOD9/HVLC_I16=-0.013 MOD9/HVLC_V17=0.017 MOD9/HVLC_I17=-0.003 MOD9/HVLC_V18=0.020 MOD9/HVLC_I18=-0.008 MOD9/HVLC_V19=0.022 MOD9/HVLC_I19=-0.013 MOD9/HVLC_V20=0.022 MOD9/HVLC_I20=0.000 MOD9/HVLC_V21=0.022 MOD9/HVLC_I21=-0.017 MOD9/HVLC_V22=0.022 MOD9/HVLC_I22=0.001 MOD9/HVLC_V23=0.021 MOD9/HVLC_I23=-0.016 MOD9/HVLC_V24=0.022 MOD9/HVLC_I24=-0.006 MOD9/HVHC_V1=0.001 MOD9/HVHC_I1=-0.015 MOD9/HVHC_V2=0.001 MOD9/HVHC_I2=0.028 MOD9/HVHC_V3=0.001 MOD9/HVHC_I3=-0.013 MOD9/HVHC_V4=0.001 MOD9/HVHC_I4=-0.070 MOD9/HVHC_V5=0.001 MOD9/HVHC_I5=-0.020 MOD9/HVHC_V6=0.001 MOD9/HVHC_I6=-0.068 MOD10/TEMP=25.000 MOD11/TEMP=25.062'

        elif command == 'SYSTEM':
            reply = 'BACKPLANE_TYPE=1 BACKPLANE_REV=4 BACKPLANE_VERSION=1.0.876 BACKPLANE_ID=0078F5C1427AF054 POWER_ID=000000E73C20 MOD_PRESENT=7FE MOD1_TYPE=0 MOD1_REV=0 MOD1_VERSION=0.0.0 MOD1_ID=0000000000000000 MOD2_TYPE=11 MOD2_REV=0 MOD2_VERSION=1.0.797 MOD2_ID=01388E0AE6240B9F MOD3_TYPE=1 MOD3_REV=3 MOD3_VERSION=1.0.719 MOD3_ID=013C50DE01D5DA98 MOD4_TYPE=9 MOD4_REV=0 MOD4_VERSION=1.0.788 MOD4_ID=01381826F0236489 MOD5_TYPE=2 MOD5_REV=7 MOD5_VERSION=1.0.860 MOD5_ID=01363AADDDCEBDE3 MOD6_TYPE=2 MOD6_REV=7 MOD6_VERSION=1.0.860 MOD6_ID=013DAFD7D1F80B71 MOD7_TYPE=2 MOD7_REV=7 MOD7_VERSION=1.0.860 MOD7_ID=01381B219C1EFA1D MOD8_TYPE=2 MOD8_REV=7 MOD8_VERSION=1.0.860 MOD8_ID=0136BE5A2EB82EFD MOD9_TYPE=8 MOD9_REV=0 MOD9_VERSION=1.0.833 MOD9_ID=013254102277B1BA MOD10_TYPE=1 MOD10_REV=3 MOD10_VERSION=1.0.719 MOD10_ID=01347ED35770658C MOD11_TYPE=1 MOD11_REV=3 MOD11_VERSION=1.0.719 MOD11_ID=0138F49864C622EE MOD12_TYPE=0 MOD12_REV=0 MOD12_VERSION=0.0.0 MOD12_ID=0000000000000000'

        elif command == 'FRAME':
            reply = 'TIMER=000000024AFC6CA1 RBUF=0 WBUF=0 BUF1SAMPLE=0 BUF2SAMPLE=0 BUF3SAMPLE=0 BUF1COMPLETE=0 BUF2COMPLETE=0 BUF3COMPLETE=0 BUF1MODE=0 BUF2MODE=0 BUF3MODE=0 BUF1BASE=2684354560 BUF2BASE=3221225472 BUF3BASE=3758096384 BUF1FRAME=0 BUF2FRAME=0 BUF3FRAME=0 BUF1WIDTH=0 BUF1HEIGHT=0 BUF2WIDTH=0 BUF2HEIGHT=0 BUF3WIDTH=0 BUF3HEIGHT=0 BUF1PIXELS=0 BUF1LINES=0 BUF2PIXELS=0 BUF2LINES=0 BUF3PIXELS=0 BUF3LINES=0 BUF1RAWBLOCKS=0 BUF1RAWLINES=0 BUF2RAWBLOCKS=0 BUF2RAWLINES=0 BUF3RAWBLOCKS=0 BUF3RAWLINES=0 BUF1RAWOFFSET=0 BUF2RAWOFFSET=0 BUF3RAWOFFSET=0 BUF1TIMESTAMP=0000000000000000 BUF2TIMESTAMP=0000000000000000 BUF3TIMESTAMP=0000000000000000 BUF1RETIMESTAMP=0000000000000000 BUF2RETIMESTAMP=0000000000000000 BUF3RETIMESTAMP=0000000000000000 BUF1FETIMESTAMP=0000000000000000 BUF2FETIMESTAMP=0000000000000000 BUF3FETIMESTAMP=0000000000000000 BUF1REATIMESTAMP=0000000000000000 BUF2REATIMESTAMP=0000000000000000 BUF3REATIMESTAMP=0000000000000000 BUF1FEATIMESTAMP=0000000000000000 BUF2FEATIMESTAMP=0000000000000000 BUF3FEATIMESTAMP=0000000000000000 BUF1REBTIMESTAMP=0000000000000000 BUF2REBTIMESTAMP=0000000000000000 BUF3REBTIMESTAMP=0000000000000000 BUF1FEBTIMESTAMP=0000000000000000 BUF2FEBTIMESTAMP=0000000000000000 BUF3FEBTIMESTAMP=0000000000000000'

        self.message('<%02x%s' % (id, reply))


if __name__ == '__main__':
    obj = {}
    daemon = SimpleFactory(ArchonFakeProtocol, obj)
    daemon.listen(4242)

    daemon._reactor.run()
Esempio n. 4
0
    # Object holding actual state and work logic.
    # May be anything that will be passed by reference - list, dict, object etc
    obj = {
        'hw_connected': 0,
        'V1': np.nan,
        'V2': np.nan,
        'V3': np.nan,
        'I1': np.nan,
        'I2': np.nan,
        'I3': np.nan,
        'O1': -1,
        'O2': -1,
        'O3': -1
    }

    daemon = SimpleFactory(DaemonProtocol, obj)
    hw = SimpleFactory(Owon_odp6033Protocol, obj)

    daemon.name = options.name

    obj['daemon'] = daemon
    obj['hw'] = hw

    if options.debug:
        daemon._protocol._debug = True
        hw._protocol._debug = True

    # Incoming connections
    daemon.listen(options.port)
    # Outgoing connection
    hw.connect(options.hw_host, options.hw_port)
Esempio n. 5
0
        log.startLogging(sys.stdout)

    if options.server:
        # Listen for incoming TCP connections
        print("Listening for incoming TCP connections on port %d" % options.port)
        daemon.listen(options.port)

        # Serve files from web
        root = File(r"web")
        root.putChild(b"", File('web/main.html'))
        root.putChild(b"monitor", WebMonitor(factory=daemon, object=obj))
        if options.passwd_file and os.path.exists(options.passwd_file):
            site = Site(Auth(root, options.passwd_file))
        else:
            site = Site(root)

        # WebSockets
        if _HAVE_TXSOCKJS:
            ws = SimpleFactory(WSProtocol, obj)
            obj['ws'] = ws
            root.putChild(b"ws", SockJSResource(ws))

        # Database connection
        obj['db'] = DB(dbhost=options.db_host)
        obj['db_status_timestamp'] = datetime.datetime.utcfromtimestamp(0)

        print("Listening for incoming HTTP connections on port %d" % options.http_port)
        TCP4ServerEndpoint(daemon._reactor, options.http_port).listen(site)

    daemon._reactor.run()