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
Changes from 1 commit
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
23 changes: 16 additions & 7 deletions src/vcu/src/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,28 @@ static int32_t get_regen_torque() {
}

static int32_t get_power_limited_torque(int32_t pedal_torque) {
if (mc_readings.speed < 0) { //prevent division by zero, make sure we are spinning (negative is forward)
int32_t tMAX = power_limit/(abs(mc_readings.speed)*628/6000)*10; //convert RPM to rad/s with 2pi/60, *10 to dNm
static int32_t tCAP = 100000; //Set arbitrarily large so that at first calculated tMAX will always be smaller than this

if (mc_readings.speed < 0) { //Prevent division by zero, make sure we are spinning (negative is forward)


if (tMAX > 2400) tMAX = 2400;
if(pedal_torque > tMAX) {
power_lim_settings.tMAX = tMAX;
int32_t tMAX = power_limit/(abs(mc_readings.speed)*628/6000)*10; //Convert RPM to rad/s with 2pi/60, *10 to dNm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, you should introduce a sign because we don't want to power limit on regen. But don't worry about that now


if (tMAX > 2400) tMAX = 2400; //Cap the maximum tMAX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX_TORQUE is available to you, you should use that instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about that, thanks for letting me know.


//If the wheels slip, calculated tMAX will be higher, but we don't want
//sudden increases in tMAX, and so it will be capped by the maximum that
//was previously calculated, will be reset once the car's speed goes back to zero
if(tMAX < tCAP) tCAP = tMAX;

power_lim_settings.tMAX = tCAP;

if(pedal_torque > tMAX) { //Return the minimum of the two
return tMAX;
}
return pedal_torque;

} else {
tCAP = 100000; //Reset once wheels stop moving
return pedal_torque;
}
}
Expand Down