Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated power limiting to filter on wheel speed #37

Open
wants to merge 76 commits into
base: power-limiting
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
e3dfdc1
Add relay functionality
nistath Oct 27, 2018
9b14806
Fix voltage, heartbeat
daniwhite Nov 4, 2018
00d2f4e
Updated power limiting to filter on wheel speed
ajmel Jan 15, 2019
e4aeab2
Fixed capping max torque
ajmel Jan 18, 2019
b38a021
Add human readable summary measure command
nistath Feb 15, 2019
fee3581
Undo the temp calibration.
nistath Feb 15, 2019
6709f4f
added kistler to the can spec
CharlieA0 Mar 23, 2019
a00f7d8
updated ramp
Mar 23, 2019
d73ec84
updated torque ramp to include tThresh
Mar 23, 2019
74b7311
ramp now start from tThresh
Mar 23, 2019
ff75531
cleaned up ramp
Mar 23, 2019
3763025
removed unnecessary if
Mar 23, 2019
448405c
added scripts for plotting power data
Mar 23, 2019
30b2048
Merge branch 'roman' of https://github.com/MITMotorsports/MY18 into r…
daniwhite Mar 24, 2019
5bf7ee8
Reorganize
daniwhite Mar 25, 2019
752ab36
Add IMD 'ignore but report' possibility.
nistath Mar 26, 2019
708ecaa
Modernize VCU makefile.
nistath Mar 26, 2019
1ff567d
Convert torque ramp to use time.
nistath Mar 26, 2019
ffd0e3b
Clarify var name and add extra ramp case.
nistath Mar 26, 2019
7e5ebb8
Add back comment
nistath Mar 26, 2019
4038306
Remove tCAP
daniwhite Mar 26, 2019
c3893b7
Actually use dash params more
daniwhite Mar 26, 2019
72454e3
Final debugging of the ramp
daniwhite Mar 27, 2019
bfe9a88
Add IMD 'ignore but report' possibility.
nistath Mar 26, 2019
81f2afe
Ignore IMD, remove torque ramp
daniwhite Mar 27, 2019
cd6c6b1
electrical power limit initial
elijahstangerjones Mar 28, 2019
0e97537
Camel case
nistath Mar 28, 2019
30030b2
Add c_types and units for kistler
nistath Mar 28, 2019
1e6e2c7
Merge pull request #39 from MITMotorsports/kistler
nistath Mar 28, 2019
62c8713
added VCU and CAN changes for epl
elijahstangerjones Mar 29, 2019
46666cd
Add Vq based limiter, add ramp
daniwhite Mar 29, 2019
bb42157
setup dash code
elijahstangerjones Mar 29, 2019
c84715b
added monitoring
elijahstangerjones Mar 29, 2019
2fdd947
fixed some spelling
elijahstangerjones Mar 29, 2019
92563c2
fixed dash pages
elijahstangerjones Mar 30, 2019
c1dfb71
fixed dash can messages
elijahstangerjones Mar 30, 2019
19b0299
Merge branch 'power_limit_electrical' of https://github.com/MITMotors…
elijahstangerjones Mar 30, 2019
b22f86a
fixed sweeps
elijahstangerjones Mar 30, 2019
53dc8f7
fixed mistake
elijahstangerjones Mar 30, 2019
5eb6542
pointer bug
elijahstangerjones Mar 30, 2019
2c7b54d
fixed some bugs
elijahstangerjones Mar 30, 2019
b2b6b05
another fuck up
elijahstangerjones Mar 30, 2019
3fead8c
fixed can spec
elijahstangerjones Mar 30, 2019
3e6c02b
Clean up script
daniwhite Mar 30, 2019
d7c33ea
Plot efficiency
daniwhite Mar 30, 2019
161cccb
Actually plot efficiency properly
daniwhite Mar 30, 2019
5564047
Combine runs
daniwhite Mar 30, 2019
3fd9736
Add code which is too slow for guessing eff
daniwhite Mar 30, 2019
feef913
Clean up eff calc
daniwhite Mar 30, 2019
f20848f
Rectangular grid of efficiencies
daniwhite Mar 30, 2019
6152e5b
Integrate efficiencies
daniwhite Mar 31, 2019
2ae4a64
Make more granular eff map, switch faulty sign
daniwhite Mar 31, 2019
5914055
changed to full PI loop
elijahstangerjones Mar 31, 2019
4ff5949
fixed canspec
elijahstangerjones Mar 31, 2019
c6272ce
Better efficiency
daniwhite Mar 31, 2019
0515fea
Fix power plot eff
daniwhite Mar 31, 2019
a838531
EPL v2
elijahstangerjones Apr 5, 2019
e79334c
pl v2
elijahstangerjones Apr 6, 2019
ad29f07
Update plots
daniwhite Apr 6, 2019
0133dc1
Set back to doing just vqiq efficiency
daniwhite Apr 7, 2019
b22469b
Add id and iq scripts
daniwhite Apr 9, 2019
ec7bcb1
Merge branch 'roman' of https://github.com/MITMotorsports/MY18 into r…
daniwhite Apr 9, 2019
1b85968
i don't know
elijahstangerjones Apr 12, 2019
cde18b1
resolved pr comments
elijahstangerjones Apr 13, 2019
a99809e
removed print statements
elijahstangerjones Apr 13, 2019
063d6e5
remove commented code please
elijahstangerjones Apr 13, 2019
85e9876
fix formatting for Dani
elijahstangerjones Apr 13, 2019
aede8e8
make controls pretty
elijahstangerjones Apr 13, 2019
8a1005a
make it compile
elijahstangerjones Apr 13, 2019
a368696
Merge pull request #41 from MITMotorsports/power_limit_electrical
daniwhite Apr 13, 2019
d8a44e0
Merge branch 'spring-2019-controls' into power-limiting-tMAX
Apr 13, 2019
083de48
Merged MPL and EPL CAN messages/spec and cleaned up code.
Apr 13, 2019
ed5c02e
Remove .vscode and add it .gitignore
daniwhite Apr 14, 2019
73e89dd
Remove another .vscode
daniwhite Apr 14, 2019
a54035a
Clean up, cW->hW, remove .vscode
daniwhite Apr 14, 2019
7698511
Rename e_power_limit_monitoring
daniwhite Apr 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ dkms.conf
**/bin
.DS_Store
_DS_Store

# vscode
**/.vscode/
156 changes: 151 additions & 5 deletions can_spec_my18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ boards:
can0:
- FrontCanNodeBrakeThrottle
- MCVoltage
- KistlerSpeedDistance
- KistlerVelocity
- KistlerStatus
dash:
arch: lpc11cx4
publish:
Expand Down Expand Up @@ -79,11 +82,88 @@ boards:
subscribe:
can0:
- CurrentSensor_Config
kistler:
publish:
can0:
- KistlerSpeedDistance
- KistlerVelocity
- KistlerStatus
buses:
can0:
baudrate: 500000
is_extended: false
messages:
KistlerSpeedDistance:
can_id: 0x7FA
period: 4ms
is_big_endian: false
segments:
timestamp:
position: 0
length: 16
c_type: uint16_t
unit: 4 ms
ground_speed:
position: 16
length: 16
c_type: uint16_t
unit: 1e-2 m/s
distance:
position: 32
length: 32
c_type: uint32_t
unit: mm
KistlerVelocity:
can_id: 0x7FB
period: 4ms
is_big_endian: false
segments:
longitudinal:
position: 0
length: 16
c_type: uint16_t
unit: 1e-2 m/s
lateral:
position: 16
length: 16
c_type: int16_t
unit: 1e-2 m/s
angle:
position: 32
length: 16
c_type: int16_t
unit: 1e-2 deg
KistlerStatus:
can_id: 0x7FC
period: 4ms
is_big_endian: false
segments:
serial_number:
position: 0
length: 24
c_type: uint32_t
sensor_number:
position: 24
length: 8
c_type: uint8_t
temperature:
position: 32
length: 8
c_type: uint8_t
unit: degC
led_illumination_curr:
position: 40
length: 8
c_type: uint8_t
unit: 1e-2 A
status_byte_1:
position: 48
length: 8
c_type: uint8_t
status_byte_2:
position: 56
length: 8
c_type: uint8_t
FrontCanNodeBrakeThrottle:
can_id: 0x090
period: 13ms
Expand Down Expand Up @@ -938,12 +1018,12 @@ buses:
length: 16
c_type: int16_t
unit: mWb
Iq_feedback:
Id_feedback:
position: 32
length: 16
c_type: int16_t
unit: dA
Id_feedback:
Iq_feedback:
position: 48
length: 16
c_type: int16_t
Expand Down Expand Up @@ -1541,8 +1621,74 @@ buses:
is_big_endian: true
period: 25 ms
segments:
tMAX:
vq_tmax:
unit: dNm
position: 0
length: 32
c_type: int32_t
length: 16
c_type: int16_t
mech_tmax:
unit: dMm
position: 32
length: 16
c_type: int16_t
calc_eff:
unit: percent
position: 48
length: 8
c_type: uint8_t
VCU_PowerLimSettings:
can_id: 0x701
is_big_endian: true
period: 25 ms
<<: &epl
segments:
power_lim:
unit: hW
position: 0
length: 16
c_type: uint16_t
pl_enable:
position: 16
length: 1
c_type: bool
using_vq_lim:
position: 17
length: 1
c_type: bool
electrical_P:
position: 18
length: 8
c_type: uint8_t
electrical_I:
position: 26
length: 8
c_type: uint8_t
anti_windup:
position: 34
length: 16
c_type: uint16_t
Dash_PowerLimSettings:
can_id: 0x702
is_big_endian: true
period: 25 ms
<<: *epl
ElectricalPLLogging:
can_id: 0x722
is_big_endian: true
period: 25 ms
segments:
power_limited_torque:
unit: dNM
position: 0
length: 16
c_type: uint16_t
pedal_torque:
unit: dNM
position: 16
length: 16
c_type: uint16_t
anti_windup:
position: 32
length: 16
c_type: int16_t

1 change: 0 additions & 1 deletion src/bms/inc/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ typedef struct {
bool measure_on;
bool measure_temp;
bool measure_voltage;
bool measure_packcurrent;
bool measure_packvoltage;
} CONSOLE_OUTPUT_T;

Expand Down
22 changes: 0 additions & 22 deletions src/bms/inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,3 @@
#define PRE_ERROR_CHECK_TIMEOUT 500

extern volatile uint32_t msTicks;

static char str[10];

static BMS_PACK_STATUS_T pack_status;
static BMS_INPUT_T bms_input;
static BMS_OUTPUT_T bms_output;
static BMS_STATE_T bms_state;

static BMS_PACK_CONFIG_T pack_config;
static uint32_t cell_voltages[MAX_NUM_MODULES * MAX_CELLS_PER_MODULE];
static int16_t cell_temperatures[MAX_NUM_MODULES * MAX_THERMISTORS_PER_MODULE];
static int16_t cell_temperature_offsets[MAX_NUM_MODULES * MAX_THERMISTORS_PER_MODULE];
static uint8_t module_cell_count[MAX_NUM_MODULES];

// memory allocation for BMS_OUTPUT balancing
static bool balance_reqs[MAX_NUM_MODULES * MAX_CELLS_PER_MODULE];
static bool balance_waitingoff[MAX_NUM_MODULES * MAX_CELLS_PER_MODULE];
static uint32_t balance_timeon[MAX_NUM_MODULES * MAX_CELLS_PER_MODULE];

// memory for console
static microrl_t rl;
static CONSOLE_OUTPUT_T console_output;
6 changes: 6 additions & 0 deletions src/bms/inc/measure.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "console.h"
#include "state_types.h"

void Output_Measurements(CONSOLE_OUTPUT_T *console_output,
BMS_INPUT_T *bms_input,
BMS_STATE_T *bms_state);
28 changes: 0 additions & 28 deletions src/bms/src/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,3 @@ void Board_BlockingDelay(uint32_t delayms) {

while (msTicks < haltTime) ;
}

void Board_GetModeRequest(const CONSOLE_OUTPUT_T *console_output,
BMS_INPUT_T *bms_input) {
// // create console mode request
// BMS_SSM_MODE_T console_mode_request = BMS_SSM_MODE_STANDBY;

// // then get console mode request
// if (console_output->valid_mode_request) {
// console_mode_request = console_output->mode_request;
// }

// if ((console_mode_request == BMS_SSM_MODE_STANDBY) &&
// (bms_input->csb_mode_request == BMS_SSM_MODE_STANDBY)) {
// bms_input->mode_request = bms_input->vcu_mode_request;
// }

// // if console mode request is standby vcu mode request is standby:
// // mode request is charger mode request
// // Error pass conflicting mode requests
// // else if (charge mode request is standby and vcu mode requst is stadndby):
// // mode request is console mode request
// // Error pass conflicting mode requests
// // else if console mode request is standby and charge mode reuqest is standby
// // mode request is vcu mode request
// // else if console mode request == discharge mode request or cosole mode
// // request == charge mode request
// // mode request is console
}
82 changes: 34 additions & 48 deletions src/bms/src/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,53 +382,40 @@ static void config(const char *const *argv) {
}

static void measure(const char *const *argv) {
// if (bms_state->curr_mode == BMS_SSM_MODE_STANDBY) {
// if (strcmp(argv[1], "on") == 0) {
// console_output->measure_on = true;
// Board_Println("Measure On!");
// } else if (strcmp(argv[1], "off") == 0) {
// console_output->measure_on = false;
// Board_Println("Measure Off!");
// } else if (strcmp(argv[1], "print_flags") == 0) {
// if (console_output->measure_voltage) {
// Board_Println("Cell Voltages: On");
// } else {
// Board_Println("Cell Voltages: Off");
// }

// if (console_output->measure_temp) {
// Board_Println("Cell Temps: On");
// } else {
// Board_Println("Cell Temps: Off");
// }

// if (console_output->measure_packcurrent) {
// Board_Println("Pack Current: On");
// } else {
// Board_Println("Pack Current: Off");
// }

// if (console_output->measure_packvoltage) {
// Board_Println("Pack Current: On");
// } else {
// Board_Println("Pack Current: Off");
// }
// } else if (strcmp(argv[1], "temps") == 0) {
// console_output->measure_temp = !console_output->measure_temp;
// } else if (strcmp(argv[1], "voltages") == 0) {
// console_output->measure_voltage = !console_output->measure_voltage;
// } else if (strcmp(argv[1], "packcurrent") == 0) {
// console_output->measure_packcurrent = !console_output->measure_packcurrent;
// Board_Println("Not implemented yet!");
// } else if (strcmp(argv[1], "packvoltage") == 0) {
// console_output->measure_packvoltage = !console_output->measure_packvoltage;
// Board_Println("Not implemented yet!");
// } else {
// Board_Println("Unrecognized command!");
// }
// } else {
// Board_Println("Must be in standby");
// }
if (strcmp(argv[1], "on") == 0) {
console_output->measure_on = true;
Board_Println("Measure On!");
} else if (strcmp(argv[1], "off") == 0) {
console_output->measure_on = false;
Board_Println("Measure Off!");
} else if (strcmp(argv[1], "print_flags") == 0) {
if (console_output->measure_temp) {
Board_Println("Cell Temps: On");
} else {
Board_Println("Cell Temps: Off");
}

if (console_output->measure_voltage) {
Board_Println("Cell Voltages: On");
} else {
Board_Println("Cell Voltages: Off");
}

if (console_output->measure_packvoltage) {
Board_Println("Pack Voltage: On");
} else {
Board_Println("Pack Voltage: Off");
}

} else if (strcmp(argv[1], "temps") == 0) {
console_output->measure_temp = !console_output->measure_temp;
} else if (strcmp(argv[1], "voltages") == 0) {
console_output->measure_voltage = !console_output->measure_voltage;
} else if (strcmp(argv[1], "packvoltage") == 0) {
console_output->measure_packvoltage = !console_output->measure_packvoltage;
} else {
Board_Println("Unrecognized command!");
}
}

static void bal(const char *const *argv) {
Expand Down Expand Up @@ -510,7 +497,6 @@ void console_init(BMS_INPUT_T *input, BMS_STATE_T *state, CONSOLE_OUTPUT_T *con_
console_output->measure_on = false;
console_output->measure_temp = false;
console_output->measure_voltage = false;
console_output->measure_packcurrent = false;
console_output->measure_packvoltage = false;
}

Expand Down
Loading