Tutorial 3: Simulating a system

advertisement
Remark: the reader of this tutorial can find out more how to use GME
modeling environment by looking at GME tutorials. The webpage of GME is
at: http://w3.isis.vanderbilt.edu/Projects/gme/Tutorials/
Tutorial 3: Simulating a system
Start GME, open a system, like “SampleSystem1.mga”. Make sure the design is
opened in the active editor window. Click
button on the toolbar to launch the
system simulator.
The simulator has configuration dialog as shown in Fig. 1 below.
Fig. 1: Simulator configuration dialog.
1
Basically, the simulator shows the system interface that consists of inputs and
outputs. One can select a parameter to inspect its type. To simulate a system,
some test cases have to be supplied. A test case structurally contains a
description, a list of input values and a list of expected outputs. Expectation is
defined in predicates. In X-MAN tool, test case files have XML structure. A sample
can be found in “samples” directory.
The tool can generate a test case skeleton to aid the preparation of system
simulation. To use this functionality, press “Generate Test Case Skeleton” button
on the dialog (as shown in Fig. 1).
Fig. 2: Test case generation confirmation
A confirmation dialog should appear to confirm the successful test case
generation. The test case file is named “testcaseSkeleton.xml” and always located
in the same directory of the system model file.
A sample test case is depicted in Fig. 3.
Fig. 3: A sample test case
2
The test case consists of a number of inputs and assertions. Each assertion
evaluates an output of a simulation with an expected value. The supported
assertive operators are < (LT), > (GT), == (EQ), ≤ (LTE), ≥ (GTE) and ranging
(RNG). These operators except the RNG require a value as the operand. RNG
requires two values to be the lower and upper bounds. Obviously, RNG returns
TRUE when a simulation output falls in the specified range.
To proceed with a simulation, provide the simulator with a test case file, e.g.
“testSys1.xml” as in Fig. 1. In addition, if component instances require some data
files for their computation, supply them.
Press “OK” to start the simulation. Once, the simulation terminates, a dialog
summarizing simulation results will display as one in Fig. 4. i.e. the test case ran
successfully and passed.
Fig. 4: Simulation summary dialog
3
Click “Details” to view test case details and simulation traces that contain real
inputs and outputs at many elements of the system architecture. An example is
depicted in the following Fig. 5.
Fig. 5: Test case details and simulation traces
As we can see, the final outputs satisfied the assertions. Hence, the test case
passed.
Click “OK” to finish. Note that, one can press “OK” at simulation dialog to end the
simulation without having to view simulation traces.
4
Download