Hardware in the Loop (HiL) testing is not just for the automotive industry! Our experience with simulation-based control development for thermal systems such as heat pumps, refrigeration plants or fuel cells.
In many industries HiL tests and its cousins MiL and SiL are a standard part of control development processes. Using simulation models to test controllers in closed loop ensures performance and reliability of controllers integrated in products.
These technologies are very matured and established for electrical and mechanical applications, not so much for thermal applications such as heat pumps or refrigeration systems. But during the last years we had quite a few projects about HiL tests of thermal systems. We learned a lot during these projects. Here are three key findings.
Refrigeration cycles in heat pumps with its two phase flow are challenging for numerical solvers. People usually use fixed step Euler solver for HiL testing to ensure deterministic CPU times.
In the beginning, we tried to get system models build with our Modelica library TIL Suite running with Euler. We got quiet far, but we never achieved 100% robustness. And that’s a problem if you think about automatic test runs over night. And usually you want test under extreme conditions like minimum and maximum load or very transient boundary conditions. These extreme conditions tend to be the problematic once for fixed step solvers.
Choosing very small step sizes is the only possible solution for fixed step solvers. But it leads directly to larger CPU times and it can be hard to meet real time requirements. We ended up modifying models to increase time constants and allow larger step sizes. But that's hard handwork that can only be done by highly skilled experts.
At some point we switched from fixed step Euler to variable step sizes solver CVODE, available in many Modelica tools like Dymola or OpenModelica. This solver does not guarantee upper bounds on CPU times but it can handle nonlinear and stiff models very efficiently. That was a key enabler to our HiL projects.
Thanks to the model interface format FMI, we can export our simulation models even to dedicated testing hardware and software, like SCALEXIO from dSPACE.
Compared to electrical and mechanical systems, thermal systems are very slow. Controllers usually run at 10 or even 1 Hz.
That means,you don’t have to worry about milliseconds delays in real time simulations. Effectively they don’t influence your controller.
You could even do HiL testing on normal Windows PCs to save investment costs for dedicated HiL hard- and software.
That's one reason why variable step size solvers works quite well for thermal systems. If sampling rate is 10 Hz there is usually enough time for all internal iterations to converge. And even if it happens once in a while that one step is to slow and simulation time can't catch up with real time, does it really hurt your overall test results?
Some people use black-box models for HiL tests of thermal systems identified from measurement data.
This approach might work for some working points. But to accurately model the process over its complete operational range it’s much better to use simulation model based on first principles.
Physics based models do extrapolate!