|
Accelerate
Systematic Testing and Analysis of MATLAB® Algorithms
with
SystemTest 2 and Distributed Computing Tools
Quite often engineers will have to model their systems
with different scenario so as to verify and validate their
designs against the requirements. To do so, they will have
to perform countless simulations with hundreds or thousands
set of parameters which might take weeks or months to complete.
With SystemTest,
engineers can now design and share tests ensuring standard
and repeatable test verification from research and development
through preproduction. When used with Distributed Computing
Toolbox, SystemTest can run test iterations on multiple processors
or machines thereby shorten the time required for the entire
analysis routine.
The example
below illustrates how to deploy SystemTest for a parameter-selection
problem. Refer to the simple low-pass filter circuit illustrated
below:

User
can model this circuit using Node Analysis to compute the
transfer function as shown here:

Assuming
you were tasked to determine the values of L1, L2 and C1 such
that the desired frequency response of the low pass filter
is as shown below. This low pass filter has a cut-off frequency
at 1 rad/sec.

You might
want to simulate the frequency response of the filter circuitry,
which can be easily modeled as a MATLAB function, by simulating
over a range of L1, L2 and C1 values as shown below. Then
we can do correlation to compare the similarity between the
obtained and the desired frequency response.
L1= [1:0.2:5]
(21 values)
L2= [1:0.2:5] (21 values)
C1= [1:0.2:3] (11 values)
If we
were to manually feeding in different possible combinations
of L1, L2 and C1, then the total number of simulations is
given by:
| Total
combination of L1, L2 and C1 |
=
21 x 21 x 11 |
| |
=
4851 |
It is
not easy to test all 4851 of parameters. Testing routine program
will be needed. And to substitute each combination of L1,
L2 and C1 one by one is very time consuming. Hence, we can
make use of SystemTest to repetitively test the model with
different combination of L1, L2 and C1 and explore how the
model would respond to varying value of L1, L2 and C1. SystemTest
provides a graphical integrated environment that you can use
to create and edit tests. We can set the range for L1, L2
and C1 as different test vectors.
SystemTest
will help you to compute all the possible combinations of
L1, L2 and C1 automatically. Hence, we do not need to manually
write a testing routine. We can define our transfer function
(MATLAB Script) in the Main Test to test with different combinations
of L1, L2 and C1.

Running
the test in the single computer will be time consuming. We
can utilize the distributed Computing Toolbox to distributing
a test to multiple processors or machines to speed up the
total time a test takes to execute. This can enable us to
run more test cases in the same amount of time as a test run
on one processor. We can just enable the distributed computing
as diagram below:

By utilizing
multiple processor of processing power, we speed up our simulation
time to 1.5 minutes compare to using single computer that
take about 20 minutes which is 10 times faster (depends on
how many processor you are using, it can up to hundreds or
thousands times faster).
For
more information about SystemTest and Distributed Computing
Toolbox Integration, please visit the following URL:
http://www.mathworks.com/products/systemtest/
Streaming
Video Images from Image Acquisition Device
With Image Acquisition Toolbox, MATLAB users can now easily
acquire real-time live images from image acquisition device
directly to either MATLAB or Simulink.
Option
1: MATLAB Approach
In
MATLAB, it involves the following steps:
1.
Identifying Installed Adaptors
| >>
imaqInfo = imaqhwinfo |
| |
| imaqInfo
= |
| |
| |
InstalledAdaptors:
{'coreco' 'winvideo'} |
| |
|
MATLABVersion:
'7.5 (R2007b)' |
| |
|
|
ToolboxName:
'Image Acquisition Toolbox' |
| |
|
ToolboxVersion:
'3.0 (R2007b)' |
2. Obtaining Device Information
| >>
hwInfo = imaqhwinfo('winvideo') |
| |
| hwInfo
= |
| |
|
|
AdaptorDllName:
'D:\MATLAB\R2007b\toolbox\imaq\imaqadaptors\win32\mwwinvideoimaq.dll' |
|
AdaptorDllVersion:
'3.0 (R2007b)' |
|
|
|
AdaptorName:
'winvideo' |
|
|
|
|
DeviceIDs:
{[1] [2]} |
|
|
|
|
DeviceInfo:
[1x2 struct] |
3. Setting
up Device Properties
| >>
vid = videoinput('winvideo',1) |
| |
| Summary
of Video Input Object Using 'Creative WebCam NX Ultra'. |
| |
| |
Acquisition
Source(s): input1 is available. |
| |
| |
Acquisition
Parameters: 'input1' is the current selected source. |
| |
|
|
|
10
frames per trigger using the selected source. |
| |
|
|
|
'RGB24_320x240'
video data to be logged upon START. |
| |
|
|
|
Grabbing
first of every 1 frame(s). |
| |
|
|
|
Log
data to 'memory' on trigger. |
| |
| |
|
Trigger
Parameters: 1 'immediate' trigger(s) on START. |
| |
| |
|
|
Status:
Waiting for START. |
| |
|
|
|
0
frames acquired since starting. |
| |
|
|
|
0
frames available for GETDATA. |
To set
a device property, i.e. frame rate to 15 frames per second:
>>
set(vid,'FramesPerTrigger',15)
4. Preview Image
>>
preview(vid);
Option
2: Simulink Approach
In Simulink, the same steps are performed in the property
dialog as shown below:


Comparison
between MATLAB and Simulink
From the examples above, you'll notice that the second approach
do not involve any MATLAB scripting. This is because Simulink
uses a graphical point-and-click approach which makes developing
real-time video processing application much quicker as compared
to the conventional approach.
|