diff --git a/Firmware/MotorControl/motor.cpp b/Firmware/MotorControl/motor.cpp index 2f170fd6..ac924018 100644 --- a/Firmware/MotorControl/motor.cpp +++ b/Firmware/MotorControl/motor.cpp @@ -529,6 +529,9 @@ void Motor::update(uint32_t timestamp) { iq *= direction_; + + // Id takes priority, obey actual norm limit + // TODO: 2-norm vs independent clamping (current could be sqrt(2) bigger) float ilim = axis_->motor_.effective_current_lim_; id = std::clamp(id, -ilim, ilim); diff --git a/analysis/motor_analysis/ac_induction_motor.py b/analysis/motor_analysis/ac_induction_motor.py index ccc06ec8..b8820850 100644 --- a/analysis/motor_analysis/ac_induction_motor.py +++ b/analysis/motor_analysis/ac_induction_motor.py @@ -7,6 +7,7 @@ from engineering_notation import EngNumber filename = "oscilloscope.csv" +USE_TEST_DATA = False PLOT_INITAL = True DO_FITTING = False PLOT_PROGRESS = False @@ -109,6 +110,7 @@ class ACMotor(): def print_parameter_info(self): print() print('Given parameters:') + print('pole_pairs = {}'.format(EngNumber(pole_pairs))) print('rotor_resistance = {}ohm'.format(EngNumber(assumed_rotor_resistance))) print() @@ -164,8 +166,10 @@ def plot_data(t, y, ref, title): # load test data t = np.arange(4096)/8000.0 voltage_step = 1.0 -with open(filename, 'r') as fp: - test_response = np.array([float(x) for x in fp.readlines()]) +if USE_TEST_DATA: + with open(filename, 'r') as fp: + test_response = np.array([float(x) for x in fp.readlines()]) +else: test_response = None inital_parameters = np.zeros(len(ACMotor.parameter_definitions))