Skip to content

Commit ceafbe3

Browse files
madcowswePAJohnson
authored andcommitted
let acim identification run model without data
1 parent d5ba094 commit ceafbe3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Firmware/MotorControl/motor.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@ void Motor::update(uint32_t timestamp) {
529529

530530
iq *= direction_;
531531

532+
533+
// Id takes priority, obey actual norm limit
534+
532535
// TODO: 2-norm vs independent clamping (current could be sqrt(2) bigger)
533536
float ilim = axis_->motor_.effective_current_lim_;
534537
id = std::clamp(id, -ilim, ilim);

analysis/motor_analysis/ac_induction_motor.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
filename = "oscilloscope.csv"
99

10+
USE_TEST_DATA = False
1011
PLOT_INITAL = True
1112
DO_FITTING = False
1213
PLOT_PROGRESS = False
@@ -109,6 +110,7 @@ def run(self, time_series, voltage, omega_stator, omega_rotor):
109110
def print_parameter_info(self):
110111
print()
111112
print('Given parameters:')
113+
print('pole_pairs = {}'.format(EngNumber(pole_pairs)))
112114
print('rotor_resistance = {}ohm'.format(EngNumber(assumed_rotor_resistance)))
113115

114116
print()
@@ -164,8 +166,10 @@ def plot_data(t, y, ref, title):
164166
# load test data
165167
t = np.arange(4096)/8000.0
166168
voltage_step = 1.0
167-
with open(filename, 'r') as fp:
168-
test_response = np.array([float(x) for x in fp.readlines()])
169+
if USE_TEST_DATA:
170+
with open(filename, 'r') as fp:
171+
test_response = np.array([float(x) for x in fp.readlines()])
172+
else: test_response = None
169173

170174

171175
inital_parameters = np.zeros(len(ACMotor.parameter_definitions))

0 commit comments

Comments
 (0)