]> git.frykholm.com Git - heatpump.git/blobdiff - heatpump.py
Use top temp for controlling compressor.
[heatpump.git] / heatpump.py
index d715d07c8b09dcdeb398bc12982c2b8a5de96e7f..007575287bae3ecf55ca00a34b02650c74c42056 100644 (file)
@@ -1,7 +1,7 @@
 import piplates.DAQCplate as DAQC
 import time
 from decimal import Decimal
-DAQC.setDOUTbit(0,0) 
+#DAQC.setDOUTbit(0,0) 
 #thermistor reading function
 def compressor(state=None):
     if state==None:
@@ -12,7 +12,7 @@ def compressor(state=None):
         DAQC.clrDOUTbit(0,0) 
 
 def temp_get(volts,supply_voltage=5):
-    divider_resistor=10000
+    divider_resistor=1500
     ohms = Decimal(divider_resistor*supply_voltage/volts-divider_resistor) #calculate the ohms of the thermisttor
     #IVT oem NTC
     a = Decimal(1.298022762e-3)
@@ -26,16 +26,18 @@ def temp_get(volts,supply_voltage=5):
 
 while(True):
     vv_retur=temp_get(DAQC.getADC(0,0),DAQC.getADC(0,8))
+    vv_top=temp_get(DAQC.getADC(0,2),DAQC.getADC(0,8))
     hetgas=temp_get(DAQC.getADC(0,1),DAQC.getADC(0,8))
     print("VV retur:",vv_retur)
+    print("VV top:",vv_top)
     print("Hetgas:",hetgas)
     print("Kompressor:",compressor())
-    if vv_retur < 35:
+    if vv_top < 35:
         compressor(True)
-        print("Returtemp under 35. Startar kompressor")
-    if vv_retur > 45:
+        print("Toptemp under 35. Startar kompressor")
+    if vv_top > 45:
         compressor(False)
-        print("Returtemp över 45. Stänger av kompressor")
+        print("Toptemp över 45. Stänger av kompressor")
 #    import pdb;pdb.set_trace()
     time.sleep(1)