Pages

Search This Blog

Thursday, March 10, 2011

Real-Time Hardware Control and Signal Processing using Simulink

If you don't want to use a microcontroller in your hardware project, dont worry! You can use the far more easy and advanced Simulink blocks to realize a real-time control system or signal processor. You can  use a Data Acquisition Device or Serial/Parallel Port of your PC for this purpose. Just follow these steps.

1) After installing the driver for the Data Acquisition Device, open MATLAB and write rtwintgt -setup in the command window. This will install the Real-Time Windows Target kernel.
2) Start Simulink and create a new model. Press Ctrl+E, Configuration Parameters will appear. In Solver options, change 'Variable-step' to 'Fixed-step'. Now select 'Real-Time Workshop' form the left column and change system target file to 'rtwin.tlc' and click ok.

3) Open the Simulink Library Browser, select 'Real-Time Windows Target' from the left column and drag the 'Analog Input' block to your model.

4) Double-click on the 'Analog Input' block inside your model, click on 'Install new board', select your device's manufacturer and model. Serial port, parallel port, mouse, etc. appear in 'Standard Devices'. Set your desired parameters, and click on 'Test' to see if the device is properly plugged in.

5) In the 'Block Parameters' window, you can select the sampling time period, input channel no., input range, etc.
6) Now you can do anything with the input signal by inserting Simulink blocks, and if you want to take an output depending upon the input, insert an 'Analog Output' block at the end.

7) Your system is just ready to run. In the toolbar at the top, set the Simulation Mode to 'External' and Simulation Stop Time as desired (use 'inf' here if you want to stop simulation on will). Click on 'Incremental Build' icon, then 'Connect to Target' and start the simulation.

No comments:

Post a Comment