QITH FLAGS
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TF_conops_BAE1_3 by
EPS.h@0:246d1b5f11ae, 2015-06-30 (annotated)
- Committer:
- sakthipriya
- Date:
- Tue Jun 30 05:55:48 2015 +0000
- Revision:
- 0:246d1b5f11ae
- Child:
- 1:7185136654ce
conops in progress. to check if individual codes are r8
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakthipriya | 0:246d1b5f11ae | 1 | #include "mbed.h" |
sakthipriya | 0:246d1b5f11ae | 2 | |
sakthipriya | 0:246d1b5f11ae | 3 | #define vstart 3.3 |
sakthipriya | 0:246d1b5f11ae | 4 | #define vstep 0.84667 |
sakthipriya | 0:246d1b5f11ae | 5 | #define cstart 0.0691 |
sakthipriya | 0:246d1b5f11ae | 6 | #define cstep 0.09133 |
sakthipriya | 0:246d1b5f11ae | 7 | #define rsens 0.095 |
sakthipriya | 0:246d1b5f11ae | 8 | #define Bnewvalue_start -100//in microTesla...max possible field is .0001 T |
sakthipriya | 0:246d1b5f11ae | 9 | #define Bnewvalue_step 13.333 |
sakthipriya | 0:246d1b5f11ae | 10 | #define AngularSpeed_start -10//max possible ang. velocity in space is 10 deg/sec |
sakthipriya | 0:246d1b5f11ae | 11 | #define AngularSpeed_step 1.3333 |
sakthipriya | 0:246d1b5f11ae | 12 | |
sakthipriya | 0:246d1b5f11ae | 13 | /***********************************************Configuring Peripherals*******************************************************************/ |
sakthipriya | 0:246d1b5f11ae | 14 | |
sakthipriya | 0:246d1b5f11ae | 15 | DigitalOut SelectLinesA[] = {PIN43,PIN44,PIN45,PIN46}; //to mux1=>voltage mux , PTA 13-16 , CHNGE TO PIN43 LATER |
sakthipriya | 0:246d1b5f11ae | 16 | DigitalOut SelectLinesB[] = {PIN56,PIN57,PIN58,PIN59}; //to mux2=>current mux(differential mux) , PTB 3,7,8,9 |
sakthipriya | 0:246d1b5f11ae | 17 | //MSB is SelectLines[0],LSB is SelectLines[3] |
sakthipriya | 0:246d1b5f11ae | 18 | AnalogIn CurrentInput(PIN53); // output from Current Mux PTB0 |
sakthipriya | 0:246d1b5f11ae | 19 | AnalogIn VoltageInput(PIN54); // output from Voltage Multiplexer PTB1 |
sakthipriya | 0:246d1b5f11ae | 20 | |
sakthipriya | 0:246d1b5f11ae | 21 | /**************************************************Variables******************************************************************************/ |
sakthipriya | 0:246d1b5f11ae | 22 | typedef struct SensorData //soc value has to be included |
sakthipriya | 0:246d1b5f11ae | 23 | { |
sakthipriya | 0:246d1b5f11ae | 24 | float Voltage[16]; |
sakthipriya | 0:246d1b5f11ae | 25 | float Current[8]; |
sakthipriya | 0:246d1b5f11ae | 26 | float PanelTemperature[4]; // not finalised |
sakthipriya | 0:246d1b5f11ae | 27 | float BatteryTemperature; |
sakthipriya | 0:246d1b5f11ae | 28 | char fault_poll; //polled faults |
sakthipriya | 0:246d1b5f11ae | 29 | char fault_ir; //interrupted faults |
sakthipriya | 0:246d1b5f11ae | 30 | char clear_fault_poll; //to be confirmed |
sakthipriya | 0:246d1b5f11ae | 31 | char clear_fault_ir; |
sakthipriya | 0:246d1b5f11ae | 32 | char power_mode; //power modes |
sakthipriya | 0:246d1b5f11ae | 33 | float AngularSpeed[3]; //in order x,y,z |
sakthipriya | 0:246d1b5f11ae | 34 | float Bnewvalue[3]; //in order Bx,By,Bz |
sakthipriya | 0:246d1b5f11ae | 35 | } SensorData; |
sakthipriya | 0:246d1b5f11ae | 36 | |
sakthipriya | 0:246d1b5f11ae | 37 | |
sakthipriya | 0:246d1b5f11ae | 38 | typedef struct SensorDataQuantised |
sakthipriya | 0:246d1b5f11ae | 39 | { |
sakthipriya | 0:246d1b5f11ae | 40 | char Voltage[8]; |
sakthipriya | 0:246d1b5f11ae | 41 | char Current[4]; |
sakthipriya | 0:246d1b5f11ae | 42 | char PanelTemperature[2];//read by the 4 thermistors on solar panels |
sakthipriya | 0:246d1b5f11ae | 43 | char BatteryTemperature; //to be populated |
sakthipriya | 0:246d1b5f11ae | 44 | char faultpoll; //polled faults |
sakthipriya | 0:246d1b5f11ae | 45 | char faultir; //interrupted faults |
sakthipriya | 0:246d1b5f11ae | 46 | char power_mode; //power modes |
sakthipriya | 0:246d1b5f11ae | 47 | char AngularSpeed[2]; |
sakthipriya | 0:246d1b5f11ae | 48 | char Bnewvalue[2]; |
sakthipriya | 0:246d1b5f11ae | 49 | |
sakthipriya | 0:246d1b5f11ae | 50 | //float magnetometer,gyro=>to be addes |
sakthipriya | 0:246d1b5f11ae | 51 | } SensorDataQuantised; |
sakthipriya | 0:246d1b5f11ae | 52 | |
sakthipriya | 0:246d1b5f11ae | 53 | |
sakthipriya | 0:246d1b5f11ae | 54 | typedef struct ShortBeacon |
sakthipriya | 0:246d1b5f11ae | 55 | { |
sakthipriya | 0:246d1b5f11ae | 56 | char Voltage[1]; //battery voltage from gauge, needs to be quantised |
sakthipriya | 0:246d1b5f11ae | 57 | char AngularSpeed[2]; //all the 3 data |
sakthipriya | 0:246d1b5f11ae | 58 | char SubsystemStatus[1]; //power modes |
sakthipriya | 0:246d1b5f11ae | 59 | char Temp[2]; //temp of solar panel |
sakthipriya | 0:246d1b5f11ae | 60 | //Temp[0]'s LSB=> PanelTemperature[0], Temp[0]'s MSB=> PanelTemperature[1], Temp[1]'s LSB=> PanelTemperature[2], Temp[1]'s MSB=> PanelTemperature[3] |
sakthipriya | 0:246d1b5f11ae | 61 | char ErrorFlag[1]; //fault |
sakthipriya | 0:246d1b5f11ae | 62 | }ShortBeacy; |
sakthipriya | 0:246d1b5f11ae | 63 | |
sakthipriya | 0:246d1b5f11ae | 64 | |
sakthipriya | 0:246d1b5f11ae | 65 | void FCTN_EPS_INIT(); |
sakthipriya | 0:246d1b5f11ae | 66 | void FCTN_EPS_MAIN(); |
sakthipriya | 0:246d1b5f11ae | 67 | |
sakthipriya | 0:246d1b5f11ae | 68 | int FCTN_QUANTIZE(float l_start,float l_step,float l_x); |
sakthipriya | 0:246d1b5f11ae | 69 | void FCTN_WRITE_BEASTRUCT(ShortBeacy* x,SensorDataQuantised y); |