You are currently viewing a new version of our website. To view the old version click .
Energies
  • Article
  • Open Access

8 January 2025

Interfacing TRNSYS with MATLAB for Building Energy System Optimization

and
Chair of Automation and Energy Systems, Saarland University, 66123 Saarbruecken, Germany
*
Author to whom correspondence should be addressed.
This article belongs to the Section G: Energy and Buildings

Abstract

This contribution investigates whether the use of the MATLAB Optimization Toolbox on a parameter identification problem for a TRNSYS model provides better performance in iteration time. It presents the development of a framework connecting the MATLAB Optimization Toolbox with TRNSYS on the one hand and coordinating the optimization process of a TRNSYS model by GenOpt through MATLAB on the other hand. A benchmark framework in MATLAB was created to link TRNSYS and MATLAB and to configure the optimization process of GenOpt and the MATLAB Optimization Toolbox. Using this framework, a comprehensive comparison of the optimization solvers in GenOpt and the MATLAB Optimization Toolbox for the identification of the overall heat transfer coefficient of a TRNSYS heat exchanger model regarding the optimization time and number of iterations is presented as a use case. The results for the given problem show that GenOpt gives slightly better results in optimization time, whereas MATLAB has more potential and flexibility.

1. Introduction

Control of Building Energy Systems (BES), which are part of the Building Automation and Control System (BACS), and their model-based design is a complex task comprising different domains and has increasingly become established in the energy industry and research. Nevertheless, these systems can further be improved by optimal design and control to be more cost-effective and reliable.
To this end, a large number of Building Performance Simulaton Tools (BPSTs) have been developed in recent decades [1]. A comprehensive list of BPSTs is provided in [2]. One reason for the increasing use of BPSTs is not in the least the increased legal requirements for BES. The revised Energy Performance of Buildings Directive (EPBD) (EU/2024/1275) entered into force in all EU countries on May 2024. An entire set of rules is applied here, for which EN 15232-1 [3] is used in sub-module M10 (Building Automation and Controls), in which the building is assigned to one of four BACS efficiency classes [4]. The amended version introduces new requirements for nonresidential and residential buildings, which should help to accelerate the gradual renovation of the entire building stock. In Germany, the new Building Energy Act (GEG 2023) regulates how the country will heat predominantly with Renewable Energies (RE) in the future. The GEG 2023 aims to increase the share of Renewable Energies in buildings sustainably and efficiently. According to the new requirements, new buildings’ BES will only be installed if they generate at least 65% of the heat provided using RE.
BPSTs are used in research and increasingly also in industry. They have different levels of model detail and cover the entire life cycle of BES, from the design, construction and operation of buildings to the acceleration and improvement of the design and planning process, improvement of building efficiency, development or optimization of building controls and evaluation of the market potential of new concepts.
At present, there exist domain-independent software tools with advanced control modeling features but less building simulation model capability and vice versa. Hence, an advanced approach is to combine the different software tools and their modular concepts by runtime coupling to incorporate their domain-specific advantages as model libraries, optimization algorithms or aided controller design [5].
There is currently no common standard established by all software manufacturers for the coupling of domain-specific software tools, although there are promising approaches such as Functional Mock-up Interface (FMI), which has now been developed to version 3.0 [6,7,8]. For this reason, considerable effort is still required in some cases to be able to use the various advantages of BPSTs for an application.
From the perspective of developers and researchers, the lack of standardized model exchange formats in the development of simulation studies poses the challenge of developing them according to the problems themselves. When faced with a selection of options, the question often arises as to which approach is easy to implement and also offers the best performance. The results of this study are intended to provide assistance in this regard.
In this article, we focus on three BPSTs, TRNSYS (17.02.0005 (32-bit)), MATLAB (2017b (64-bit)) and GenOpt (3.1.1), where TRNSYS is the central software for the creation of system models from the point of view of this contribution.
TRNSYS (TRaNsient SYstem Simulation Program) [9] is one of the BPSTs that is well-known for its numerous validation studies and its ability to model buildings incorporated with other systems, such as Heating, Ventilation and Air Conditioning (HVAC) and renewable energy sources. Based on numerical routines, it solves partial differential equation systems for dynamic system simulation. It enables the balancing of transient processes in a time-step resolution between hours and minutes. It has a modular structure comprising modules like multizone buildings and electrical and thermal energy systems. A disadvantage of TRNSYS is that the user-friendly integration of complex control and optimal system sizing methods is missing.
MATLAB (MATrix LABoratory) is a simulation environment for programming and numerical calculations [10], with a high variety of toolboxes, e.g., Optimization Toolbox and Parallel Computing Toolbox.
Generic Optimization Program (GenOpt) [11] is a software tool that allows multidimensional optimization of an objective function computed by any simulation tool that reads its input from a text file and writes its output to a text file.
This article describes a framework that can be used to combine TRNSYS and MATLAB in order to utilize the strengths of both programs. The framework is then applied to a simple optimization problem to investigate whether MATLAB has advantages in terms of performance for solving the optimization problem in comparison to a solution, where TRNSYS is coupled with GenOpt.
This paper is organized as follows: Section 2 discusses the most common methods of software coupling to TRNSYS and previous work in a literature review to identify the research gap that this paper aims to close. Section 3 describes the benchmark model implementation in TRNSYS for the one-dimensional optimization problem and the framework of coordinated optimization by GenOpt through MATLAB, as well as using the MATLAB optimizer solely with TRNSYS. In Section 4, the chosen solver parameters are listed, and the performance results are shown and discussed. A summary of the main findings and an outlook on further work concludes the contribution in Section 5.

3. Methodology

In this section, a short introduction to the used software tools is given. This is followed by the description of the TRNSYS benchmark model for tool coupling and the two frameworks, MATLAB-coordinated optimization of a TRNSYS model with GenOpt on the one hand and optimization with the MATLAB Optimization Toolbox on the other hand.

3.1. Introduction to the Used Software Tools

MATLAB is a high-level general-purpose modeling language. With its variety of extensions, called toolboxes, it is widely used in industry and research in the fields of control design, signal and image processing, optimization, communication and simulation [10]. The MATLAB Optimization Toolbox provides a set of algorithms that solve optimization problems. The toolbox includes functions for solving linear, quadratic, mixed-integer linear, nonlinear programming and least squares problems. TRNSYS is one of the most used simulation software programs for building and HVAC (Heating, Ventilation and Air Conditioning) system simulations. It has been commercially available since 1976 and uses a component-based modeling approach. By its modular structure, the software obtains flexibility. TRNSYS component models, also known as “Types”, can model complex multizone buildings, HVAC systems and renewable energy systems. For building dynamics, it is accepted as one of the most compressive and detailed simulation software programs [9]. GenOpt is an open-source optimization software program that evaluates a cost function by an external simulation program. Supported software tools are, for example, TRNSYS, Dymola and EnergyPlus. Its integrated libraries can solve one- and multidimensional problems with local and global solutions. If supported by the hardware, GenOpt automatically uses parallel computation. There are two modes in which GenOpt can be called, either in normal mode with a graphical user interface (GUI) or without GUI as a background process. For the following investigations, TRNSYS version 17.02.0005 (32-bit) with GenOpt 3.1.1 and MATLAB 2017b (64-bit) were used.

3.2. TRNSYS Benchmark Model

The TRNSYS benchmark model consists of a counterflow heat exchanger (Type 5b) that obtains measured time series data as input by a data reader (Type 9c), some error calculations and an error time integrator (Type 24). In Figure 1, the complete TRNSYS model is shown. The heat exchanger model measured fluid temperature and mass flow rate on the source and load side as input.
Figure 1. TRNSYS benchmark model of a heat exchanger.
The heat exchange rate U A e x t in kJ/(hK) is the optimization variable. The error Q ˙ e r r o r , e x c h a n g e between the measured heat exchange rate, Q ˙ m e a s , e x c h a n g e , and the simulated one, Q ˙ s i m , e x c h a n g e , is calculated according to Equation (1).
Q ˙ e r r o r , e x c h a n g e = Q ˙ m e a s , e x c h a n g e Q ˙ s i m , e x c h a n g e
Using the time integrator block, the complete sum of heat exchange error Q e r r o r , s u m in kJ is calculated and used as the cost function for the optimization, using
Q e r r o r , s u m = t = 0 t = t e n d Q ˙ e r r o r , e x c h a n g e d t

3.3. Optimization Frameworks

In the following, the two frameworks, a MATLAB-coordinated optimization of a TRNSYS model with GenOpt and an optimization with the MATLAB Optimization Toolbox, are described. As shown in Figure 2, there are four considered optimizer modes: in the GenOpt framework the standard way with a Grapical User Interface (GUI) or with suppressed GUI, and in the MATLAB optimization framework, solvers running in serial mode or in parallel simulation mode were taken into consideration.
Figure 2. Considered optimizer modes.
A 
Coordinated coupling of TRNSYS and GenOpt by MATLAB
Within the first framework, optimization is performed through GenOpt. In general, the complete process can be divided in three sections:
1
Coordination.
2
Optimization.
3
Simulation.
By default, GenOpt has no functionality to start several solvers one after another automatically. To circumvent this disadvantage, MATLAB takes this over. In the coordination part, MATLAB calls GenOpt in different solver configurations in a loop. In the first section, MATLAB coordinates the user-defined configuration of the GenOpt files, such as file locations, algorithm choice and algorithm parameters, simulation configuration and its input. In general, when the user finishes the configuration in the GUI, GenOpt prepares the TRNSYS model deck file, which has to be created once in TRNSYS before starting the optimization process, to be a template as follows:
  • It replaces the optimization variable through the variable name % O P T V A L 1 % in the case of a one-dimensional optimization problem.
  • It adds an output printer, named Type 758, to write the chosen optimization variable value and the resulting cost variable value to the output files OutputListingMain.txt and OutputListingAll.txt. Note that in TRNSYS 18, the structure of the deck file changes at the end of the file, which makes further modifications necessary.
These two steps are also performed in the coordination part of the developed framework in MATLAB to bypass the configuration in the GenOpt GUI. The second section, optimization, is then handled mainly by GenOpt. For each optimization step, GenOpt writes a modified deck file and TRNSYS reads this modified template dck file and simulates the model (Section 3: simulation).Finally, MATLAB processes the output files of GenOpt for analysis and visualization of the results. Figure 3 shows the schema of the GenOpt interface [11] with the above described extensions.
Figure 3. Tool coupling of MATLAB and GenOpt–TRNSYS [39] (based on [11]).
In the following, the process flow of the coordination, optimization and simulation parts is called generic optimization and will be explained in steps that are more detailed. The generic optimization process has a main function and the evalGenOpt function. Both are subdivided into 3 phases (Figure 4):
Figure 4. Flow chart of coordinated optimization through GenOpt by MATLAB.
1
Preprocessing phase.
2
Optimization phase.
3
Postprocessing phase.
In the preprocessing phase of the main function, configuration steps are performed as listed below:
  • A table of all solver names is created.
  • Paths are defined for the model deck file, GenOpt working directory in the TRNSYS path and new folder of the result files.
  • Common solver parameters and boundary settings are defined, such as solver step size, min and max boundary values, initial start value, maximum iteration number and maximum number of equal results before optimization process stops.
  • Additional parameter settings are defined, like the name of the optimization and cost variables, the number of repetitions of a complete optimization cycle to calculate a mean optimization time, mode of the TRNSYS simulation process bar during the optimization process and the number of time steps in idle state of the GenOpt GUI. The GenOpt GUI has no capability to close automatically when an optimization process has finished. Therefore, the process will be observed and terminated when it comes back to idle mode with no processor load for a user-defined time period as described later.
In the optimization phase of the main function, the GenOpt optimization with the user-defined parameters can be called as a MATLAB function:
            [output] = evalGenOpt(input)
where input are the configurations performed in the preprocessing part and the solver algorithm name of GenOpt. The output is a MATLAB data structure containing the optimization time, solution value, number of solver evaluations and objective value. In the postprocessing part, the result files are accumulated and processed for visualization. Within the evalGenOpt, function preprocessing is composed of extracting the date from the function input structure and writing the configuration files TRNSYS17.ini, TRNSYS.cfg, command.txt and template.dck. Then, sequentially, the optimization phase will be started once with GenOpt in normal mode with GUI using MATLAB’s system() command with the following input string:
	    cmd /C java -jar genopt.jar TRNSYS.ini &
cmd starts a new instance of the Microsoft Windows command interpreter. /C carries out the command specified by the string and then terminates. The trailing & dispatches the command window to the background, while MATLAB can continue. This is required due to the drawback that the GenOpt GUI will not close itself or be closed by command attribute after the optimization has finished. Therefore, observation and manual termination of the task is implemented with the following .NET methods:
            System.Diagnostics.Process.GetProcessesByName(process_name)},
            System.Diagnostics.PerformanceCounter(process_name)}.
where java.exe is the GenOpt process name.
Both GenOpt and the command window will be terminated when the CPU utilization is zero for a certain time (here 10 s) using the following in the MATLAB system() function:
	    “C:\Windows\System32\taskkill.exe” /F /im java.exe /im cmd.exe
where /F forces the termination of the task specified with the parameter /im for the image or executable names. In hidden mode, without GUI, GenOpt can be started with the following command:
	    java -classpath genopt.jar genopt.GenOpt TRNSYS.ini
After each of these two optimization phases, a timer is started to measure the optimization time for the benchmark, the GenOpt result txt file is read and data are collected.
B 
Coupling of TRNSYS and MATLAB Optimization Toolbox
In the second framework, the complete process can also be divided into the three sections coordination, optimization and simulation. In contrast to the first approach, the coordination and optimization are handled by MATLAB and its Optimization Toolbox, which triggers the simulation in TRNSYS. This approach is similar to that of GenOpt. MATLAB creates a copy of the dck files and modifies the optimization variable to fulfill the objective function. This takes into account the user configuration information of file paths and solver algorithm parameters. A TRNSYS output printer (Type 25) is added to the dck file, printing the objective value after each optimization iteration. MATLAB reads the objective value from this TRNSYS output file.
When the solver finishes, the results of the optimization iteration process are written to a log file and an output file (Figure 5).
Figure 5. Tool coupling of MATLAB and TRNSYS [39].
The complete framework contains three function layers: main(), evalMatOpt() and runTRNmodel(). Each of the function layers can also be subdivided into a preprocessing, an optimization and a postprocessing phase (Figure 6).
Figure 6. Flow chart of optimization by MATLAB.
In the preprocessing phase of the main function, starting an optional timer to measure the overall processing time (not used for this benchmark) and declaring the optimization boundaries and the solver take place. In addition, a mat file with function arguments is created, which is loaded by the runTRNmodel function in every optimization iteration step.
In the same way as it was developed with GenOpt, and as described in the section above, in the optimization phase, the second function layer call
			[output] = evalMatOpt(input)
allows the user to run the complete optimization process, which also includes calling the TRNSYS model. The preprocessing phase of evalMatOpt() is composed of reading the function input data structure, starting the MATLAB Parallel Computing Pool, included in the MATLAB Parallel Computing Toolbox, and writing the solver’s individual optimization options file using optimoptions().
In the third function layer, the TRNSYS model with the modified deck files is simulated using the following function call:
			[output] = runTRNmodel(input)
In the preprocessing part of this function layer, the modified TRNSYS deck file is built by replacing the value of the optimization variable and adding an output printer (Type 25) to write the value of the optimization and cost variable to a txt file which will be read in again in the postprocessing part to create the function output.
When the simulation has finished and the output in runTRNmodel() has been prepared, the temporary folder containing the TRNSYS dck file and the log file and output file of the printer with the final value of the cost function will be deleted. When running GenOpt optimization, TRNSYS sometimes throws an error due to collisions in multiple file access during parallel computing. The MATLAB function parfeval() executes the simulations asynchronously on a parallel computing pool, but the described error also arises and cannot be avoided by the function.
The simulated value of the cost function will be returned to evalMatOpt() as an input for the solver’s calculation in the next iteration step.

4. Evaluation Indicators, Solver Settings and Benchmark Results

For the evaluation, the Absolute Error ( A E ) for the measurement period is used, which is defined as follows according to Equation (2):
A E = t = 0 t = t e n d Q ˙ e r r o r , e x c h a n g e d t
The derived quantity Mean Absolute Error ( M A E ) can be calculated according to the equation
M A E = 1 n t = 0 t = t e n d Q ˙ e r r o r , e x c h a n g e d t
where n represents the number of measurement points, which in our experiment consists of 721 equidistant time points, which thus represents a simple scaling of A E and is therefore not explicitly shown here.
System specifications of the computer used to run the simulations are listed in Table 2.
Table 2. System specifications.
For both the GenOpt and MATLAB optimizations, the initial start point of the optimization variable U A e x t in kJ/(hK) is chosen as the middle between the lower and upper boundaries, which are 0 and 5000, respectively. The limit of the optimization iteration cycles is set to 500. The initial start point 2500 is chosen as the middle of these boundary values (Table 3).
Table 3. Common solver boundaries.
Table 4 shows the detailed parameter settings of the considered seven GenOpt solvers that were used:
Table 4. Individual solver boundaries in GenOpt.
  • Generalized Pattern Search implementation of the Coordinate Search algorithm (GPS Coordinate Search).
  • Hooke–Jeeves Generalized Pattern Search implementation (GPS Hooke-Jeeves).
  • Hooke–Jeeves Generalized Pattern Search implementation combined with leaded Particle Swarm Optimization algorithm with Constriction Coefficient as particle update Equation (GPS-PSOCCHJ).
  • Golden Section.
  • Particle Swarm Optimization algorithm with Constriction Coefficient (PSO-CC).
  • Particle Swarm Optimization algorithm with Constriction Coefficient restricted to Mesh (PSO-CCMesh).
  • Particle Swarm Optimization algorithm with Inertia Weighting (PSO-IW).
If a solver, e.g., Generalized Pattern Search (GPS) Coordinate Search (GPSCoordinateSearch), uses a fixed step size, this is set to 10.
All of the GenOpt solver parameters were chosen as the default values. Except for the common solver boundaries (parameters), solvers ran with default values.
The Golden Section Solver has no solver parameters that can be configured by the user. The Nelder–Mead–O’Neill algorithm cannot be used for one-dimensional optimization problems. Discrete Armijo–Gradient and Fibonacci do not converge. Hence, out of the 10 solvers implemented in GenOpt, for the considered optimization problem in this benchmark, 7 solvers were used for the comparison.
Each solver has a loop of three complete optimization cycles. Out of these three result sets, mean, minimum and maximum values were identified. In Figure 7, mean values and the minimum and maximum values as deviations are presented. Note, that the abscissa is in logarithmic scale.
Figure 7. GenOpt optimization results.
As these results show (Figure 7), the Particle Swarm Optimization algorithm with Constriction Coefficient and continuous independent variables restricted to a Mesh (PSO-CCMesh) performs best for the given constraints and problem formulation. Mean optimization time for PSO-CCMesh is about 26 s. It takes nearly half the time compared to the second fastest solver, Hooke–Jeeves Generalized Pattern Search implementation combined with leaded Particle Swarm Optimization algorithm with Constriction Coefficient (GPS-PSOCCHJ), with 44 s. PSO-CCMesh also has fewer iteration loops (81) than GPS-PSOCCHJ (233). PSO-CC, GPSHookeJeeve and Golden Section are about the same, with values between 72 and 87 s, and PSO-IW and GPSCoordinateSearch are far behind in last place with values of approx. 162 and 209 s. PSO-CC and GPS-PSOCCHJ also show higher fluctuations in the evaluation time, while the other solvers show relatively constant times.
By running GenOpt without a GUI, optimization time could be shortened to between 2 s (GPSCoordinateSearch) and 11 s GPSHookeJeeve in absolute values or between 1 % (GPSCoordinateSearch) and 25 % (PSO-CCMesh).
In MATLAB, nine solvers were taken into account (Table 5):
Table 5. Individual solver boundaries in MATLAB.
  • Find minimum of unconstrained multivariable function using derivative-free method (fminsearch).
  • Find minimum of single-variable function on fixed interval (fminbnd).
  • Particle Swarm Optimization (particleswarm).
  • Simulated annealing algorithm (simulannealbnd).
  • Pattern search algorithm (patternsearch).
  • Genetic Algorithm (ga).
  • Find minimum of constrained nonlinear multivariable function (fmincon).
  • Find global minimum (GlobalSearch).
  • Find multiple local minima (MultiStart).
Note that the solvers fminbnd and fminsearch do not require the Optimization Toolbox license. Their configuration can be performed by using the optimset function instead of optimoptions. Global search, multistart, Genetic Algorithm, particleswarm, simulated annealing and patternsearch are global optimizers. By giving a MATLAB function handle to a local solver such as fminsearch, they could optionally become a hybrid solver.
Mean objective values of solvers fmincon, ga, GlobalSearch and MultiStart are higher than the chosen upper limit of 0.05 kJ. They are in the range of 0.061 kJ (MultiStart) to 3300 kJ (ga).
Solver fminbnd, which is a one-dimensional optimizer for a bounded problem, performs best for the described problem. As the results, given in Figure 8, show, it takes 21 iteration loops and 48 s in serial mode and 27 s in parallel mode, respectively, which is nearly 80 % faster than in serial mode. Due to processing overhead in establishing the pool communication environment, the benefit in time savings is less than the linear behavior between the number of used processor cores and the optimization time. With average values between 54 and 74 s in parallel mode (107 to 130 s in serial mode), the solvers fmincon, fminsearch and patternsearch are in the midrange; GlobalSearch is behind with 289 s in parallel mode (382 s in serial mode); MultiStart, simulanneal and particleswarm follow with times between 500 and 718 s or 1156 and 1335 s in serial mode; and ga is in last place with times of over 2700 and 6300 s, respectively. Since global search, multistart, Genetic Algorithm and particleswarm are stochastic—that is, they make random initial guesses and choices—the number of evaluations changes in every optimization loop.
Figure 8. MatOpt optimization results.
As noted before, the MATLAB solvers fmincon, ga, multistart and global search have a poor objective value. In direct comparison to the results of GenOpt’s mode without GUI and MATLAB in parallel mode, the remaining solvers have nearly the same objective value; GenOpt’s Particle Swarm Optimizer with Constriction Coefficient and continuous independent variables restricted to Mesh (PSOCCMesh) performs best among all considered solvers regarding time of evaluation. In the meantime, it takes 20 s compared to the second one, MATLAB’s fminbnd solver, which needs 27 s in mean and parallel modes (Figure 8).

5. Conclusions and Outlook

This benchmark study aims at comparing the numerical performance of GenOpt and MATLAB solvers for the identification of the overall heat transfer coefficient of a TRNSYS heat exchanger model. Four modes were implemented and investigated: GenOpt with a GUI and without a GUI, and MATLAB in serial optimization and in parallel optimization using the Parallel Computing Toolbox. Considering GenOpt, an interesting finding is that running without a GUI gives better performance, while MATLAB is faster in parallel mode, as was expected. The MATLAB solvers fmincon, ga, multistart and global search have a poorer objective value, while remaining solvers have nearly the same objective value. Hiding the GenOpt GUI increased the performance of solving the considered optimization problem up to 23 % (PSO-CCMesh) compared to the time with a GUI. Running in this mode, the GenOpt solver PSO-CCMesh gave the best performance in optimization time with 20 s, followed by the MATLAB solver fminbnd (27 s) in parallel computing mode. The top two solvers from GenOpt and MATLAB were followed by GPS-PSOCCHJ with approx. 38 s and MATLAB’s fmincon (54 s) and fminsearch (69 s). These were followed by GenOpt’s PSO-CC (72 s) and GPSHookeJeeve (73 s). With an average value of 74 s, patternsearch was close behind. This was followed by the remaining three GenOpt solvers, and the remaining five MATLAB solvers bring up the rear. Furthermore, it can be seen that most GenOpt solvers reach a solution faster than most MATLAB solvers; in a direct comparison between GenOpt with a GUI and the serial mode in MATLAB, the difference was consistently between 0.86 (fastest solvers PSO-CCMesh/fminbnd) and 29.2 (slowest solvers GPSCoordinateSearch/ga).
In the end, and in order to answer the research question posed at the beginning, it can be said that for the continuous single-objective optimization problem considered here, it is better to take the simpler route of using GenOpt.
The results suggest that the advantage in terms of time savings is particularly noticeable for complex single-objective optimization problems, such as the design of BES, which require many iteration loops. There are also advantages in simulation time for single-objective optimization problems in the area of optimal control using model predictive control and moving horizon in BES. This aspect should be taken into account for hardware-in-the-loop applications where the control task must fulfill corresponding real-time conditions. As already mentioned at the beginning, GenOpt can only handle single-objective optimization problems, which is why the TRNSYS–MATLAB framework used shows advantages, preferably in a Pareto optimization. Furthermore, well-known commercial solvers such as Gurobi, MOSEK and CPLEX have not yet been taken into consideration. Both GenOpt and MATLAB allow the user to integrate custom solvers; while this is only possible directly in the Java programming language in GenOpt, MATLAB is more flexible due to the availability of C++, Fortran and Python interfaces. Furthermore, as an integrated development environment, MATLAB offers a wider range of application options for extending the framework. Possible use cases here would be the connection of databases, network communication and cloud services or hardware connections and digital twins. On the other hand, the comparison with a Python-based framework such as pytrnsys and corresponding solver packages (e.g., pymoo) is of particular interest. These aspects have already been partially addressed and will be considered in future work.

Author Contributions

Conceptualization, J.M. and G.F.; methodology, J.M.; software, J.M.; validation, J.M. and G.F.; formal analysis, G.F.; investigation, J.M.; resources, G.F.; data curation, J.M.; writing—original draft preparation, J.M. and G.F.; writing—review and editing, J.M. and G.F.; visualization, J.M.; supervision, G.F. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

List of Acronyms

ANNArtificial Neural Network
BACSBuilding Automation and Control System
BCVTBBuilding Controls Virtual Test Bed
BESBuilding Energy Systems
BPSTBuilding Performance Simulaton Tool
CFFIC Foreign Function Interface
COMComponent Object Model
DLLDynamic Link Library
EPBDEnergy Performance of Buildings Directive
FIOFile Input/Output
FMIFunctional Mock-up Interface
FMUFunctional Mock-up Unit
GAGenetic Algorithms
GEG 2023Building Energy Act
GenOptGeneric Optimization Program
GPSGeneralized Pattern Search
GPSCSGeneralized Pattern Search Coordinated Search
GPS-PSOCCHJGeneralized Pattern Search–Particle Swarm Optimization algorithm with Constriction Coefficient as particle update equation
GUIGrapical User Interface
HVACHeating, Ventilation and Air Conditioning
IDAICEIDA Indoor Climate and Energy
IEASHCInternational Energy Agency Solar Heating and Cooling
LabVIEWLaboratory Virtual Instrumentation Engineering Workbench
MATLABMATrix LABoratory
MOPSOMOPS]Multiobjective Particle Swarm Optimization
MPCModel Predictive Controller
NSGA-IINondominated Sorting Genetic Algorithm 2
OPC UAOpen Platform Communications Unified Architecture
PCMPhase Change Material
PSOParticle Swarm Optimization
PSO-CCParticle Swarm Optimization algorithm with Constriction Coefficient
PSO-CCMeshParticle Swarm Optimization algorithm with Constriction Coefficient restricted to Mesh
PSO-IWParticle Swarm Optimization algorithm with Inertia Weighting
RERenewable Energies
TCP/IPTransmission Control Protocol/Internet Protocol
TRNSYSTRaNsient SYstem Simulation Program

References

  1. Wang, H.; Zhai, Z.J. Advances in building simulation and computational techniques: A review between 1987 and 2014. Energy Build. 2016, 128, 319–335. [Google Scholar] [CrossRef]
  2. Crawley, D.B.; Hand, J.W.; Kummert, M.; Griffith, B.T. Contrasting the capabilities of building energy performance simulation programs. Build. Environ. 2008, 43, 661–673. [Google Scholar] [CrossRef]
  3. EN 15232-1:2017; Energy Performance of Buildings—Energy Performance of Buildings—Part 1: Impact of Building Automation, Controls and Building Management—Modules M10-4,5,6,7,8,9,10. European Committee for Standardization: Brussels, Belgium, 2017.
  4. Federation of European Heating, Ventilation and Air Conditioning Associations (REHVA). EPB (Energy Performance of Buildings) Standards. 2024. Available online: https://www.rehva.eu/activities/epb-center-on-standardization/epb-standards-energy-performance-of-buildings-standards (accessed on 6 November 2024).
  5. Allegrini, J.; Orehounig, K.; Mavromatidis, G.; Ruesch, F.; Dorer, V.; Evins, R. A review of modelling approaches and tools for the simulation of district-scale energy systems. Renew. Sustain. Energy Rev. 2015, 52, 1391–1404. [Google Scholar] [CrossRef]
  6. Modelica Association. FMI-Functional Mock-Up Inferface—The Leading Standard to Exchange Dynamic Simulation Models. 2024. Available online: https://fmi-standard.org/ (accessed on 6 December 2024).
  7. Shao, X.; Ringsberg, J.W.; Johnson, E.; Li, Z.; Yao, H.D.; Skjoldhammer, J.G.; Björklund, S. An FMI-based co-simulation framework for simulations of wave energy converter systems. Energy Convers. Manag. 2025, 323, 119220. [Google Scholar] [CrossRef]
  8. Wolf, C.; Schleipen, M.; Frey, G. Secure Exchange of Black-Box Simulation Models using FMI in the Industrial Context. In Proceedings of the 15th International Modelica Conference 2023, Aachen, Germany, 9–11 October 2023; pp. 487–496. [Google Scholar] [CrossRef]
  9. Solar Energy Laboratory, University of Wisconsin. TRNSYS—A Transient System Simulation Program, Version: 17.02; Solar Energy Laboratory, University of Wisconsin: Madison, WI, USA, 2014.
  10. The MathWorks Inc. MATLAB, Version: 9.3 (R2017b); The MathWorks Inc.: Natick, MA, USA, 2017. Available online: https://www.mathworks.com (accessed on 9 December 2024).
  11. Wetter, M. GenOpt—A Generic Optimization Program. In Proceedings of the 7th International Buildings Simulation Conference, Rio de Janeiro, Brazil, 13–15 August 2001. [Google Scholar]
  12. Gomes, C.; Thule, C.; Broman, D.; Larsen, P.G.; Vangheluwe, H. Co-simulation: State of the art. arXiv 2017, arXiv:1702.00686. [Google Scholar] [CrossRef]
  13. Sagerschnig, C.; Gyalistras, D.; Seerig, A.; Prívara, S.; Cigler, J.; Vana, Z. Co-simulation for building controller development: The case study of a modern office building. In Proceedings of the International Conference–Cleantech for Sustainable Buildings. CISBAT, Lausanne, Switzerland, 14–16 September 2011; pp. 955–960. [Google Scholar]
  14. Engel, G.; Schweiger, G. A comparison of co-simulation interfaces between Trnsys and Simulink: A thermal engineering case study. In Proceedings of the 9th International Conference on Mathematical Modelling. MATHMOD, Vienna, Austria, 21–23 February 2018; pp. 47–48. [Google Scholar] [CrossRef]
  15. Trcka, M. Co-Simulation for Performance Prediction of Innovative Integrated Mechanical Energy Systems in Buildings. Ph.D. Thesis, University of Technology, Eindhoven, The Netherlands, 2008. [Google Scholar] [CrossRef]
  16. Widl, E. The FMI++ TRNSYS FMU Export Utility. 2022. Available online: https://github.com/fmipp/trnsys-fmu (accessed on 15 November 2024).
  17. Widl, E.; Müller, W. Generic FMI-compliant Simulation Tool Coupling. In Proceedings of the 12th International Modelica Conference, Prague, Czech Republic, 15–17 May 2017; pp. 321–327. [Google Scholar] [CrossRef]
  18. Wetter, M. A Modular Building Controls Virtual Test Bed for the Integrations of Heterogeneous Systems. Ph.D. Thesis, Lawrence Berkeley National Laboratory, Berkeley, CA, USA, Oak Ridge, TN, USA, 2008. [Google Scholar]
  19. Pan, Y.; Lin, X.; Huang, Z.; Sun, J.; Ahmed, O. A verification test bed for buildingcontrol strategy coupling TRNSYS with a real controller. In Proceedings of the 12th Conference of International Building Performance Simulation Association. IBPSA, Sydney, Australia, 14–16 November 2011; pp. 215–222. [Google Scholar]
  20. Junge, M. Simulationsgestützte Entwicklung und Optimierung Einer Energieeffizienten Produktionssteuerung. Ph.D. Thesis, Kassel University, Kassel, Germany, 2007. [Google Scholar]
  21. Riederer, P.; Keilholz, W.; Ducreux, V. Coupling of TRNSYS with Simulink—A method to automatically export and use TRNSYS models within Simulink and vice versa. In Proceedings of the 11th International Buildings Simulation Conference, Glasgow, UK, 27–30 July 2009. [Google Scholar]
  22. Al-Saadi, S.N. Modeling and Simulation of PCM-Enhanced Facade Systems. Ph.D. Thesis, University of Colorado at Boulder, Boulder, CO, USA, 2014. [Google Scholar]
  23. Bernier, N.; Marcotte, B.; Kummert, M. Calling Python from TRNSYS with CFFI. 2022. Available online: https://www.trnsys.de/addons (accessed on 6 November 2024).
  24. Institute for Solar Technology (SPF)-Eastern Switzerland University of Applied Sciences (OST). Pytrnsys: The Python TRNSYS Tool Kit. 2022. Available online: https://pytrnsys.readthedocs.io/en/latest/ (accessed on 6 November 2024).
  25. Solmaz, A.S. A critical review on building performance simulation tools. Alam Cipta 2019, 12, 7–21. [Google Scholar]
  26. Barber, K.A.; Krarti, M. A review of optimization based tools for design and control of building energy systems. Renew. Sustain. Energy Rev. 2022, 160, 112359. [Google Scholar] [CrossRef]
  27. Kalkan, C.; Ward, C.; Duquette, J.; Khouli, F.; Ezan, M.A. Lessons Learned From Modelling a Complex Residential Building Energy System in TRNSYS. In Proceedings of the 13th eSim Building Simulation Conference 2024. IBPSA, Edmonton, AB, Canada, 5–7 June 2024. [Google Scholar]
  28. Nayak, A.K.; Hagishima, A. Modification of building energy simulation tool TRNSYS for modelling nonlinear heat and moisture transfer phenomena by TRNSYS/MATLAB integration. E3S Web Conf. 2020, 172, 25009. [Google Scholar] [CrossRef]
  29. Mazzeo, D.; Matera, N.; Cornaro, C.; Oliveti, G.; Romagnoni, P.; De Santoli, L. EnergyPlus, IDA ICE and TRNSYS predictive simulation accuracy for building thermal behaviour evaluation by using an experimental campaign in solar test boxes with and without a PCM module. Energy Build. 2020, 212, 109812. [Google Scholar] [CrossRef]
  30. Magni, M.; Ochs, F.; de Vries, S.; Maccarini, A.; Sigg, F. Detailed cross comparison of building energy simulation tools results using a reference office building as a case study. Energy Build. 2021, 250, 111260. [Google Scholar] [CrossRef]
  31. Asadi, E.; da Silva, M.G.; Antunes, C.H.; Dias, L. A multi-objective optimization model for building retrofit strategies using TRNSYS simulations, GenOpt and MATLAB. Build. Environ. 2012, 56, 370–378. [Google Scholar] [CrossRef]
  32. Magnier, L.; Haghighat, F. Multiobjective optimization of building design using TRNSYS simulations, genetic algorithm, and Artificial Neural Network. Build. Environ. 2010, 45, 739–746. [Google Scholar] [CrossRef]
  33. Fernandes, M.; Gaspar, A.; Costa, V.; Costa, J.; Brites, G. Optimization of a thermal energy storage system provided with an adsorption module—A GenOpt application in a TRNSYS/MATLAB model. Energy Convers. Manag. 2018, 162, 90–97. [Google Scholar] [CrossRef]
  34. Narayanan, M.; Lima, A.F.d.; de Azevedo Dantas, A.F.O.; Commerell, W. Development of a Coupled TRNSYS-MATLAB Simulation Framework for Model Predictive Control of Integrated Electrical and Thermal Residential Renewable Energy System. Energies 2020, 13, 5761. [Google Scholar] [CrossRef]
  35. Mylonas, A.; Macià-Cid, J.; Péan, T.Q.; Grigoropoulos, N.; Christou, I.T.; Pascual, J.; Salom, J. Optimizing Energy Efficiency with a Cloud-Based Model Predictive Control: A Case Study of a Multi-Family Building. Energies 2024, 17, 5113. [Google Scholar] [CrossRef]
  36. Arenas-Larrañaga, M.; Gurruchaga, I.; Carbonell, D.; Martin-Escudero, K. Performance of solar-ice slurry systems for residential buildings in European climates. Energy Build. 2024, 307, 113965. [Google Scholar] [CrossRef]
  37. Meiers, J.; el Jeddab, A.; Theis, D.; Jonas, D.; Frey, G.; Deissenroth-Uhrig, M. Hardware-in-the-loop integration of PVT models using Internet of Things-enabled communication. In Proceedings of the ISES and IEA SHC International Conference on Solar Energy for Buildings and Industry, Eurosun, Kassel, Germany, 25–29 September 2022. [Google Scholar] [CrossRef]
  38. National Instruments Corp. LabVIEW—Laboratory Virtual Instrumentation Engineering Workbench; National Instruments Corp.: Austin, TX, USA, 2018. [Google Scholar]
  39. Tadayon, L.; Meiers, J.; Jonas, D.; Frey, G. Design of a building energy system using model-based multi-objective optimization. In Proceedings of the PESS 2023, Power and Energy Student Summit, Bielefeld, Germany, 15–17 November 2023; pp. 49–55. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.