-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (22 loc) · 731 Bytes
/
main.py
File metadata and controls
28 lines (22 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import matplotlib.pyplot as plt
from misc_functions import read_file, create_time_span
from pmsm import PMSynchronousMotor
if __name__ == '__main__':
dt = 0.000001
time = create_time_span(0, 0.5, dt)
T_sim = []
motor = PMSynchronousMotor(enable_foc=True, moto_params={"dt": dt})
for t in time:
torque_em = motor.step(t)
T_sim.append(torque_em)
time_m, tau, omega = read_file('matlab_simulation_data/PMSM_dq_model.csv')
# plot the data
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
#ax.plot(time_m, tau, color='r')
ax.plot(time, T_sim, color='b')
height = 2
ax.set_xlim([0, 0.5])
ax.set_ylim([-height, height])
ax.set_title('plot')
plt.show()