Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE 460 Advanced Control and System Integration

Similar presentations


Presentation on theme: "EE 460 Advanced Control and System Integration"— Presentation transcript:

1 EE 460 Advanced Control and System Integration
EE 460 Advanced Control and Sys Integration An Introduction to Simulink Wed, October 7 EE 460 Advanced Control and System Integration

2 An Intro. to Simulink Modeling the QUANSER QUBE-Servo
Let’s Develop a model of a DC servomotor in Simulink Motor with load Symbol Value (units) Description Rm 8.4 (Ohm) Armature resistance Lm 0.85x10-3 (H) Armature inductance Km 0.042 (V/(rad/s)) Back-EMF constant Kt 0.042 (Nm/A) Torque constant Jh 𝑚 ℎ 𝑟 ℎ 2 /2 (kg.m2) Load Hub Inertia ( 𝑚 ℎ =0.0106, 𝑟 ℎ =0.0111) Jd 𝑚 𝑑 𝑟 𝑑 2 /2 (kg.m2) Disk Inertia ( 𝑚 𝑑 =0.053, 𝑟 𝑑 =0.0248) Jm 4.0x10-6 (kg.m2) Rotor Inertia Wed, October 7 EE 460 Advanced Control and System Integration

3 An Intro. to Simulink Modeling the QUANSER QUBE-Servo
Build the Simulink Model Start MATLAB (run as admin) Open Simulink >> Simulink Create a Blank model New -> Simulink Model Select the Blocks from the Library Browser Continuous -> Transfer Fn Enter Numerator and Denominator coefficients Lm and Rm Change name of block Voltage to Currrent Add remaining blocks Wed, October 7 EE 460 Advanced Control and System Integration

4 An Intro. to Simulink Modeling the QUANSER QUBE-Servo
Define the values of the parameters in MATLAB Can use a *.m file Run the simulation Change model sim params You MUST run the *.m file first as it will define the model params used in the Simulink design!! Wed, October 7 EE 460 Advanced Control and System Integration

5 An Intro. to Simulink Comparing the Simulation with Real Hardware
Now let’s compare simulation with real hardware!! Change the input and output to ports Name the input port “Vin (V)” Name the output port “w (rad/s)” Create a subsystem from the model Add a “step” input Set the step time to 1 sec Set the simulation duration to “2” – i.e., two seconds Add a scope and check if it all works!! %% Students MUST run these two lines code >> C:\Program Files\Quanser\QUARC\quarc\quarc_setup >> mex -setup:'C:\Program Files\MATLAB\2014B\bin\win64\mexopts\winsdk-7.1_c.xml' C Wed, October 7 EE 460 Advanced Control and System Integration

6 An Intro. to Simulink Comparing the Simulation with Real Hardware
Now add the QUARC blocks to communicate with the real-time hardware From the Simulink Library Browser Add: QUARC Targets -> Data Acquisition -> Generic -> configuration HIL Initialize Double click on the icon and set Board Type: to qube_servo_usb QUARC Targets -> Data Acquisition -> Generic -> Intermediate I/O HIL Write Analog Double click on the icon and select Board Name -> HIL-1 Set the Simulation Mode -> External Wed, October 7 EE 460 Advanced Control and System Integration

7 EE 460 Advanced Control and System Integration
Now Build ( ), Connect to Target ( ), and Run ( ) The disc should now spin Wed, October 7 EE 460 Advanced Control and System Integration

8 An Intro. to Simulink Comparing the Simulation with Real Hardware
Now add blocks to read the motor’s speed and compare with simulation Add QUARC Targets -> Data Acquisition -> Generic -> Timebases HIL Read Encoder Timebase Add QUARC Targets -> Discontinuities Inverse Modulus Double click and enter Modulus: 2^16 Add a Gain block with Gain: 2*pi/512/4 Add a low-freq differentiator Transfer function: 200s/(s+200) Add a 2:1 mux and then connect to a scope Wed, October 7 EE 460 Advanced Control and System Integration

9 An Intro. to Simulink Comparing the Simulation with Real Hardware
As before: Now Build, Connect to Target, and Run Wed, October 7 EE 460 Advanced Control and System Integration

10 An Intro. to Simulink Comparing the Simulation with Real Hardware
Final Result Wed, October 7 EE 460 Advanced Control and System Integration


Download ppt "EE 460 Advanced Control and System Integration"

Similar presentations


Ads by Google