Written by: Xiaoran Han – Project Engineer
This blog post demonstrates the concept of using a Functional Mock-up Unit  (FMU) for external model calibration. The example used is a combustion model from the Claytex Engines Library  with appropriate boundaries to enable its calibration through many engine operating points. Figure 1 shows the combustion model where boundary conditions of pressure and temperature for intake and exhaust are defined in boundaryFixed_1 and boundaryFixed_2 respectively. The opening of orifice and orifice1 are controlled by cam timing profiles. Engine speed, Injection timing, ignition timing and fuel mass are set. The objective is to minimize the offset between experimentally measured cylinder pressure and modelled cylinder pressure via model parameter calibration.
Figure 1: Combustion calibration rig model in Dymola
To generate FMU we go to the Simulation tab in Dymola and click on the menu arrow to the right of Translate icon and choose FMU.
A pop up window shows the settings options for exporting the FMU. We now choose the options in Export FMU window as shown in Figure 2 and click OK, then a FMU is generated. More details of the options can be found in .
Figure 2: Export FMU window
One way to name the generated FMU is to copy the command shown in blue in Figure 3 and paste it at the bottom of command window and enter the name between “ ” and then click enter. In this case we name our model to be combustionCalibration. The FMU with this name will be generated in Dymola working directory.
Figure 3: Example of FMU model naming via the Dymola command line.
Figure 4: FMI setup
FMI blockset from Claytex allows to import the generated FMU for use in other software such as Simulink, Excel, VisualDoc, etc.; see . Figure 4 shows the configuration panel for FMI Blockset where we can view and edit inputs, outputs, constants and variables, parameters and initial values. Once simulation settings have been configured the setup can be saved to generate a .txt file with all the model parameters. Run Sim generates a .csv output file. These are the files that will be used for combustion parameter optimisation via VisualDoc .
In VisualDoc, an experiment work flow has been set up; see Figure 5. All parameters of Dymola model can be imported as calibration input parameters of the optimizer, Figure 6, by loading the .txt file which has been generated using FMI Blockset. Outputs of Dymola model can also be imported into VisualDoc by loading the .csv file, in our case this is error percentage between test and modelled cylinder pressure.
Figure 5: VisualDoc experiment setup with workflow and nested processes.
Figure 6: Example of model parameters imported into VisualDoc input file.
These can then be optimised within VisualDoc via chosen criteria using the FMU we exported from Dymola.
This article has given a quick overview of the use of an FMU for model optimization using VisualDoc. One thing to note is that when configuring simulation setup in FMI Blockset a smaller step time is preferred to ensure simulation runs reliably; too large step time can cause the VisualDoc solver to produce not sufficiently accurate calculation results.
Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion.