Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BREMS/derived.h@189:760cd81a7633, 2018-02-10 (annotated)
- Committer:
- bwang
- Date:
- Sat Feb 10 02:47:07 2018 +0000
- Revision:
- 189:760cd81a7633
- Parent:
- 188:43f50a4cc040
- Child:
- 190:01674f19f9ce
02/09/2018 21:45 - started switching code to run on flash-saved parameters instead of hardcoded ones; moved delay in BREMSConfig.cpp to avoid intermittent freeze after programming
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 185:5c102874b490 | 1 | /* |
bwang | 185:5c102874b490 | 2 | *derived macros for the controller |
bwang | 185:5c102874b490 | 3 | *don't change these unless you know what you're doing! |
bwang | 185:5c102874b490 | 4 | */ |
bwang | 185:5c102874b490 | 5 | |
bwang | 185:5c102874b490 | 6 | #ifndef __DERIVED_H |
bwang | 185:5c102874b490 | 7 | #define __DERIVED_H |
bwang | 185:5c102874b490 | 8 | |
bwang | 189:760cd81a7633 | 9 | #include "layout.h" |
bwang | 185:5c102874b490 | 10 | #include "defaults.h" |
bwang | 189:760cd81a7633 | 11 | #include "prefs.h" |
bwang | 185:5c102874b490 | 12 | |
bwang | 189:760cd81a7633 | 13 | /*max modulation depth at which inverter is still linear*/ |
bwang | 185:5c102874b490 | 14 | #define LINEAR_MODULATION_MAX (2.f * LINEAR_DTC_MAX - 1.f) |
bwang | 185:5c102874b490 | 15 | |
bwang | 185:5c102874b490 | 16 | /*internally computed loop parameters*/ |
bwang | 185:5c102874b490 | 17 | #define KP_D (K_LOOP_D / BUS_VOLTAGE / LINEAR_MODULATION_MAX) |
bwang | 185:5c102874b490 | 18 | #define KI_D (KI_BASE_D * K_LOOP_D / BUS_VOLTAGE * 5000.0f / F_SW / LINEAR_MODULATION_MAX) |
bwang | 185:5c102874b490 | 19 | |
bwang | 185:5c102874b490 | 20 | #define KP_Q (K_LOOP_Q / BUS_VOLTAGE / LINEAR_MODULATION_MAX) |
bwang | 185:5c102874b490 | 21 | #define KI_Q (KI_BASE_Q * K_LOOP_Q / BUS_VOLTAGE * 5000.0f / F_SW / LINEAR_MODULATION_MAX) |
bwang | 185:5c102874b490 | 22 | |
bwang | 189:760cd81a7633 | 23 | #define SLOW_LOOP_COUNTER ((int) (_F_SW / _F_SLOW_LOOP)) |
bwang | 185:5c102874b490 | 24 | |
bwang | 185:5c102874b490 | 25 | #endif |