def setdc(self, dc):
        self.prevDC = dc
        dc = int(max(min(dc, 255.0), 0.0))
        if parameter.emulate:
            pprint("dutycycle set to " + str(dc))

        else:
            pi.set_PWM_dutycycle(self.GPIO, dc)
Esempio n. 2
0
    def cropPlot(self):
        pprint(self.pushButton_CropPlot.text())
        current_button_text = self.pushButton_CropPlot.text()

        if current_button_text == "Crop":
            self.pushButton_CropPlot.setText("Full Plot")
            self.cropFlag = True
        if current_button_text == "Full Plot":
            self.pushButton_CropPlot.setText("Crop")
            self.cropFlag = False
    def __init__(self, pin, dc=0, freq=1000):
        if parameter.emulate:
            pprint("createt actuator at pin " + str(pin))

        else:
            import pigpio
            global pi
            pi = pigpio.pi()
            #pi = pigpio.pi('soft',8888)

            self.GPIO = pin
            pi.set_mode(self.GPIO, pigpio.OUTPUT)
            pi.set_PWM_frequency(self.GPIO, freq)
            pi.set_PWM_dutycycle(self.GPIO, dc)
            self.prevDC = 0
Esempio n. 4
0
    def lineEdits(self, handle=None):
        if handle == "broker":
            self.mqttBroker = self.lineEdit_MqttBroker.text()
            pprint(self.mqttBroker)
        if handle == "port":
            self.mqttPort = self.lineEdit_Port.text()
            pprint(self.mqttPort)
        if handle == "topic":
            self.mqttTopic = self.lineEdit_Topic.text()
            pprint(self.mqttTopic)

        pprint("LineEDIT")
Esempio n. 5
0
 def initArrays(self):
     self.time = np.array([])
     self.isPower = np.array([])
     self.setPower = np.array([])
     self.startTime = time.time() / 3600
     self.temp1 = np.array([])
     self.temp2 = np.array([])
     self.setTemp = np.array([])
     self.powerCrop = np.array([])
     self.tempCrop = np.array([])
     self.dataPointIndex = 0
     self.floatMData = np.array([])
     self.floatMDataTemp1 = np.array([])
     self.floatMDataTemp2 = np.array([])
     #self.floatMeanCorrFactor = 11
     #self.floatMeanCorrFactor = 61
     self.floatMeanCorrFactor = 4
     self.pidUpdateCounter = 0
     pprint(self.startTime)
     self.prevTempValue = 0
     self.prevPowerValue = 0
Esempio n. 6
0
    def startAutomation(self):
        self.automationCancel = True
        self.TempPID.clear()
        self.FlowPID.clear()
        ##HIER NOCH Clear Function für beide Regler aufrufen
        if self.connectionState == False:
            self.automationCancel = self.alertDialog(
                "You are not connected to a MQTT-Broker, the Data won't be send to a Broker!"
            )
            pprint(self.automationCancel)

        if self.automationCancel == True:
            self.pushButton_StopAutomation.setEnabled(True)
            self.pushButton_StartAutomation.setEnabled(False)
            self.horizontalSlider_3WayValve_2.setEnabled(False)
            self.horizontalSlider_MassFlowValve_2.setEnabled(False)
            self.spinBox_3WayValve_2.setEnabled(False)
            self.spinBox_MassFlowValve_2.setEnabled(False)
            self.initArrays()
            self.automationStartTime = time.time() / 3600 - self.startTime
            self.table.loadTableData(self.tableData)
            self.setStyle("automation")
            #self.MainWindow.setStyleSheet("background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(227, 190, 27 255), stop:1 rgba(251, 216, 17 255));")
            ###
            if self.table.dataLoaded == True:
                pprint("Automation Run Call")
                self.table.horizontalHeader().setSectionResizeMode(
                    QtWidgets.QHeaderView.ResizeToContents)
                #self.table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)

                self.table.automationRun()
            else:
                pprint("Please Load Data")
        Temperatur1Entry.pack()
        Temperatur2Label = Label(root, text="Temperatur 2 (Return) [°C]").pack()
        Temperatur2Entry = Entry(root)
        Temperatur2Entry.pack()
        #ButtonSubmit = Button(root, text="Submit", command=lambda: self.onSubmitButton(PowerEntry.get(), FlowEntry.get(), Temperatur1Entry.get(), Temperatur2Entry.get()))
        ButtonSubmit = Button(root, text="Submit",
                              command=lambda: self.onSubmitButton(PowerEntry.get(), FlowEntry.get(),
                                                                  Temperatur1Entry.get(), Temperatur2Entry.get()))
        ButtonSubmit.pack()

        root.mainloop()

    def onSubmitButton(self, p, v, t1, t2):
        self.Powerreading.value = float(p)
        self.Flowreading.value = float(v)
        self.Temperatur1.value = float(t1)
        self.Temperatur2.value = float(t2)


    def get(self):
        a = [self.Powerreading.value, self.Flowreading.value, 0, self.Temperatur1.value, self.Temperatur2.value]
        return a


if __name__ =='__main__':
    o = observe.Observable()
    hm = HeatMeter(o)
    while True:
        time.sleep(1)
        pprint(hm.getData3())
Esempio n. 8
0
 def exec_(self):
     r = self.app.exec_()
     self.HeatMeter.setExit()
     pprint("exit")
     return r
Esempio n. 9
0
 def sendDataToCloud(self):
     pprint("MESSAGE TO CLOUD ROUTINE WAS CALLED")
Esempio n. 10
0
 def shutDown(self):
     pprint("ShutDownButton was pressed")