The invention relates to a shared memory algorithm, which belongs to the technical field of missile hardware in the loop simulation test. The invention discloses a shared memory algorithm, which can allocate enough shared memory blocks for the real-time simulation system, thereby effectively improving the efficiency and stability of the simulation system operation. Based on the related parameters of the simulation system, using the shared memory algorithm designed by the invention is to compute the required shared memory block parameter of development, based on the parameters and reference value to adjust the time frame of the simulation system, in order to ensure the stability of the time frame. The ring shared memory block structure based on the shared memory algorithm above solves the uncertainty of the number of shared memory blocks in the simulation system, reduces the waste of the system resources and improves the memory utilization. The algorithm is simple and direct, and the efficiency and stability of the system is much higher than the simulation system before the optimization algorithm.
【技术实现步骤摘要】
一种共享内存算法
本专利技术一种共享内存算法属于半实物仿真系统试验
技术介绍
一般情况下,一次半实物仿真运行过程中产生的数据量是非常大的,而物理内存是有限的,如果申请的共享内存区太大,会影响运行效率甚至会使仿真程序在运行过程中发生崩溃。如果申请的共享内存区太小,不能满足仿真数据通讯量的需求。通常的做法都是由用户估计一个适当大小的共享内存,例如分成1000块,尽量不对系统的运行造成影响并可以满足实时仿真的需要,但是这样的估算是粗略的,不够精确,容易造成资源的浪费,也可能发生错帧、漏帧现象,进而导致系统发散。而且不同仿真系统项目,任务需求量不同,按现有方法必须对内存块数量估计值进行反复推算,耗时又费力。因此,需要设计一种共享内存块算法,为实时仿真系统分配足够的共享内存块,可有效提高仿真系统运行的效率和稳定性。
技术实现思路
本专利技术的目的:提供一种共享内存算法,计算出一个具有准确内存块数量的共享内存环,很好地解决了仿真系统的共享内存块不确定问题,提高内存利用率。本专利技术的技术方案:一种共享内存算法,所述共享内存算法包括以下步骤;1)设定仿真参数,已知仿真系统的仿真次数为Z,仿真系统的仿真帧时间为X,仿真系统每帧读数据的时间为Y;2)根据公式N=Z+1-((X/Y)*Z),计算共享内存块N的数量;3)根据公式Z=(n+1)N+J-1和公式n*N+J=(X/Y)*Z,计算出读数据的圈数n的数值;读到第几块J的数值;4)根据得到的共享内存块N的数值、读数据圈数n的数值;读到第几块J的数值调整仿真系统的帧时间,以保证帧时间准确。专利技术的有益效果:基于以上共 ...
【技术保护点】
一种共享内存算法,其特征在于,所述共享内存算法包括以下步骤;1)设定仿真参数,已知仿真系统的仿真次数为Z,仿真系统的仿真帧时间为X,仿真系统每帧读数据的时间为Y;2)根据公式N=Z+1‑((X/Y)*Z),计算共享内存块N的数量;3)根据公式Z=(n+1)N+J‑1和公式n*N+J=(X/Y)*Z,计算出读数据的圈数n的数值;读到第几块J的数值;4)根据得到的共享内存块N的数值、读数据圈数n的数值;读到第几块J的数值调整仿真系统的帧时间,以保证帧时间准确。
【技术特征摘要】
1.一种共享内存算法,其特征在于,所述共享内存算法包括以下步骤;1)设定仿真参数,已知仿真系统的仿真次数为Z,仿真系统的仿真帧时间为X,仿真系统每帧读数据的时间为Y;2)根据公式N=Z+1-((X/Y)*Z),计算共享内存块N的数量...
【专利技术属性】
技术研发人员:邹小霞,李维,彭江军,黄桂明,高欣,郑宏海,衷莉莎,孙锐,冯晓艳,巩三莉,王锦菲,江蔚,
申请(专利权)人:江西洪都航空工业集团有限责任公司,
类型:发明
国别省市:江西,36
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。