Merge branch 'feature/63-dc-bus-limit' into RazorsEdge

This commit is contained in:
Paul Guenette
2019-05-25 14:14:20 +02:00
4 changed files with 17 additions and 0 deletions
+14
View File
@@ -150,6 +150,20 @@ bool Axis::do_checks() {
if (!(vbus_voltage <= board_config.dc_bus_overvoltage_trip_level))
error_ |= ERROR_DC_BUS_OVER_VOLTAGE;
// This is the same math that's used in update_brake_current(). Should we calculate IBus globally?
float Ibus_sum = 0.0f;
for (size_t i = 0; i < AXIS_COUNT; ++i) {
if (axes[i]->motor_.armed_state_ == Motor::ARMED_STATE_ARMED) {
Ibus_sum += axes[i]->motor_.current_control_.Ibus;
}
}
if(board_config.power_supply_wattage > 0.0f &&
(Ibus_sum * vbus_voltage) > board_config.power_supply_wattage)
{
error_ |= ERROR_DC_BUS_OVER_POWER;
}
// Sub-components should use set_error which will propegate to this error_
motor_.do_checks();
encoder_.do_checks();
+1
View File
@@ -31,6 +31,7 @@ public:
ERROR_MIN_ENDSTOP_PRESSED = 0x1000,
ERROR_MAX_ENDSTOP_PRESSED = 0x2000,
ERROR_ESTOP_REQUESTED = 0x4000,
ERROR_DC_BUS_OVER_POWER = 0x8000,
};
enum State_t {
+1
View File
@@ -82,6 +82,7 @@ struct BoardConfig_t {
//<! This protects against cases in which the power supply fails to dissipate
//<! the brake power if the brake resistor is disabled.
//<! The default is 26V for the 24V board version and 52V for the 48V board version.
float power_supply_wattage = 0.0f;
PWMMapping_t pwm_mappings[GPIO_COUNT];
PWMMapping_t analog_mappings[GPIO_COUNT];
};
+1
View File
@@ -155,6 +155,7 @@ static inline auto make_obj_tree() {
make_protocol_property("enable_ascii_protocol_on_usb", &board_config.enable_ascii_protocol_on_usb),
make_protocol_property("dc_bus_undervoltage_trip_level", &board_config.dc_bus_undervoltage_trip_level),
make_protocol_property("dc_bus_overvoltage_trip_level", &board_config.dc_bus_overvoltage_trip_level),
make_protocol_property("power_supply_wattage", &board_config.power_supply_wattage),
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR >= 3
make_protocol_object("gpio1_pwm_mapping", make_protocol_definitions(board_config.pwm_mappings[0])),
make_protocol_object("gpio2_pwm_mapping", make_protocol_definitions(board_config.pwm_mappings[1])),