Treehouse Mbed Team / Mbed 2 deprecated APS_DCM1SL2

Dependencies:   mbed

Committer:
mfwic
Date:
Tue Jan 22 19:56:22 2019 +0000
Revision:
26:55e8e1a9cc84
Parent:
25:8bcc8bea0e31
Child:
30:d8721a46ee03
Sent to customer for demo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfwic 11:01dcfb29fbc4 1 //-------------------------------------------------------------------------------
mfwic 11:01dcfb29fbc4 2 //
mfwic 11:01dcfb29fbc4 3 // Treehouse Designs Inc.
mfwic 11:01dcfb29fbc4 4 // Colorado Springs, Colorado
mfwic 11:01dcfb29fbc4 5 //
mfwic 11:01dcfb29fbc4 6 // Copyright (c) 2016 by Treehouse Designs Inc.
mfwic 11:01dcfb29fbc4 7 // Copyright (c) 2018 by Agility Power Systems Inc.
mfwic 11:01dcfb29fbc4 8 //
mfwic 11:01dcfb29fbc4 9 // This code is the property of Treehouse Designs, Inc. (Treehouse) and
mfwic 11:01dcfb29fbc4 10 // Agility Power Systems Inc. (Agility) and may not be redistributed
mfwic 11:01dcfb29fbc4 11 // in any form without prior written permission from
mfwic 11:01dcfb29fbc4 12 // both copyright holders, Treehouse and Agility.
mfwic 11:01dcfb29fbc4 13 //
mfwic 11:01dcfb29fbc4 14 // The above copyright notice and this permission notice shall be included in
mfwic 11:01dcfb29fbc4 15 // all copies or substantial portions of the Software.
mfwic 11:01dcfb29fbc4 16 //
mfwic 11:01dcfb29fbc4 17 //
mfwic 11:01dcfb29fbc4 18 //-------------------------------------------------------------------------------
mfwic 11:01dcfb29fbc4 19 //
mfwic 11:01dcfb29fbc4 20 // REVISION HISTORY:
mfwic 11:01dcfb29fbc4 21 //
mfwic 11:01dcfb29fbc4 22 // $Author: $
mfwic 11:01dcfb29fbc4 23 // $Rev: $
mfwic 11:01dcfb29fbc4 24 // $Date: $
mfwic 11:01dcfb29fbc4 25 // $URL: $
mfwic 11:01dcfb29fbc4 26 //
mfwic 11:01dcfb29fbc4 27 //-------------------------------------------------------------------------------
mfwic 11:01dcfb29fbc4 28
mfwic 15:aed8f326c949 29 #ifndef ADC_DEFS_H
mfwic 15:aed8f326c949 30 #define ADC_DEFS_H
mfwic 15:aed8f326c949 31
mfwic 11:01dcfb29fbc4 32 #include "parameters.h"
mfwic 11:01dcfb29fbc4 33
mfwic 11:01dcfb29fbc4 34 const unsigned int ADC_SCALE_FACTOR = ADC_MAX_VALUE/2;
mfwic 11:01dcfb29fbc4 35
mfwic 11:01dcfb29fbc4 36 #define VOLTAGE_TARG_VALUE 1.65
mfwic 11:01dcfb29fbc4 37 #define VOLTAGE_48_ACTUAL_VALUE 1.51
mfwic 11:01dcfb29fbc4 38 #define VOLTAGE_24_ACTUAL_VALUE 1.55
mfwic 11:01dcfb29fbc4 39 #define VOLTAGE_12_ACTUAL_VALUE 1.53
mfwic 11:01dcfb29fbc4 40 const double VOLTAGE_48_CORRECTION = VOLTAGE_TARG_VALUE/VOLTAGE_48_ACTUAL_VALUE/ADC_SCALE_FACTOR;
mfwic 11:01dcfb29fbc4 41 const double VOLTAGE_24_CORRECTION = VOLTAGE_TARG_VALUE/VOLTAGE_24_ACTUAL_VALUE/ADC_SCALE_FACTOR;
mfwic 11:01dcfb29fbc4 42 const double VOLTAGE_12_CORRECTION = VOLTAGE_TARG_VALUE/VOLTAGE_12_ACTUAL_VALUE/ADC_SCALE_FACTOR;
mfwic 11:01dcfb29fbc4 43 const double VOLTAGE_48_FACTOR = 48.0*VOLTAGE_48_CORRECTION;
mfwic 11:01dcfb29fbc4 44 const double VOLTAGE_24_FACTOR = 24.0*VOLTAGE_24_CORRECTION;
mfwic 11:01dcfb29fbc4 45 const double VOLTAGE_12_FACTOR = 12.0*VOLTAGE_12_CORRECTION;
mfwic 11:01dcfb29fbc4 46
mfwic 18:78e982f31c6b 47 //#define CURRENT_ACTUAL_VALUE 1.7091
mfwic 18:78e982f31c6b 48 //#define CURRENT_TARG_VALUE 1.65
mfwic 11:01dcfb29fbc4 49 //const double CURRENT_OFFSET = (CURRENT_ACTUAL_VALUE/CURRENT_TARG_VALUE)*ADC_SCALE_FACTOR;
mfwic 17:454afe56eedb 50 //const double CURRENT_48_OFFSET = 33940;
mfwic 17:454afe56eedb 51 //const double CURRENT_24_OFFSET = 33580;
mfwic 17:454afe56eedb 52 //const double CURRENT_12_OFFSET = 33380;
mfwic 11:01dcfb29fbc4 53 //#define CURRENT_OFFSET 33940
mfwic 11:01dcfb29fbc4 54 //#define CURRENT_DIV_FACTOR -390
mfwic 12:fd1fd1857628 55 /*
mfwic 11:01dcfb29fbc4 56 #define CURRENT_48_DIV_FACTOR -368
mfwic 11:01dcfb29fbc4 57 #define CURRENT_24_DIV_FACTOR -308
mfwic 12:fd1fd1857628 58 #define CURRENT_12_DIV_FACTOR -324
mfwic 12:fd1fd1857628 59 */
mfwic 25:8bcc8bea0e31 60 //#define CURRENT_48_DIV_FACTOR -372
mfwic 25:8bcc8bea0e31 61 #define CURRENT_48_DIV_FACTOR5 -370
mfwic 25:8bcc8bea0e31 62 #define CURRENT_48_DIV_FACTOR4 -570
mfwic 25:8bcc8bea0e31 63 #define CURRENT_48_DIV_FACTOR3 -740
mfwic 25:8bcc8bea0e31 64 #define CURRENT_48_DIV_FACTOR2 -948
mfwic 25:8bcc8bea0e31 65 #define CURRENT_48_DIV_FACTOR1 -1541
mfwic 25:8bcc8bea0e31 66 #define CURRENT_48_DIV_FACTOR0 -1610
mfwic 25:8bcc8bea0e31 67
mfwic 25:8bcc8bea0e31 68 #define CURRENT_48_DIV_THRESH5 3000
mfwic 25:8bcc8bea0e31 69 #define CURRENT_48_DIV_THRESH4 2500
mfwic 25:8bcc8bea0e31 70 #define CURRENT_48_DIV_THRESH3 2000
mfwic 25:8bcc8bea0e31 71 #define CURRENT_48_DIV_THRESH2 1500
mfwic 25:8bcc8bea0e31 72 #define CURRENT_48_DIV_THRESH1 500
mfwic 25:8bcc8bea0e31 73
mfwic 18:78e982f31c6b 74 #define CURRENT_24_DIV_FACTOR -376
mfwic 22:2c37ac12746e 75 //#define CURRENT_12_DIV_FACTOR -356
mfwic 25:8bcc8bea0e31 76 //#define CURRENT_12_DIV_FACTOR -208
mfwic 25:8bcc8bea0e31 77
mfwic 26:55e8e1a9cc84 78 //#define CURRENT_12_DIV_FACTOR5 -305
mfwic 26:55e8e1a9cc84 79 //#define CURRENT_12_DIV_FACTOR4 -335
mfwic 26:55e8e1a9cc84 80 //#define CURRENT_12_DIV_FACTOR3 -355
mfwic 26:55e8e1a9cc84 81 //#define CURRENT_12_DIV_FACTOR2 -391
mfwic 26:55e8e1a9cc84 82 //#define CURRENT_12_DIV_FACTOR1 -440
mfwic 26:55e8e1a9cc84 83 //#define CURRENT_12_DIV_FACTOR0 -535
mfwic 25:8bcc8bea0e31 84
mfwic 26:55e8e1a9cc84 85 #define CURRENT_12_DIV_FACTOR5 -188
mfwic 26:55e8e1a9cc84 86 #define CURRENT_12_DIV_FACTOR4 -186
mfwic 26:55e8e1a9cc84 87 #define CURRENT_12_DIV_FACTOR3 -182
mfwic 26:55e8e1a9cc84 88 #define CURRENT_12_DIV_FACTOR2 -177
mfwic 26:55e8e1a9cc84 89 #define CURRENT_12_DIV_FACTOR1 -179
mfwic 26:55e8e1a9cc84 90 #define CURRENT_12_DIV_FACTOR0 -175
mfwic 26:55e8e1a9cc84 91
mfwic 26:55e8e1a9cc84 92 #define CURRENT_12_DIV_THRESH5 1600
mfwic 26:55e8e1a9cc84 93 #define CURRENT_12_DIV_THRESH4 800
mfwic 26:55e8e1a9cc84 94 #define CURRENT_12_DIV_THRESH3 600
mfwic 26:55e8e1a9cc84 95 #define CURRENT_12_DIV_THRESH2 400
mfwic 26:55e8e1a9cc84 96 #define CURRENT_12_DIV_THRESH1 200
mfwic 25:8bcc8bea0e31 97
mfwic 22:2c37ac12746e 98
mfwic 24:078f62c8d0ed 99 //const double ROW_CORRECTION_FACTOR = 1.017; // 2.6W/chip avg.
mfwic 24:078f62c8d0ed 100 const double ROW_CORRECTION_FACTOR = 0.85; // 3W/chip avg.
mfwic 26:55e8e1a9cc84 101 #define ROW_HYSTERESIS 1
mfwic 15:aed8f326c949 102
mfwic 17:454afe56eedb 103 extern double CURRENT_48_OFFSET;
mfwic 17:454afe56eedb 104 extern double CURRENT_24_OFFSET;
mfwic 17:454afe56eedb 105 extern double CURRENT_12_OFFSET;
mfwic 17:454afe56eedb 106
mfwic 15:aed8f326c949 107 #endif