2022‐01‐12 MATLAB tutorial for mini project Mohammad Najjarzadegan Jan 2022 Outline • Mini project brief explanation • System level operation • Implementation in MATLAB • Motor Modeling • For those who never worked with MATLAB/modeling • Overview for those who took ELEC 341 • Simulation in Simulink 1 2022‐01‐12 Mini project Mechanical load Motor Your computer Microcontroller Motor driver/amplifier • Computer: MCU programming and command • MCU: Digital controller • Driver/Amplifier: Amplifies low voltage/current MCU signal • Motor: Drives the mechanical load • Mechanical load: Simply a pandelum System level operation Mechanical load Motor Your computer Input signal Comp Microcontroller Controller Motor driver/amplifier Amplifier Sensor Mech & Motor Position 2 2022‐01‐12 Matlab/Simulink • Matlab is mathematical language. • Only understands numbers, equations and mathematical operations. • We need to model the physical units with mathematical blocks. Modeling • No Amplifier for the mini project. • Sensor is Unity gain for mini project. • Comparison is basically a subtraction. • The controller is a P-controller, i.e. a constant gain . • Input signal is a step-function from 0 to 90. • Model Motor&Mech is the challenging part. 3 2022‐01‐12 Motor modeling • Motors have some windings in their rotor/stator. • Winding produces magnetic field and acts as an inductor. • The wires also have some resistance. • Flux proportional to current and torque proportional to flux. • Back emf proportional to speed and against the input voltage. Motor modeling 𝑰 𝝉 𝝎 𝑽 𝑽𝒃𝒆𝒎𝒇 𝑳𝒔 𝑹 𝑲𝒎 𝑰 𝝉 𝑱𝒔 𝑽𝒃𝒆𝒎𝒇 𝑩 𝑲𝒂 𝝎 4 2022‐01‐12 Datasheet 1183 626.2 Km = Ka *10^(‐7) Implementation in Simulink • Input step function • Constant gain • Transfer function • Subtraction • Scope 5