% Clear workspace close all clear clc % Load model parameters Ts = 5e-7; % [s] Model sampling time (200 KHz) Ts_ctrl = 6e-5; % [s] Controller sampling time (50us)5e-5 f_speed_ctrl = 500; % [Hz] Speed/torque Controller frequency = (500 Hz) Ts_Spd_ctl = 1/f_speed_ctrl; %Simulink provider Motor parameters n_polePairs = 4; % [-] Number of motor pole pairs PM = 0.01688; % Permanent magnet flux linkage, Ld = 0.07e-3;% d-axis inductance, Lq = 0.150e-3; % q-axis inductance, Rs = 0.011; % Stator resistance, J = 0.03945; % Moment of inertia, bandwith = 5000; i_Udc = 96; % DCbus max voltage