Professional Documents
Culture Documents
net/publication/267713959
CITATIONS READS
0 1,542
3 authors:
Sameer Prabhu
The MathWorks, Inc
23 PUBLICATIONS 210 CITATIONS
SEE PROFILE
All content following this page was uploaded by Sameer Prabhu on 25 March 2016.
To link the soft HMI and the logic developed, each HMI
element will need additional element-specific code. To
better understand the process for connecting a button to
the model, consider the ON/OFF button as an example.
When the ignition key is in the ON or Accessory position, Figure 4 - Virtual HMI FM mode state.
the radio head unit is typically powered and is waiting for
a request from the user – for example, turning the radio This is an example of exercising the model through the
on or selecting a desired mode (such as AM, FM, or virtual HMI to test the logic and ensure that it is
CD). The functional logic behind the HMI accepts inputs functioning as expected and meeting the requirements.
from the HMI, performs the decision-making logic to In the event that the system does not respond properly
handle the user request, and displays any change in to the button presses as described by the requirements,
model animation capabilities enables the engineer to
investigate visually the reaction of the internal HMI logic Each of these steps will be explained in detail within the
to the button presses. In Figure 5, the FM state is context of a radio head unit model.
highlighted in blue designating this as the active state
during simulation. Highlighting provides the engineer IDENTIFYING INPUTS AND OUTPUTS
with immediate feedback on the system’s response to
button presses. The radio faceplate virtual HMI contains 21 different
buttons that can be used as system inputs. This
example focuses on the ON/OFF button and describes
the steps needed to connect it to the Simulink model.
The same process can be applied to each of the 21
buttons.
h = gen_faceplate; % instantiate the user interface The process in this case is somewhat simpler, because
hGUI = guihandles(h); % create a structure of user interface handles the connection between the virtual VMI and the Simulink
model streamlines signal logging. Simulink provides an
Simulink can use these handles through MATLAB and, easy method to log signals to the MATLAB workspace.
as in this example, assign various sets of string data to Once the signals are logged to the workspace, the
the LCD display. One way to do this is using a MATLAB Signal Builder API, as described in the earlier paper, can
be used to populate Signal Builder with the test case to The radio faceplate example has seven buttons that
be saved. Signal Builder blocks can then be used to have been made active in the virtual HMI, which makes
store the entire suite of test cases for running the it a significant challenge to manually create the required
complete test suite against the model without interaction number of test cases to completely test the specification.
from the user. Engineers can log the outputs and later In addition, there are a number of test case possibilities
visualize and the compare the results. that are not covered by the requirements or may not
have been considered by the designer.
FORMAL VERIFICATION OF THE HMI
FUNCTIONAL LOGIC Requirements-based testing is a necessity and is an
effective first pass when developing test vectors, but
Once the HMI logic design is complete, test engineers there are many button press sequences or internal
can create a set of reusable test vectors using the events that are not explicitly covered in the requirements
process discussed in the previous paper and highlighted and that may cause undesirable behavior of the radio.
above. However, given the combinatorial complexity of These conditions are the most difficult to test and can go
the current set of automotive HMIs, it is nearly undetected until the radio has been placed in the vehicle
impossible for test engineers to fully exercise all the for testing on a bumpy road where it is common for the
logic in the design. driver to press buttons out of order. For example, when
inserting a CD, the user may accidentally press the fast-
For example, given a set of m buttons on a typical HMI forward (FF) button before the CD has been fully
in which each button can lead to n different sub-menus inserted. A typical test engineer developing tests to the
with a different set of functions for each button, and requirements specification would insert the disc and wait
where “no function” is also considered a function to be for it to start playing before pressing the FF button. In
verified, a test engineer would have to write mn tests. If a the real world scenario, because the FF button was
combination of buttons enables other functionality, such pressed prior to the disc being fully inserted, the
as diagnostics, then the set of tests becomes even more behavior of the radio for this unexpected condition is not
complicated. Clearly, guaranteeing that the logic is fully known.
tested goes well beyond the functional testing specified
by the requirements and what can be feasibly Formal methods can assist in finding these undesirable,
accomplished by manually pressing all of the button unintended conditions. Many of these scenarios go
combinations. untested when using manual test vector generation
techniques driven by the requirements simply because it
As an example, the requirement that “when the battery is is very time consuming and difficult to think of these
powered (key in Accessory or ON position), the audio abnormal button presses. Formal verification methods
unit goes into the PowerOn mode,” also requires that all and automatic test vector generation enable engineers
of the buttons be active. Moreover, when the radio is in to analyze the system as an independent party that has
PowerOff mode, the unwritten requirement is that all of no preconceived notions of how the system is designed.
the buttons need to be inactive. Formal verification techniques with automatic test vector
generation analyze the system and automatically
Using tools that take advantage of formal methods such generate test vectors based on the possible decision
as Simulink® Design Verifier™ [9], engineers can transitions contained in the system.
analyze the logic models to determine the inputs that will
result in full functional testing of the logic and identify In the HMI model, the mode manager contains all of the
unreachable states (such as switch conditions that functional logic. As a result it makes sense to rigorously
cannot occur) [9]. test this component to achieve close to 100% model
coverage and determine if there are any unreachable
Using software that implements formal methods, states within the model. In this example, the mode
engineers can generate tests for models to satisfy model manager is an atomic subsystem; by right clicking on the
coverage and user-defined objectives. Engineers can subsystem block and execute Simulink Design Verifier,
also prove model properties and generate examples of engineers can automatically generate tests as shown in
violations. Figure 8.
Figure 8 - Executing Simulink® Design Verifier™ on For the radio head unit, 21 test cases were generated to
a subsystem. test all of the identified objectives. After generating the
test cases, a new test harness model is automatically
generated. The system under test is copied into this
Once the portion of the system to be tested is selected, model and connected to a Signal Builder block
the model will be analyzed and a list of test objectives is containing each of the automatically generated test
created to achieve the model coverage objectives cases. Figure 10 shows the automatically generated
selected by the engineer. In the radio faceplate case, test harness and Figure 11 shows the Signal Builder
decision coverage is all that is required given the nature block containing each of the automatically generated
of the functional logic in the mode manager subsystem test vectors.
as shown in Figure 9.