By Jakob Engblom
An embedded computer system is rarely an isolated system. While personal computers and consumer electronics tend to operate happily on their own with a bit of user interaction, most embedded systems are deeply connected to their surrounding world. They sense the world, run control algorithms on the values read, and use actuators to control the state of the world. They are active participants in a continuously evolving cyber-physical reality. Simulating such systems cannot stop at the boundary of the computer system – the physical world needs to be part of the simulation as well. The video we have made available on Youtube shows one example of how this is done with Wind River Simics. There are also several videos posted by NASA showing how Simics is used as part of a true full-system simulation for the Global Precipitation Measurement (GPM) mission.
The setup used in the Simics demo video is this:
We have a board running VxWorks and a control application, and then we have a water heater that is being controlled. The control is exerted via an actuator that changes the power applied by the heating element in the heater, based on the current water temperature reported from a thermometer. The thermometer and heater are attached to analog-to-digital (ADC) and digital-to-analog (DAC) converters on the computer board (for more on device modeling in Simics, see my blog post and demo of Simics modeling). The control software only accesses the ADC and DAC devices, just like it would in a real system. As shown below, the physics simulator is actually implemented inside of Simics, using the Simics Python interpreter and API.
Having the model as part of Simics makes it possible to reverse the simulation, and to inspect and control the physics model state using the Simics GUI. Also not shown in the video is the ability it gives us to break on events in the simulation, such as water boiling or the water heater burning (sorry for the spoiler). However, a more common case is to run existing physics simulators outside of Simics, and then build a custom connection from that simulator to Simics. The physics model presents itself using a Simics system panel, alongside with the display panel of the control computer and the control panel that lets us inject faults in the system.
Some of the fault injection abilities of the model are shown in the video, but there are more available. The physics model has been built in such a way that the thermometer (temperature sensor) can be made to be noisy and report randomly distorted readings and the thermometer can be frozen at a certain reading (i.e., it does not look at the physics model). The physics model can be changed to assume a different altitude (affecting the boiling point of water), and the heater can be stuck at its current power input. With such functions, the robustness of the software in presence of issues in the real world can be tested, without searching for extreme conditions or hacking the hardware.
NASA Simulator and Simics
In our experience, the common case is that Simics users have already built up vast simulation systems to handle physics, mechanics, and control algorithms. These systems are often very large, running on tens of different host computers, and integrated using custom middleware systems. Thanks to the Simics Extension Builder API, it is possible to build integrations between Simics and every imaginable system.
One example of such simulator integration is the work that NASA has made public (see the NASA IV&V Success Story on Youtube). In the NASA Go-Sim setup (see Youtube video on G0-Sim), you find a combination of a Simics-simulated control computer and a custom physics and system simulation. There are simulated 1553 and Spacewire buses connecting the control computer to various sensors and actuators in the spacecraft, where messages can be intercepted and modified in order to test the software robustness in the presence of faults (see another Youtube video), the same idea as the fault injection and physical .
To find out more of how Simics can help you simulate your system, go to http://www.simics.com or http://www.windriver.com/products/simics/ . We also have many other Simics action videos and other interesting videos available on the Wind River channel on Youtube.