Modeling embedded systems - Part 3: Where to model
Editor’s Note: In Part 3 of a four-part tutorial on modeling tools, Shelley Gretlein of National Instruments considers the situations when modeling is your best choice in developing an embedded systems design.
Modeling is useful, if not required, in mission- and safety-critical applications, highly complex applications, and large development team projects. But although there are numerous benefits to modeling, you shouldn’t necessarily model every embedded system. Certain simple systems or prototypes don’t require this level of formality. In this part of the series, we will consider situations when prototyping is not an option.
Mission- and safety-critical applications
Software as a percentage of the overall system is growing rapidly in all embedded systems, but particularly in mission-and safety-critical applications. The definition of ‘mission critical’ may vary depending upon whom you talk to, but generally speaking, the term refers to any application whose failure could potentially cost large amounts of money, cause injury, or seriously damage the reputation of a company. For mission- and safety-critical systems, software modeling, combined with best practices in software engineering and formal industry standards such as DO-254B, all combine to facilitate and guarantee safe and reliable embedded systems.
As we see more software content in embedded systems, governments and industry are evolving the required provisions in the overall design process. Typically, these start with formal requirements tracking with documented paper trails, clear correlation of the design requirements to code, and very clear correlation of tests validating each of the design requirements. In the most idealistic sense, we seek a design tool and modeling language that creates correct-by-design solutions or provably correct systems, but in the absence of these theoretically attainable, embedded systems, safety critical especially can derive great benefit from the union of software engineering best practices with software modeling approaches.
Highly-complex applications and systems
Every embedded system report or embedded community survey speaks to the skyrocketing complexity of our designs combined with shrinking timelines.
To highlight the evolution of complexity in embedded design, the list below shows a few facts about different hardware capabilities and software content in different hardware and software systems:
- Apollo Guidance Computer (AGC) <64 Kilowords, 1.024MHz
- 1960’s jet fighter ~ 50 thousand lines
- JSF ~50 million lines
- F-22 Raptor uses 2.5 million lines while the F-35 uses 5.6 million lines
- 100 million lines of code in a modern vehicle
Embedded control systems for the automotive space are good examples of complex and critical designs. Specifically, modern automotive powertrain control systems benefit from modeling techniques as they must continue to evolve to satisfy requirements, including regulating exhaust emissions to meet increasingly stringent standards; providing improved fuel economy to comply with corporate average fuel economy (CAFE) regulations;, and meeting customer demands for performance and comfort. These objectives are interrelated but often conflict. For example, lean-burn technology can reduce fuel consumption significantly, but it also reduces three-way catalytic conversion efficiency, causing additional air pollution. Because of this complexity, modeling is a desirable and efficient way to optimize your design. Using software modeling for automotive designs, you can much more easily understand the impact of the overall design while tweaking the numerous parameters.
When Visteon, an automotive design house in the United Kingdom, had such a challenge, they used software-modeling techniques (Figure 15) to simulate multiple variables to validate complex automotive engine designs and achieve the best fuel economy, engine performance, and emissions control.
One project was to design a twin-independent variable camshaft timing engine where both the intake and exhaust camshafts are adjusted independently. The variation is a function of throttle position and engine speed. Because the system offered a large number of degrees of freedom for obtaining engine performance, they needed a method to optimize the valve-timing parameters for the best fuel economy, engine performance, and emission control, while understanding and implementing the highly complex real-time control algorithm that results from this design.
Click on image to enlarge.
Figure 15 - Using NI LabVIEW as a modeling tool, this automotive embedded design engineering team was able to create interactive simulation for modeling their real-time control system.
The embedded engineers chose a real-time control and analysis approach for their design. The purpose was to provide the engine with torque reference tracking while minimizing brake-specific fuel consumption and optimizing combustion stability. They chose to do their modeling and simulation with a graphical system design tool that not only could perform the modeling and simulation, but was also tightly integrated with the real-time hardware they needed for the prototype and deployment of their design.
For the engine model, the main manipulated variables for the control system include mass airflow into the intake manifold, independent camshaft positioning of the inlet, and exhaust/valve timing with respect to the crankshaft. The controlled outputs are the engine torque, brake-specific fuel consumption, and the coefficient of variance of indicated mean effective pressure. Other variables influencing the system, such as engine speed and engine coolant temperature, are treated as external parameters and are used as scheduling variables for control.
Using the graphical modeling software, they were able to ensure that the continuous time engine model combined a static characteristic of the combustion process with differential equations describing actuators and the intake manifold to obtain a dynamic model. The resulting nonlinear engine model (Figure 16) with multiple input, multiple output (MIMO) properties was analyzed by manipulating each input variable, and exhibited strong cross-interaction between inputs and outputs. A local model was developed for the control application by linearizing the nonlinear model at fixed operating points.
Click on image to enlarge.
Figure 16 - A screenshot demonstrating the MIMO (multiple input, multiple output) control design approach used in this design.
An advanced optimal controller was designed using the LQR technique. The controller in this design had two objectives - offset minimization and regulator action. These objectives were achieved by introducing integral action within the loop to remove steady-state errors in the presence of disturbances. To define the performance index and to minimize the output error and rate of change in the output, the gain was obtained using the modeling software for the engine-state feedback and reference tracking using the optimal theory of continuous time systems.
As shown in Figure 17, the local controller and linearized model were also built and simulated in their software. The system tracked the engine torque with an accurate steady state value corresponding to the set point, while simultaneously minimizing brake-specific fuel consumption and the coefficient of variation in indicated mean effective pressure. To ensure online response tuning by visual inspection, the Q and R tuning parameters were made available on the front panel, which optimized the interactive simulation capabilities of the embedded application.
The embedded engineers chose to implement the structure of the model and controller in discrete time so it could easily be transferred to computer hardware for final implementation. The discrete controller can either be derived from the designed continuous controller or designed directly in discrete time using the same LQR application.
Click on image to enlarge.
Figure 17 - Many control design and simulation software tools are designed for linear and nonlinear systems.
Since their model was nonlinear, the optimal gain parameters that produce the desired response at one operating point might not produce a satisfactory response at another operating point. Therefore, gain scheduling can be applied using different sets of optimal gain parameters for different regions of operation of the nonlinear model. The process of gain tuning was streamlined using interactive adjustment of parameters through the graphical user interface.
This automotive example demonstrates how valuable modeling and simulation can be in an embedded application with many different design parameters. Without these powerful software tools, this design could have easily taken twice as long to design and may never have resulted in such an optimal design.