Treehouse Mbed Team / Mbed 2 deprecated 1U5_proto_X

Dependencies:   mbed

Committer:
Slord2142
Date:
Tue Dec 06 18:47:01 2022 +0000
Revision:
1:bc3509459a27
Parent:
0:b3410a1e9843
Helix commit 1

Who changed what in which revision?

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