Origin firmware.

Dependencies:   PID QEI SB1602E mbed-rtos mbed

Fork of PreHeater by Kazu Zamasu

Files at this revision

API Documentation at this revision

Comitter:
Hapi_Tech
Date:
Sat Jul 04 21:22:13 2015 +0000
Parent:
8:984dff005969
Commit message:
Rev1;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 984dff005969 -r 3e9f4d44b4b5 main.cpp
--- a/main.cpp	Fri Jul 03 11:51:51 2015 +0000
+++ b/main.cpp	Sat Jul 04 21:22:13 2015 +0000
@@ -41,7 +41,7 @@
 #define P 0.1 //propotional band
 #define I 1.5 //Integral
 #define D 1.0 //Devide
-#define RATE 0.1 //update time sec
+#define RATE 0.05 //update time sec
 #define InitialSP 30.0 // Boot Setpoint initial temeprature
 PID TIC(P, I, D, RATE);
 
@@ -130,10 +130,22 @@
     RunPB.rise(&runmode);
     Thread thread(cal_temp);
     rtostime = RATE * 1000;
+
+/* Initial startup bias culcuration */
+    if ((temp_sv_input - temp_pv) >= 50) {
+        Bias = 50.0;
+        }else if ((temp_sv_input - temp_pv) >= 30){
+            Bias = 30.0;
+                    }else if ((temp_sv_input - temp_pv) >= 20){
+                        Bias = 20.0;
+        } else {
+            Bias = 0.0;
+        }
+        
     while (1) {
         /*PID control*/
-#define SV_LL 0.0 //PID setpoint % value for lo limit
-#define SV_HL 100.0 //PID setpoint % value for high limit
+#define SV_LL 30.0 //PID setpoint TempC value for lo limit
+#define SV_HL 100.0 //PID setpoint TempC value for high limit
         TIC.setInputLimits(SV_LL, SV_HL);
 #define OV_LL 0.0 //PID calcurate output value 0.0 = 0%
 #define OV_HL 100.0 //PID calcurate output value 1.0 = 100%