Accurate 1D Thermo - Fluid Simulation in Real - Time Environments
By David Hunt, Flowmaster RDI Manager & Product Architect, Mentor Graphics
Control Systems are being increasingly used in complex engineering systems. Where testing cannot easily or safely be done in a real operating environment then development of these control systems requires robust, portable, real-time models of the engineering systems to facilitate:
- Failure mode analysis
- Trade off studies
- Design validation
- What-if studies
- Hardware-in-the-loop (HIL) testing
- In operation simulators
Flowmaster is able to accurately model a wide range of thermo-fluid systems but these simulations are often not able to run natively in real-time, making them unsuitable for coupling with an HIL environment. However, Flowmaster can generate Response-Surfaces that characterize the behavior of its models. Mentor Graphics collaborated with EnginSoft to implement this capability and the Response-Surfaces can be exported as C++ code or as MATLAB™ S-Functions.
These Response-Surface Models (RSM) provide robust, portable, real-time models which are suitable for Control System development, including HIL testing. Additionally, RSMs can be used in any model based environment; they can be passed to design and operational teams and used by non-experts to review the results of a simulation model analysis and understand a system’s behavior more easily.
The main application areas for hardware-in-the-loop simulation are in the design of Electronic Control Units where the controller is connected to a real-time simulator. This provides a way of testing control systems over the full range of operating conditions (including failure modes) both cost effectively and safely.
This article will look at a simplified automotive engine cooling system (Figure. 1) and how a robust, portable, real-time Response-Surface Model (RSM) can be generated using Flowmaster. In this example the engine is represented by a heat source transmitted into the cooling system via a thermal bridge component. The flow passes through a heat exchanger and there is a bypass line controlled by a set of globe valves that represent the thermostat.
The primary circuit consists of a pump, a heat source, a set of globe valves, a cross-flow heat exchanger and a pressure source that pressurizes the system. The bypass line includes a globe valve, component C4, which controls the amount of fluid that passes through the heat exchanger by modulating between position 0 and 1. If the valve is in position 0, then a quantity of flow will pass through the bypass line and if the valve is in position 1, then the entire flow passes through the heat exchanger.
In this study, we need to model the impact on the cooling system of varying pump speeds, air flows over the radiator and engine heat outputs. We also want to include the effects of various valve positions for the bypass line from fully closed to fully open.
The following four input parameters are defined for the network:
- [Pump Speed] Mixed Flow Pump, C16
- [Air Flow] Flow Source, C14
- [Engine Heat Output] Heat Flow Source, C1
- [Valve_C4] Valve Opening, C4
The output parameters are defined as:
- Top Hose Temperature (Thermal Bridge C2, Node 2)
- Pump Flow Rate (Mixed Flow Pump, C16)
To generate the Response-Surface, Flowmaster runs simulations for this model over the range of the input parameters. It is not possible to run every possible combination of input parameters. Instead, a set of parameters are chosen which give a uniform distribution of combinations. The user sets up the input parameters using the Design of Experiments feature in Figure 2.
Here a Latin Square of ten levels is considered which generates 100 simulations i.e. n2 simulations, where n is the number of different levels. Using four discrete values for the valve component C4 of 0, 0.3, 0.6 and 1 will produce a total of 400 steady state simulations. More levels, n, leads to more simulations and means that the Response-Surface has a higher fidelity – but takes longer to generate.
In fluid systems, discrete values (like valve position) can lead to radically different flows and a single response-surface would be inaccurate. So, separate Response-Surfaces are created for each combination of discrete values to increase accuracy of the RSM. Once the 400 simulations are completed, response surfaces for each output variable can be created and reviewed by the user. The Response-Surfaces are generated using “Radial Basis Functions” (RBF). Flowmaster offers different types of RBF but will select the best fit while offering the user the flexibility to customize the RBF. The result of applying a RBF to the simulation results is shown in Figure 3.
The Deviation Details tool provides an immediate and simple evaluation of the goodness-of-fit of each response surface on the basis of its deviation. As shown in Figures 4 and 5 the best response surfaces for the flow through the pump and through the heat exchanger are those computed with Gaussian RBF while the best Response-Surface for the temperature in the primary circuit is the one computed with Hardy’s MultiQuadrics.
Once the user is happy with the level of fidelity in each Response-Surface, then they can be exported to a Response-Surface Model (C++ code or MATLAB™ S-Functions) suitable for use in a real-time simulation or as a portable model for other designers or operators.
The product of the collaboration between EnginSoft and Mentor Graphics in the latest version of Flowmaster V7 now allows for robust, portable, real-time models to be generated using a Design of Experiments approach. These Response-Surface Models can be exported as C++ code or as MATLAB™ S-Functions suitable as the backend code to a runtime model of the system or for use in an HIL environment.
The ability to characterize a system’s behavior in exported code opens up a wide range of possibilities, such as creating a simple dashboard that allows non-expert users to understand and predict system performances in Flowmaster, inserting the code into a hardware-in-the-loop logic, or embedding the code into other codes for co-simulations.
McKay, B., and Rogoyski, E. 1995, Latin Squares of Order 10, Electronic Journal of Combinatorics, 2(3), 1
Fisher, R., and Yates, F. 1934, The 6 x 6 Latin Squares, Proceedings of the Cambridge Philosophical Society, 30, 492
Jacobson, M., and Matthews, P. 1996, Generating Uniformly Distributed Latin Squares, Journal of Combinatorial Designs, 4(6), 405 6
Buhmann, M. D., Radial Basis Functions: Theory and Implementations, Cambridge University Press, 2003.
Rippa, S., An algorithm for selecting a good value for the parameter c in radial basis function interpolation, Adv. in Comp. Math., 11, pp. 193-210.