Shell Eco Fuelcell controller

Dependencies:   FastPWM mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers components.cpp Source File

components.cpp

00001 #include "mbed.h"
00002 
00003 typedef struct  
00004 {
00005     uint16_t voltage_act;       // Actual CAP Voltage
00006     uint16_t voltage_low;       // Switch to full current
00007     uint16_t voltage_mid;       // Switch to medium current
00008     uint16_t voltage_high;      // Switch to minimum current
00009     uint16_t voltage_max;       // Stopp loading
00010     uint16_t voltage_down;      // reduce Voltage (CAP down)
00011     uint16_t current_low;       // minimum current
00012     uint16_t current_mid;       // medium current
00013     uint16_t current_high;      // high current
00014 } struct_cap;
00015 
00016 typedef struct 
00017 {
00018     uint16_t air_needed;
00019     uint16_t current_act;
00020     uint16_t current_load;
00021     uint16_t temp_act;          
00022     uint16_t temp_max;
00023     uint16_t voltage_act;
00024     uint16_t voltage_max; 
00025 } struct_fuelcell;
00026 
00027 typedef struct 
00028 { 
00029     bool     fan_override;
00030     uint16_t fan_over_pwm; //name
00031     uint16_t fan_p;
00032     uint16_t fan_i;
00033     uint16_t fan_thr;
00034     short    fan_up;        //add
00035     short    fan_up_count;  //add
00036     short    fan_pwm;
00037     uint16_t fan_pwm_act;
00038     bool     pump_override;
00039     uint16_t pump_over_pwm; //name
00040     uint16_t pump_min;
00041     uint16_t pump_p;
00042     uint16_t pump_i;
00043     short    pump_up;       //add
00044     short    pump_up_count; //add
00045     short    pump_pwm;
00046     uint16_t pump_pwm_act;
00047     uint16_t temp_out;
00048 } struct_h2o;
00049 
00050 typedef struct 
00051 {
00052     uint16_t current_act;
00053     uint16_t current_delta;
00054     uint16_t current_load;
00055     uint16_t i;                     // added
00056     uint16_t pwm;
00057     uint16_t pwm_act;
00058     uint16_t temp_act;
00059     uint16_t temp_max;
00060 } struct_mosfet;
00061 
00062 typedef struct 
00063 {
00064     uint16_t air_current; 
00065     uint16_t air_needed;
00066     uint16_t water_created; //name
00067     uint16_t back_lower;
00068     uint16_t delta_t;
00069     uint16_t lambda;
00070     uint16_t lambda_max;
00071     uint16_t lambda_min;
00072     short    lambda_delta;
00073     short    lambda_delta_sum;
00074     bool     pump_on;
00075     bool     pump_override;
00076     uint16_t pump_over_load; //name
00077     uint16_t pump_load;      //name
00078     uint16_t pump_load_act;  //name
00079     short    pump_up;
00080     short    pump_up_count;
00081     uint16_t pump_pwm_1;
00082     uint16_t pump_pwm_2;
00083     bool     pump_dual;     //name
00084     uint16_t pump_dual_on;  //added
00085     uint16_t pump_dual_off; //added
00086     uint16_t rh_out_delta
00087     uint16_t rh_pump_load;
00088     uint16_t rh_pump_min;          
00089     uint16_t rh_pump_max;        
00090     uint16_t rh_out_min;
00091     uint16_t rh_out_max;
00092     uint16_t rh_back_p;
00093     uint16_t rh_in;
00094     uint16_t rh_out;
00095     uint16_t temp_in;
00096     uint16_t temp_out;              // added
00097     uint16_t temp_calc;
00098     uint16_t water_extracted;
00099     uint16_t water_in;
00100     uint16_t water_out;
00101    
00102 } struct_o2;
00103 
00104 typedef struct 
00105 {
00106     bool capdown;
00107     bool drive;
00108     bool master;
00109     bool safety;
00110 } struct_switch;
00111 
00112 typedef struct 
00113 {
00114     bool cap_down_load;
00115     bool cap_down_reset;
00116     bool cap_load;
00117     bool cap_voltage_reset;
00118     bool fuelcell;
00119     bool fc_overtemp;
00120     bool fc_overvoltage;
00121     bool load;
00122     bool load_act;
00123     bool load_reset;
00124     bool mosfet;
00125     bool mos_overtemp;
00126     bool run;
00127     bool temp;
00128     bool voltage;
00129     uint16_t count;
00130     uint16_t h2_analog;
00131     uint16_t safety_V;
00132     uint16_t current_out;
00133 } struct_system;
00134 
00135 typedef struct 
00136 {
00137     bool o2_in;
00138     bool o2_out;
00139     bool mosfet_temp;
00140     bool fc_voltage;
00141     bool cap_voltage;
00142     bool mosfet_cur;
00143     bool h2o_temp_out;              
00144     bool t_1;
00145     bool t_2;
00146     bool t_3;
00147     bool t_4;
00148     bool t_5;
00149     bool t_6;
00150     bool t_7;
00151     bool t_8;
00152     bool o_1;
00153     bool o_2;
00154     bool o_3;
00155     bool o_4;
00156     bool o_5;
00157     bool o_6;
00158     bool o_7;  
00159 }struct_error;
00160 
00161 /*
00162 struct_cap      cap;
00163 struct_fuelcell fuelcell;
00164 struct_h2o      h2o;
00165 struct_mosfet   mosfet;
00166 struct_o2       o2;
00167 struct_switch   switches;
00168 struct_system   sys;
00169 struct_error    error;
00170 */