コード例 #1
0
    def processThread(self):
        # Laco que executa indefinidamente
        while (True):
            # Retira a proxima operacao da fila
            item = self.queue.get(block = True)
            item = item[1]

            # Verifica a operacao a ser realizada

            if (item[0] == "READ_COUNTERS"):

                # Operação de leitura
                # Solicita os valores - BASE DE TEMPO
                Counter = CountingPRU.Counting(self.getParam("UVX:CountingPRU:" + sys.argv[1] + ":TimeBase"))

                # Atualiza os valores das variáveis EPICS e bloco de leitura associados
                for channel in range (len(BLMs)):
                        self.setParam("UVX:CountingPRU:" + sys.argv[1] + ":" + BLMs[channel], Counter[channel])
                self.updatePVs()
コード例 #2
0
            "type": "enum",
            "enums": ["off", "on"]
        }
    else:
        PVs["UVX:CountingPRU:" + sys.argv[1] + ":" + module] = {
            "type": "int",
            "unit": "gama per second"
        }

PVs["UVX:CountingPRU:" + sys.argv[1] + ":TimeBase"] = {
    "type": "int",
    "unit": "seconds"
}

# Inicializacao da biblioteca de contagem
CountingPRU.Init()


# Time String
def time_string():
    return (time.strftime("%d/%m/%Y, %H:%M:%S - ", time.localtime()))


# Driver EPICS para as placas contadoras SiriusBLM-CPLD
class PSDriver(Driver):

    # Construtor da classe
    def __init__(self):

        # Chama o construtor da superclasse
        Driver.__init__(self)
コード例 #3
0
            except Exception:
                self.tcp.close()
                sys.stdout.write(
                    time_string() +
                    "Connection problem. TCP/IP server was closed. Error:\n\n")
                traceback.print_exc(file=sys.stdout)
                sys.stdout.write("\n")
                sys.stdout.flush()
                time.sleep(5)


# --------------------- MAIN LOOP ---------------------
# -------------------- starts here --------------------

# Initialize CountingPRU
CountingPRU.Init()

# Socket thread
net = Communication(5000)
net.daemon = True
net.start()

# Main loop - Counting Values!
# Counting list stores countings/second, multiplied by 1000
while 1:
    CurrentTimeBase = TimeBase
    Counting = [
        1000 * value / float(CurrentTimeBase)
        for value in CountingPRU.Counting(CurrentTimeBase)
    ]
コード例 #4
0
                            sys.stdout.flush()
                            break

            except Exception:
                self.tcp.close()
                sys.stdout.write(time_string() + "Connection problem. TCP/IP server was closed. Error:\n\n")
                traceback.print_exc(file=sys.stdout)
                sys.stdout.write("\n")
                sys.stdout.flush()
                time.sleep(5)


# --------------------- MAIN LOOP ---------------------
# -------------------- starts here --------------------

# Initialize CountingPRU
CountingPRU.Init()


# Socket thread
net = Communication(5000)
net.daemon = True
net.start()


# Main loop - Counting Values!
# Counting list stores countings/second, multiplied by 1000
while 1:
    CurrentTimeBase = TimeBase
    Counting = [1000 * value / float(CurrentTimeBase) for value in CountingPRU.Counting(CurrentTimeBase)]
コード例 #5
0
                                             str(client_info[1]) +
                                             " disconnected.\n")
                            sys.stdout.flush()
                            break

            except Exception:
                self.tcp.close()
                sys.stdout.write(
                    time_string() +
                    "Connection problem. TCP/IP server was closed. Error:\n\n")
                traceback.print_exc(file=sys.stdout)
                sys.stdout.write("\n")
                sys.stdout.flush()
                time.sleep(5)


# --------------------- MAIN LOOP ---------------------
# -------------------- starts here --------------------

# Initialize CountingPRU
CountingPRU.Init()

# Socket thread
net = Communication(5000)
net.daemon = True
net.start()

# Main loop - Counting Values!
while 1:
    Counting = CountingPRU.Counting(TimeBase)
コード例 #6
0
#bibliotecas
import CountingPRU
import Adafruit_BBIO.GPIO as GPIO
import time

#setup das portas a serem usadas: led, bergoz1A, bergoz1B, bergoz2A, bergoz2B
GPIO.setup("P8_8", GPIO.OUT)
GPIO.setup("P9_14", GPIO.OUT)
GPIO.setup("P9_16", GPIO.OUT)
GPIO.setup("P9_13", GPIO.OUT)
GPIO.setup("P9_15", GPIO.OUT)

GPIO.output("P8_8", GPIO.LOW)

#inicializacao programa
CountingPRU.Init()

#lista de contagem
c = CountingPRU.Counting(1)
print("\n")
print("\n")
print(c[:8])

#seleciona canais 1,2,3 para analisar
d = c[:3]  # lista valores dos 3 1os canais
teste = 1  # variavel que indica qual canal esta sendo testado
testesensoresOK = 0  # variavel que indica sucesso de testes

#seleciona canais 4,5,6 para analisar
D = c[3:6]  # lista valores dos canais 4,5,6
コード例 #7
0
                            # Disconnection
                            print(time_string() + "Client " + client_info[0] +
                                  ":" + str(client_info[1]) +
                                  " disconnected.\n")
                            break

            except Exception:
                self.tcp.close()
                print(time_string() +
                      "Connection problem. TCP/IP server was closed. Error:\n")
                traceback.print_exc(file=sys.stdout)
                time.sleep(5)


# --------------------- MAIN LOOP ---------------------
# -------------------- starts here --------------------

# Socket thread
net = Communication(5000)
net.daemon = True
net.start()

# Main loop - Counting Values!
# Counting list stores countings/second, multiplied by 1000
while 1:
    CurrentTimeBase = TimeBase
    Counting = [
        1000 * value / float(CurrentTimeBase)
        for value in CountingPRU.Counting(int(CurrentTimeBase))
    ]