An optimal indoor climate contributes significantly to our personal wellbeing: Heating, ventilation, and air conditioning provide the necessary comfort. This is where the global company Copeland comes in: With sustainable solutions for optimizing heating and cooling, it makes an important contribution to improved indoor air quality and energy efficiency. A virtual test environment based on dSPACE tools supports the company in ECU validation.
When it comes to the development of control units, early virtual validation is a trend that can benefit more than just the automotive industry. The great advantage of using software-in-the-loop (SIL) simulation for validation is that software development and test execution can take place directly on your own PC. As a result, software validation can begin long before the hardware and the hardware-in-the-loop (HIL) simulator are available.
SIL Goes HVAC
No matter whether it is in living space, work area, or industry: Climate-friendly solutions for heating, ventilating, and cooling rooms are in greater demand than ever before. With its innovative and sustainable heating, ventilation, and air conditioning (HVAC) solutions, Copeland is an important partner for manufacturers, installers, and building owners. The company relies on SIL when testing and validating the functionalities of its electronic control units (ECUs). The development and test environment for this is based on dSPACE tools and an environment model from Copeland. In this context, Copeland also used a special dSPACE toolset, the V-ECU SDK (SDK: Software development kit), to obtain a suitable virtual ECU (V-ECU) from the existing C code as quickly as possible.
Basic Test Setup
Copeland uses a virtual test environment based on VEOS, the dSPACE platform for PC-based simulation, to validate its climate control units. The basic test setup comprises the typical components of a closed-loop test:
- The virtual ECU (V-ECU): The V-ECU contains the code to be tested with corresponding inputs and outputs for sensors and actuators.
- The environment model: It simulates the values of the connected sensors while taking the actuators into account. The thermal model is provided by Copeland via the standardized Functional Mock-up Unit (FMU) format.
- ControlDesk: The dSPACE experimentation and instrumentation software visualizes selected variable values and allows Copeland to experiment and test interactively with both the controller and the environment model.
- AutomationDesk: With dSPACE's powerful test authoring and test automation tool, Copeland builds a library of test cases that are executed automatically at a later stage.
The V-ECU as a Virtual Twin
When setting up a virtual test environment for ECU validation, the creation of the system under test (SUT) is an important step. Here, it is important to integrate the ECU code to be tested into the simulation without any changes. To do this, the code must be called by the simulation environment and sensor values and control variables must be exchanged with the model. The result is a virtual twin of the control unit in the form of a V-ECU that contains the original code.
From C Code to V-ECU
The control algorithms at Copeland are developed in C and are integrated into a step function. This function fulfills three typical tasks:
- Reading the input data from the simulation into the code-internal variables: With V-ECUs, this is done via freely configurable virtual ports.
- Executing the control algorithm: The algorithm uses the input values that were just set and calculates the values for the output variables. It is this production code that represents the test object and is later used in unchanged form for the target hardware.
- The calculated values are written to the output ports of the V-ECU.
The step function is the glue code, i.e., the link between the simulation environment and the production code. In Copeland's specific application, it is executed repeatedly every 100 ms. In this project, only one step function is sufficient for the V-ECU, but it is also possible to simulate more complex time behavior with several step functions.
To sum it up, these are the main tasks when virtualizing the V-ECU:
- Definition of virtual ports for communication
- Definition of the step function including the call cycle
- Configuration and creation of the V-ECU container file
Copeland was able to accomplish all of these tasks independently with the help of the V-ECU SDK from dSPACE.
V-ECU Made Easy – with the V-ECU SDK
The V-ECU SDK is a toolset from dSPACE for the virtualization and generation of V-ECUs from C code. The set has been in successful use at Copeland since 2022. With the help of the SDK, Copeland was able to quickly and easily generate the appropriate V-ECU for ECU validation from the existing C code. Han Hu, Senior Software Engineer at Copeland, is very happy about the simplifications that have benefited his team and the entire validation process: "With the help of the V-ECU SDK from dSPACE, we can test our software with more flexibility without requiring hardware – at any time and any location."
Distributed Working and Easy SIL Introduction
The text-based configuration of the V-ECU SDK itself and the script-based VEOS automation allow the test setup to be easily integrated into a version control system, for example the open-source software Git.
At Copeland, the outlined structure was initially set up by just one expert, brought to the desired maturity, and then distributed via Git. This reduced the entry threshold for using SIL with VEOS as a development and test environment in the entire development team to a minimum and paved the way for the distributed working established at Copeland today.
Summary and Outlook
In the context of this project, Copeland was able to set up and successfully introduce a SIL development and test environment based on VEOS. Thanks to the dSPACE V-ECU SDK, the company was able to achieve this goal without any special SIL experience or additional engineering. In just a few steps, Copeland has gained real added value for its validation, thanks to SIL. The example also shows how versatile SIL is beyond the automotive industry and how easy it is to get started with SIL validation using VEOS and the V-ECU SDK.
Based on the SIL simulation, Copeland is developing automated tests with AutomationDesk. These tests will be used as regression tests for SIL development and will also serve as preparation for the upcoming HIL validation.
Courtesy of Copeland Europe GmbH
dSPACE MAGAZINE, PUBLISHED APRIL 2024