The continuity and discreteness of the concept of time in FMU are actually attributes of variables. And FMU can contain variables of continuous time or discrete time. This can be seen in the FMU communication of model exchange type and joint simulation type.
In FMI2.0, the communication structure for data exchange through communication points is discrete.
1. Model exchange: import tool provides solver
-
The model integration between simulation tools is very tight.
-
The interface between the import tool and the model is very complex.
-
The import tool must provide a suitable solver.
2. Joint simulation: export tool provides solver
-
There is a tight coupling between the model and the solver.
-
The interface between the import tool and the model is relatively simple.
-
Different joint simulation algorithms and communication steps can be selected to achieve a more stable and accurate simulation solution.
3. Interface of Joint Simulation
The communication time step can be different from the internal step. The communication time step is mainly used to exchange information between different FMUs, while different variable time steps can be used within each FMU.
In the co-simulation interface, the parameters have a typical calling order according to the FMI standard:
-
Get the output: fmiGetXXX(...)
-
Trigger calculation until the next communication node: fmidoStep(...)
-
Set input value: fmi2SetXXX(...)
Take C code as an example:
-
Instantiate the FMU using the FMI2Instantiate function
CALL (FMI2Instantiate(S, resourceURI, fmi2CoSimulation, modelDescription->instantiationToken, fmi2Flase, fmi2Flase))
The parameters involved are the FMI instance, the URI of the FMU resource, the declaration of the FMU type as co-simulation, the unique identifier, whether to display the FMU GUI, and whether to start logging.
-
Apply initial values and output
CALL(applyStartValues(S,settings)); CALL(FMIApplyInput(S,input,settings->startTime,true,true,false));
-
Set parameters and enter initialization mode. If there is an FMU initial state file, you can execute it after instantiating the FMU.
CALL(FMI2SetupExperiment(S,settings->tolerance>0,settings->tolerance,settings->startTime,fmiFalse,0)); CALL(FMI2EnterInitializationMode(S)); CALL(FMI2ExitInitializationMode(S));
-
Enter the simulation loop, sampling and applying input according to the time step
or(ubsignedlongstep=0;;step++){constfmi2Realtime=settings->startTime+step*settings->outputInterval;... CALL(FMISample(S,time,result)); CALL(FMIApplyInput(S,input,time,true ,true,false)); ...... constFMIStatusdoStepStatus=FMI2DoStep(S,time,settings->outputInterval,fmiTrue); ...... CALL(FMIGetBooleanStatues(S,fmi2Terminated,&terminated)) .... .. CALL(FMI2GetRealStatus(S,fmi2LastSuccessfulTime,&lastSuccessfulTime)); CALL(FMISample(S,lastSuccessfulTime,result)); ......
Role of Joint Simulation Algorithm
-
The co-simulation algorithm is not part of the FMI standard and is mainly used for:
-
Advance the time of the entire simulation system so that the FMU components of each subsystem perform simulation calculations synchronously at each time step, that is, the simulation loop part of the code.
-
Exchange input and output data.
-
Trigger clock signal, used to synchronize different simulation components or trigger certain actions, i.e. in the code.
settings->startTime+step*settings->outputInterval;FMI2DoStep(S,time,settings->outputInterval,fmiTrue);
-
Handle events, such as state changes, external input, internal condition triggering, etc., that is, in code.
CALL(FMI2GetRealStatus(S,fmi2LastSuccessfulTime,&lastSuccessfulTime));CALL(FMISample(S,lastSuccessfulTime,result));
4. Model description files are parallel
The model description file modelDescription.xml contains all the static information about the FMU. It defines the interface types supported by the FMU, whether it is model exchange or co-simulation, and explains the model variables, including inputs, outputs and related parameters, so that the import tool can access them.
In addition, it will also contain some information about the model interface, such as whether the data conforms to the input and output when the model is connected.
In addition, some attribute flags are declared in the model description file, such as "needsExcutionTool". This attribute indicates that a specific program or a specific library file is required to execute the FMU. Therefore, when importing the FMU, an additional wrapper is required in the import tool. It does not actually participate in the calculation, but is used to realize communication between the model, the solving tool and the execution.
Previous article:Differences between the working principles of gasoline engines and diesel engines
Next article:Kangmou shares | In-depth discussion of ADTF technology in CAN
- Popular Resources
- Popular amplifiers
- "Cross-chip" quantum entanglement helps build more powerful quantum computing capabilities
- Why is the vehicle operating system (Vehicle OS) becoming more and more important?
- Car Sensors - A detailed explanation of LiDAR
- Simple differences between automotive (ultrasonic, millimeter wave, laser) radars
- Comprehensive knowledge about automobile circuits
- Introduction of domestic automotive-grade bipolar latch Hall chip CHA44X
- Infineon Technologies and Magneti Marelli to Drive Regional Control Unit Innovation with AURIX™ TC4x MCU Family
- Power of E-band millimeter-wave radar
- Hardware design of power supply system for automobile controller
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Comparison between NFC, RFID, infrared and Bluetooth
- A summary of the most downloaded electronic technical materials this week (2020.6.8~12)
- HPS calls have no input or output pins
- MPPT solar lithium battery charger based on single chip microcomputer
- Data sharing: A brief review of the 2018 National Undergraduate Electronic Design Competition TI Cup and sharing of preparation experience
- STM32 assignment question
- RF Network Analysis Basics
- LIS331DLH three-axis acceleration sensor package and code
- EEWORLD University - EOS and ESD on ADC
- NodeMcuEsp8266-L298N drives DC motor