|
| 1 | +#ifndef POWERPACK_PARAM_TABLE_H_ |
| 2 | +#define POWERPACK_PARAM_TABLE_H_ |
| 3 | + |
| 4 | +#include <stdint.h> |
| 5 | + |
| 6 | +// Production configuration parameters from "OpenPPG V1.11 Config Shipping" |
| 7 | +// Each entry: { param_name, integer_value } |
| 8 | +// String and array params handled separately. |
| 9 | + |
| 10 | +struct ParamEntry { |
| 11 | + const char* name; |
| 12 | + int64_t value; |
| 13 | +}; |
| 14 | + |
| 15 | +// Production config - derived from the JSON config file. |
| 16 | +// Array/curve params are excluded here (handled separately if needed). |
| 17 | +static const ParamEntry PRODUCTION_CONFIG[] = { |
| 18 | + // Board params |
| 19 | + {"node_id", 32}, |
| 20 | + {"can_baudrate", 0}, // 0 = 1000K |
| 21 | + {"uart_baudrate", 0}, // 0 = 115200 |
| 22 | + {"vbus_upper_limit", 108}, |
| 23 | + {"vbus_lower_limit", 48}, |
| 24 | + {"over_voltage_threshold", 105}, |
| 25 | + {"overt_voltage_tolerance", 6}, |
| 26 | + {"overt_voltage_tolerance2", 8}, |
| 27 | + {"dcbus_lpf_hz", 500}, |
| 28 | + {"led_color", 1}, // 1 = Green |
| 29 | + {"standby_led_type", 1}, // 1 = Always On |
| 30 | + {"rs485_led_port", 0}, // 0 = Led |
| 31 | + |
| 32 | + // Motor params |
| 33 | + {"motor_pole_pairs", 31}, |
| 34 | + {"motor_rs", 147}, |
| 35 | + {"motor_ld", 122}, |
| 36 | + {"motor_lq", 122}, |
| 37 | + {"ls_coef", 100}, |
| 38 | + {"motor_kv", 340}, |
| 39 | + {"motor_max_current", 2200}, |
| 40 | + {"carrier_freq_khz", 16}, |
| 41 | + {"current_loop_coef", 25}, |
| 42 | + |
| 43 | + // Control params |
| 44 | + {"ctrl_input_type", 0}, // 0 = Pwm+CommPwm |
| 45 | + {"throttle_recover_check", 1}, // 1 = Enable |
| 46 | + {"direction", 1}, // 1 = Inversion |
| 47 | + {"idling_speed_rpm", 60}, |
| 48 | + {"motor_max_rpm", 2500}, |
| 49 | + {"stop_type", 0}, // 0 = Free Stop |
| 50 | + {"min_startup_speed_enable", 0}, // Disable |
| 51 | + {"min_startup_speed", 200}, |
| 52 | + |
| 53 | + // Speed params |
| 54 | + {"idling_acc_krpmps", 300}, |
| 55 | + {"max_acc_krpmps", 300}, |
| 56 | + {"max_dec_krpmps", 300}, |
| 57 | + {"max_accel_current", 2100}, |
| 58 | + {"max_decel_current", -15}, |
| 59 | + {"acc_type", 0}, // 0 = Normal Mode |
| 60 | + {"idling_acc_speed_rpm", 1}, |
| 61 | + {"fast_stop_decel_krpmps", 1000}, |
| 62 | + {"fast_stop_decel_current", -50}, |
| 63 | + {"speed_ref_lpf", 650}, |
| 64 | + {"f_speed_loop_kp", 300}, |
| 65 | + {"f_speed_loop_ki", 59}, |
| 66 | + {"s_speed_loop_kp", 150}, |
| 67 | + {"s_speed_loop_ki", 29}, |
| 68 | + {"speed_loop_anti_windup_enable", 0}, |
| 69 | + {"speed_loop_anti_windup_coef", 1}, |
| 70 | + |
| 71 | + // Throttle params |
| 72 | + {"ppm_period_tolerance", 1000}, |
| 73 | + {"ppm_lost_time_ms", 300}, |
| 74 | + {"hyst_ppm", 100}, |
| 75 | + {"throttle_type", 0}, // 0 = Normal |
| 76 | + {"ppm_curve_type", 1}, // 1 = Linear Speed |
| 77 | + {"normal_pwm_start", 10500}, // 1050us in 0.1us units |
| 78 | + {"normal_pwm_end", 19500}, // 1950us |
| 79 | + {"normal_pwm_curve_comp_coef", 3000}, |
| 80 | + |
| 81 | + // Advance params |
| 82 | + {"noload_detect_enable", 1}, |
| 83 | + {"load_dectect_speed_rpm", 750}, |
| 84 | + {"load_detect_current", 80}, |
| 85 | + {"field_weakening_enable", 1}, |
| 86 | + {"field_weakening_max_current", -200}, |
| 87 | + {"acc_comp_enable", 1}, |
| 88 | + {"acc_comp_coef", 30}, |
| 89 | + {"rs_temp_comp_enable", 1}, |
| 90 | + {"rs_temp_comp_coef", 100}, |
| 91 | + {"motor_sound_enable", 1}, |
| 92 | + {"pndef_motor_sound_volume", 3}, |
| 93 | + |
| 94 | + // Observer params |
| 95 | + {"observer_type", 0}, |
| 96 | + {"observer_coef", 20}, |
| 97 | + {"observer_filter_freq", 1000}, |
| 98 | + |
| 99 | + // Protect params |
| 100 | + {"stall_enable", 1}, |
| 101 | + {"stall_idle_speed_current", 400}, |
| 102 | + {"stall_full_speed_current", 2200}, |
| 103 | + {"stall_protected_duration", 1000}, |
| 104 | + {"stall_count", 2}, |
| 105 | + {"stall_recover_enable", 0}, |
| 106 | + {"overcurrent_count", 2}, |
| 107 | + {"high_temp_protect_enable", 1}, |
| 108 | + {"mos_high_temp_limit_1", 110}, |
| 109 | + {"mos_high_temp_limit_2", 140}, |
| 110 | + {"cap_high_temp_limit_1", 95}, |
| 111 | + {"cap_high_temp_limit_2", 105}, |
| 112 | + {"mcu_high_temp_limit_1", 100}, |
| 113 | + {"mcu_high_temp_limit_2", 125}, |
| 114 | + {"low_voltage_protect_enable", 0}, |
| 115 | + {"low_protect_voltage_limit_1", 55}, |
| 116 | + {"low_protect_voltage_limit_2", 35}, |
| 117 | + {"low_protect_voltage_ratio", 40}, |
| 118 | + {"ibus_max_current", 2000}, |
| 119 | + {"ibus_limit_duration", 1000}, |
| 120 | + {"max_power_limit", 25000}, |
| 121 | + {"power_limit", 1}, |
| 122 | + |
| 123 | + // Bidirectional throttle params |
| 124 | + {"positive_ppm_start", 15000}, |
| 125 | + {"positive_ppm_end", 20000}, |
| 126 | + {"negative_ppm_start", 10000}, |
| 127 | + {"negative_ppm_end", 15000}, |
| 128 | + {"postive_pwm_curve_comp_coef", 1905}, |
| 129 | + {"negative_pwm_curve_comp_coef", 1905}, |
| 130 | + |
| 131 | + // Position mode params |
| 132 | + {"position_mode_enable", 0}, |
| 133 | + {"position_mode_enable_work_type", 0}, |
| 134 | + {"position_mode_speed_loop_kp", 680}, |
| 135 | + {"position_mode_speed_loop_ki", 1500}, |
| 136 | + {"position_mode_speed_loop_kd", 480}, |
| 137 | + {"position_loop_pid_limit_1", 300}, |
| 138 | + {"position_loop_pid_limit_2", 1}, |
| 139 | + {"position_loop_kp", 30}, |
| 140 | + {"position_loop_ki", 10}, |
| 141 | + {"position_loop_kd", 30}, |
| 142 | + {"position_mode_current_loop_coef", 20}, |
| 143 | + {"position_mode_max_current", 200}, |
| 144 | + {"position_mode_acc_krpms", 50}, |
| 145 | + {"position_mode_speed_pll_freq", 1200}, |
| 146 | +}; |
| 147 | + |
| 148 | +static const uint16_t PRODUCTION_CONFIG_COUNT = sizeof(PRODUCTION_CONFIG) / sizeof(PRODUCTION_CONFIG[0]); |
| 149 | + |
| 150 | +#endif // POWERPACK_PARAM_TABLE_H_ |
0 commit comments