计算机科学 ›› 2026, Vol. 53 ›› Issue (2): 107-116.doi: 10.11896/jsjkx.250200061

• 计算机体系结构 • 上一篇    下一篇

基于线程池任务调度的局部同步FMI联合仿真方法

薛朝阳1, 钱晓超2, 刘飞1   

  1. 1 华南理工大学软件学院 广州 515000
    2 上海机电工程研究所 上海 201109
  • 收稿日期:2025-02-17 修回日期:2025-05-23 发布日期:2026-02-10
  • 通讯作者: 刘飞(feiliu@scut.edu.cn)
  • 作者简介:(202221045693@mail.scut.edu.cn)
  • 基金资助:
    国家自然科学基金(62273153);广东省基础与应用基础研究基金(2024A1515010900)

Local Synchronous FMI Co-simulation Method Based on Thread Pool Task Scheduling

XUE Zhaoyang1, QIAN Xiaochao2, LIU Fei1   

  1. 1 School of Software Engineering,South China University of Technology,Guangzhou 515000,China
    2 Shanghai Institute of Mechanical and Electrical Engineering,Shanghai 201109,China
  • Received:2025-02-17 Revised:2025-05-23 Online:2026-02-10
  • About author:XUE Zhaoyang,born in 1999,postgra-duate,is a member of CCF(No.Y8623G).His main research interest is modeling and simulation.
    LIU Fei,born in 1976,Ph.D,professor,Ph.D supervisor,is a member of CCF(No.B9231M).His main research interests include modeling and simulation,and artificial intelligence.
  • Supported by:
    National Natural Science Foundation of China(62273153) and Guangdong Basic and Applied Basic Research Foundation(2024A1515010900).

摘要: 并行仿真是提高仿真性能的关键技术,然而当前基于FMI(Functional Mock-up Interface)的并行联合仿真存在诸多挑战,如FMU(Functional Mock-up Unit)和执行线程耦合、输入输出同步、FMI API互斥等问题。针对这些问题,提出了一种基于线程池任务调度的局部同步FMI联合仿真方法。首先,给出了该方法的框架,该框架由仿真方案、主算法、调度器和缓冲区组成,以提供并行仿真的模块化表示。然后,重点描述了FMI并行联合仿真主算法,其将单个FMU的单次仿真任务分为仿真执行和任务调度两阶段,由调度器调度执行,并自定义读写锁解决仿真过程中的同步问题;同时,通过将输出暂存到缓冲区,以避免FMI API竞争访问的问题。最后通过一个房间温差模型和一个船舶定位模型验证了所提方法的准确性,与FMU并行的非迭代雅可比方法进行对比,所提方法取得了显著的性能提升。

关键词: 并行仿真, 联合仿真, FMI, FMU, 主算法, 无锁优化

Abstract: Parallel simulation is a key means to improve simulation performance.However,parallel co-simulation based on FMI faces many challenges,such as coupling between FMU and threads,input/output synchronization,and mutual exclusion of FMI API.In response to these problems,this paper proposes a local synchronous FMI co-simulation method based on thread pool task scheduling.Firstly,the framework of the method is presented,consisting of a simulation scheme,master algorithm,scheduler,and buffer to provide a modular representation of parallel simulation.Then,the master algorithm of FMI parallel co-simulation is described,which divides a simulation task of a FMU into two stages:simulation execution and task scheduling.The scheduler sche-dules the task to execute.And customizes read-write lock is designed to solve the synchronization problem during the simulation.The output is temporarily stored in a buffer to solve the problem of FMI API contention for access.The accuracy of the proposed method is verified through a room temperature difference model and a ship positioning model.Compared with the non-iterative Jacobi method parallel to FMU,significant performance improvement is achieved.

Key words: Parallel simulation, Co-simulation, Functional Mock-up Interface, Functional Mock-up Unit, Master algorithm, Lock-free

中图分类号: 

  • TP391.9
[1]HATLEDAL L I,STYVE A,HOVLAND G,et al.A Language and Platform Independent Co-Simulation Framework Based on the Functional Mock-Up Interface[J].IEEE Access,2019,7:109328-109339.
[2]BLOCHWITZ T,OTTER M,ARNOLD M,et al.The FunctionalMockup Interface for Tool independent Exchange of Simulation Models[C]//Proceedings of the 8th International Modelica Conference.Dresden:Linköping University Press,2011:105-114.
[3]GALTIER V,VIALLE S,CHERIFA D,et al.FMI-based dis-tributed multi-simulation with DACCOSIM[C]//Proceedings of the Symposium on Theory of Modeling & Simulation:DEVS Integrative M&S Symposium.2015:39-46.
[4]ÉVORA GÓMEZ J,HERNÁNDEZ CABRERA J,TAVELLA J P,et al.Daccosim NG:co-simulation made simpler and faster[C]//The 13th International Modelica Conference.2019:785-794.
[5]DAD C,TAVELLA J P,VIALLE S.Synthesis and feedback on the distribution and parallelization of FMI-CS-based co-simulations with the DACCOSIM platform[J].Parallel Computing,2021,106:102802.
[6]KRAFT J,MEYER T,SCHWEIZER B.Parallel Co-Simulation Approachwith Macro-Step Size and Order Control Algorithm[C]//15th International Conference on Multibody Systems,Nonlinear Dynamics,and Control.2019.
[7]POGORELOV D,RODIKOV A,KOVALEV R.Parallel Computations and Co-simulation in Universal Mechanism Software.Part I:Algorithms and Implementation[J].Transport Problems,2019,14(3):163-175.
[8]BEN KHALED A,BEN GAID M,PERNET N,et al.Fastmulti-core co-simulation of Cyber-Physical Systems:Application to internal combustion engines[J].Simulation Modelling Practice and Theory,2014,47:79-91.
[9]SAIDI S E,PERNET N,SOREL Y.Automatic parallelization of multi-ratefmi-based co-simulation on multi-core[C]//TMS/DEVS 2017-Symposium on Theory of Modeling and Simulation.ACM,2017.
[10]SAIDI S E,PERNET N,SOREL Y.A method for parallelscheduling of multi-rate co-simulation on multi-core platforms[J].Oil & Gas Science and Technology-Revued’IFP Energies Nouvelles,2019,74:49.
[11]HANSEN S T,GOMES C,KAZEMI Z.Synthesizing Orchestration Algorithms for FMI 3.0[C]//2023 Annual Modeling and Simulation Conference(ANNSIM).2023:184-195.
[12]BROMAN D,BROOKS C,GREENBERG L,et al.Determinate composition of FMUs for co-simulation[C]//2013 Proceedings of the International Conference on Embedded Software(EMSOFT).IEEE,2013:1-12.
[13]VAN ACKER B,DENIL J,VANGHELUWE H,et al.Generation of anOptimised Master Algorithm for FMI Co-simulation[C]//Proceedings of the Symposium on Theory of Modeling & Simulation:DEVS Integrative M&S Symposium.2015:205-212.
[14]CREMONA F,LOHSTROH M,TRIPAKIS S,et al.FIDE:anFMI integrated development environment[C]//Proceedings of the 31st Annual ACM Symposium on Applied Computing.ACM,2016:1759-1766.
[15]WU Q,COLE C,SPIRYAGIN M,et al.Parallel co-simulation of heavy-haul train braking dynamics with strong nonlinearities[J].Mechanics Based Design of Structures and Machines,2024,52(5):2623-2638.
[16]SHEN Y,LIU C,ZHOU D,et al.A parallel coupling framework for DEM-MBD:Model verification and application DEM-MBD[J].Powder Technology,2024,448:120257.
[17]ZHENG L,CUI Y,JIN S,et al.High-Performance Computing-Based Open-Source Power Transmission and Distribution Grid Co-Simulation[J].IEEE Transactions on Power Systems,2024,39(5):6144-6153.
[18]STEWART R,RAITH A,SINNEN O.Optimising makespanand energy consumption in task scheduling for parallel system[J].Computers & Operations Research,2023,154:106212.
[19]LI M,HUANG L,XU G,et al.A parallel particle swarm optimization framework based on a fork-join thread pool using a work-stealing mechanism[J].Applied Soft Computing,2023,145:110537.
[20]FATOUROU P,KOSMAS E,PALPANAS T,et al.FreSh:ALock-Free Data Series Index[C]//2023 42nd International Symposium on Reliable Distributed Systems(SRDS).2023:209-220.
[21]MAROTTA R,IANNI M,PELLEGRINI A,et al.A Conflict-Resilient Lock-Free Linearizable Calendar Queue[J].ACM Transactions on Parallel Computing,2024,11(1):1-32.
[22]EGUILLON Y,LACABANNE B,TROMEUR -DERVOUT D.F$$_3$$ORNITS:a flexible variable step size non-iterative co-simulation method handling subsystems with hybrid advanced capabilities[J].Engineering with Computers,2022,38(5):4501-4543.
[23]PERABO F,PARK D,ZADEH M K,et al.Digital Twin Modelling of Ship Power and Propulsion Systems:Application of the Open Simulation Platform(OSP)[C]//2020 IEEE 29th International Symposium on Industrial Electronics(ISIE).IEEE,2020:1265-1270.
[24]LU L,XUE Z,LIU F.Design and Development of an FMI Co-Simulation Tool[C]//2024 3rd International Conference on Artificial Intelligence and Computer Information Technology(AICIT).2024:1-5.
[25]SICKLINGER S,BELSKY V,ENGELMANN B,et al.InterfaceJacobian-based Co-Simulation[J].International Journal for Numerical Methods in Engineering,2014,98(6):418-444.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!