Inductance Testing Code

Dependencies:   mbed

Fork of CurrentModeSine by Austin Brown

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fw_config.h Source File

fw_config.h

00001 #ifndef FW_CONFIG_H
00002 #define FW_CONFIG_H
00003 
00004 //hardware stuff
00005 #define R_S 0.027f            //Ohms
00006 #define L_S 0.00004f            //Henries
00007 
00008 //#define KT .07f                 //N-m per peak phase amp (= RMS amps/1.5)
00009 #define POLE_PAIRS 7                 //Number of pole pairs
00010 #define ENC_TICKS_PER_REV 8191 //wank
00011 //#define WB KT/NPP               //Webers.  
00012 
00013 
00014 
00015 //current controler settings
00016 #define K_D 0.25f                     // Volts/Amp
00017 #define K_Q 0.25f                     // Volts/Amp
00018 
00019 #define KI_D 0.03f                  // 1/samples
00020 #define KI_Q 0.03f                  // 1/samples
00021 
00022 /*
00023 #define K_D 8.1f                     // Volts/Amp
00024 #define K_Q 8.1f                     // Volts/Amp
00025 #define KI_D 0.02f                  // 1/samples
00026 #define KI_Q 0.02f                  // 1/samples
00027 */
00028 #define V_BUS 14.0f                // Volts, actual bus voltage
00029 #define V_CLIP 14.0f        // Volts, This is when the controller will nope out- not actually the real bus voltage
00030 //#define V_BUS 6.0f                // Volts, actual bus voltage
00031 //#define V_CLIP 6.0f        // Volts, This is when the controller will nope out- not actually the real bus voltage
00032 
00033 #define D_INT_LIM V_BUS/(K_D*KI_D)  // Amps*samples
00034 #define Q_INT_LIM V_BUS/(K_Q*KI_Q)  // Amps*samples
00035 
00036 //#define MODULATION_FACTOR 0.574f // //perfect with zero clipping if v = v_bus, actually equal to 0.57735f * (DTC_MAX-DTC_MIN)
00037 #define MODULATION_FACTOR 0.57f // //perfect with zero clipping if v = v_bus, actually equal to 0.57735f * (DTC_MAX-DTC_MIN)
00038 //#define MODULATION_FACTOR 0.45f // //perfect with zero clipping if v = v_bus, actually equal to 0.57735f * (DTC_MAX-DTC_MIN)
00039 #define USE_THETA_ADV false
00040 #define MAX_AMPS 20.0f
00041 #define DT 0.00005f
00042 #define F_SW 20000
00043 
00044 
00045 #define DTC_MAX 0.93f          // Max phase duty cycle
00046 #define DTC_MIN 0.07f          // Min phase duty cycle
00047 
00048 
00049 #define FL_OBS_LOWSPEED_MULT 0.995 //0.9992^2500 = 0.13 so lowpass will go to 0.18 every 8hz
00050 #define FL_OBS_HIGHSPEED_MULT 0.95 //a lot faster
00051 
00052 
00053 
00054 
00055 
00056 
00057 #endif
00058