Implementation of FEMLAB in S-Functions

van Schijndel, A.W.M.J.
Technische Universiteit Eindhoven, Netherlands

FEMLAB has standard facilities to export models to Simulink. Normally, the standard export works well if the solvers, available in Simulink, can handle the problem. However, if a model in FEMLAB needs special solvers, for example airflow or other non-linear problems, the standard export to Simulink is often not suitable, because the standard solvers of Simulink cannot handle such a problem efficiently.

This can cause long simulation duration times and even leads to no solution at all. The paper presents a possible solution to this problem by implementing FEMLAB code in the discrete section of a Simulink S-Function. The S-Function solves each time step the non-linear problem using the FEMLAB solver. After each time step the solution is exported. Furthermore, different boundary values can be applied at will.

The implementation of FEMLAB code in a S-Function is demonstrated by a case study, where the airflow temperature at the inlet of an office is controlled by an on/off controller in Simulink. The results show: (1) the dynamic interaction of the airflow in the room and the controller and (2) details of how a S-Function can be programmed using FEMLAB.

It is concluded that FEMLAB models can also be exported to Simulink by writing an appropriate S-Function. The advantage of this approach is that the special solvers of FEMLAB can be used in the Simulink environment. This can lead to significant improvement of the simulation duration time.