Simulation method and recording medium
By setting up multiple processes in the SILS environment, executing the modeled code group and specific codes respectively, and using inter-process communication, the problem of mixing code and model in software development is solved, and efficient simulation and development efficiency is improved.
Patent Information
- Application Number
- CN202080016366.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-09-12
- Filing Date
- 2020-06-24
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2040-06-24
AI Technical Summary
In the prior art, the problem of mixing code and model in software development makes it difficult to simulate in a single process, which in turn affects the efficiency of software development.
By setting up multiple processes in the SILS environment, executing the modeled code group and specific codes, and using inter-process communication to realize the separation of code and model simulation, thereby improving the simulation efficiency.
It realizes the ease of software simulation of the mixed code and model, improves software development efficiency, and expands the scope of application of code modeling.
Smart Images

Figure CN113474779B_ABST
Abstract
Description
[0001] This application claims the benefit of priority based on Japanese patent application No. 2019-165886 filed on September 12, 2019, the contents of which are hereby incorporated by reference into this application. Technical Field
[0002] The present invention relates to a simulation method and a recording medium. Background Art
[0003] Model-based development is a system development method that uses simulation technology. In model-based development, a simulation environment is prepared in each process, and simulation is implemented in each process to improve quality and development speed in the design stage. When model-based development is applied to software development, each process in the simulation environment is divided into three processes: design research ~ design, implementation, and inspection. In design research ~ design, the MILS (Model In the Loop Simulation) environment is used to perform requirements analysis and requirements definition, basic design, and functional design. MILS is a simulation environment that allows the design document described by the model to run in the state of the model.
[0004] After the design survey and design are completed, implementation is performed based on the model generated during the design survey and design. During implementation, SILS (Software In the Loop Simulation) environment is used to perform detailed design and unit testing. SILS is a simulation environment that generates target code from source code such as C language automatically generated from the model and runs it.
[0005] After the implementation is completed, the system is checked in a virtual environment without using actual equipment. During the inspection, the HILS (Hardware In the Loop Simulation) environment is used to perform integration testing and system testing. HILS is a simulation environment that connects and runs the hardware that implements the software to be developed and the controlled body model (vehicle model if it is onboard) implemented in dedicated hardware, and enables electronic verification.
[0006] In addition, Patent Document 1 discloses a simulation system for performance evaluation that uses a source program with mixed descriptions of different abstraction levels and input data with different abstraction levels for simulation. The simulation system for performance evaluation is composed of a compiler unit that separates a source program with mixed descriptions of different abstraction levels into descriptions of each of a plurality of model execution units and generates target codes, and a plurality of model execution units that interpret and execute input events and target codes, and a simulation model that operates in coordination with each other.
[0007] Prior art literature
[0008] Patent Literature
[0009] Patent document: Japanese Patent Application Publication No. 2004-21907 Summary of the invention
[0010] Problems to be solved by the invention
[0011] Vehicle manufacturers and suppliers are moving to model-based development, but existing software is mostly composed of code, making it difficult to model everything at once. In addition, current simulation environments are based on the premise of running in a single process, and there is a problem that simulation cannot be easily performed when code and models are mixed.
[0012] In order to execute a part of the code processing as a model in the existing SILS environment (in a single process), it is possible to consider splitting the code before and after, embedding each as a part of the model, and adding the model as an object in between. However, if the code processing can be simply split, there is no problem, but it is difficult to split the code in the case of large-scale and complex code. In the case of such complex code, the simulation of mixing code and model is abandoned, and the model is automatically encoded (C coding, etc.) and then the action is confirmed in the SILS environment, which reduces the efficiency of software development.
[0013] The present invention aims to improve the efficiency of software development.
[0014] Technical solutions to solve problems
[0015] A simulation method according to one aspect of the invention disclosed in the present application is a simulation method for simulating a plurality of codes constituting a program executed by a processor, wherein the program is capable of controlling a control object, and the simulation method is characterized in that: the processor executes: a first setting process for setting a first process, wherein the first process performs a simulation of the actions of a code group other than a specific code in the plurality of codes; a second setting process for setting a second process, wherein the second process performs a simulation of the actions of a model obtained by modeling the specific code; a first simulation process for performing a first simulation of the codes in the code group up to the specific code in the first process; a second simulation process for performing a second simulation of the specific model in the second process using the execution result of the first simulation through inter-process communication between the first process and the second process; and a third simulation process for performing a third simulation of the codes after the specific code in the first process using the execution result of the second simulation through inter-process communication between the first process and the second process.
[0016] Effects of the Invention
[0017] According to the representative embodiment of the present invention, it is possible to improve the efficiency of software development. Other problems, structures and effects than those described above will be explained by the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a block diagram showing an example of the hardware configuration of a simulation device.
[0019] Figure 2 This is an explanatory diagram showing an example of SILS environment process.
[0020] Figure 3 This is an explanatory diagram showing an example of a linked simulation environment.
[0021] Figure 4 Yes means Figure 3 The flowchart of the linkage simulation execution example 1 in the linkage simulation environment shown.
[0022] Figure 5 Yes means Figure 3 The flowchart of the linkage simulation execution example 2 in the linkage simulation environment shown. DETAILED DESCRIPTION
[0023] <Hardware structure of the simulation device>
[0024] Figure 1 1 is a block diagram showing an example of the hardware structure of a simulation device. The simulation device has a processor 101, a memory 102, an input device 103, an output device 104, and a communication interface (communication IF) 105. The processor 101, the memory 102, the input device 103, the output device 104, and the communication IF 105 are connected via a bus 106. The processor 101 controls the simulation device. The memory 102 is a working area of the processor 101. In addition, the memory 102 is a non-temporary or temporary recording medium that stores various programs and data. As the memory 102, for example, there are ROM (Read Only Memory), RAM (Random Access Memory), HDD (Hard Disk Drive), and flash memory. The input device 103 inputs data. As the input device 103, for example, there are keyboards, mice, touch panels, numeric keypads, and scanners. The output device 104 outputs data. As the output device 104, for example, there are displays and printers. The communication IF 105 is connected to a network to send and receive data.
[0025] <SILS environment process example>
[0026] Figure 22 is an explanatory diagram showing an example of a SILS environment process. The SILS environment process 200 is a process for executing a simulation in the SILS environment. The SILS environment process 200 is stored in the memory 102 and is constructed in the memory 102 by being started by the processor 101.
[0027] The SILS environment process 200 includes a simulation BSW (Basic Software) 201 , a vehicle model 202 , and a GUI (Graphical User Interface) 203 .
[0028] The simulation BSW 201 is a virtual hardware structure for simulating an ECU (Electronic Control Unit) application program 220 as a simulation target, and is also called platform software.
[0029] The simulation BSW 201 includes a processor model 211, a memory model 212, an IF model 213, and a bus model 214. The processor model 211 executes an ECU application 220 and controls the vehicle model 202. The memory model 212 is a work area of the processor model 211. In addition, the memory model 212 stores the ECU application 220. The IF model 213 is connected to the vehicle model 202, and data is transmitted and received between the processor model 211 and the vehicle model 202. The bus model 214 connects the processor model 211, the memory model 212, and the IF model 213 so that they can communicate.
[0030] The vehicle model 202 is data obtained by modeling the structures in the vehicle that can be electronically controlled, such as acceleration and braking, engine, ignition switch, air conditioner, lights, wipers, etc. The vehicle is a moving body that can travel on the ground, such as a passenger car, bus, truck, etc., a motorcycle, an electric bicycle, an electric wheelchair, and construction machinery. In addition, the vehicle model 202 is an example of a control object, and may also be a model other than a vehicle, such as a refrigerator, a rice cooker, a microwave oven, and other household appliances.
[0031] The GUI 203 displays the output result from the vehicle model 202 on the output device 104. Next, the ECU application 220 stored in the memory model 212 will be described.
[0032] The ECU application 220 is an example of an application to be simulated. For example, it is an application to perform object recognition based on dynamic image data from a camera. The application to be simulated is determined according to the model to be controlled.
[0033] The ECU application 220 has a first component code C1 to an nth component code Cn (n is an integer greater than or equal to 2). Any component code among the first component code C1 to the nth component code Cn is referred to as an i-th component code (i is an integer satisfying 1≤i≤n). The first component code C1 to the nth component code Cn are executed in the order from the smallest i to the largest i.
[0034] <Example of Linked Simulation Environment>
[0035] Figure 3 1 is an explanatory diagram showing an example of a linkage simulation environment. The linkage simulation environment 300 is a simulation environment in which the SILS environment process 200 and the MILS environment process 301 are linked. The MILS environment process 301 is a process for executing simulation in the MILS environment. The MILS environment process 301 is stored in the memory 102 and is constructed in the memory 102 by being started by the processor 101.
[0036] Figure 3 In the SILS environment process 200, the second component code C2 in the ECU application 220 is modeled as a second component model M2, which is constructed in the memory model 212 and used as a simulation object instead of the second component code C2. Therefore, in the SILS environment process 200, in the ECU application 220, the second component code C2 is excluded from the simulation object.
[0037] Here, for example, the second component code C2 is excluded from the simulation object, and the second component model M2 is used as the simulation object, but the i-th component code Ci may be excluded from the simulation object, and the i-th component model Mi may be used as the simulation object. In addition, the component code excluded from the simulation object is not limited to one, and may be two or more. In this case, two or more component models corresponding to the two or more component codes excluded from the simulation object become the simulation objects.
[0038] In addition, in the linkage simulation environment 300 , in the SILS environment process 200 , a SILS inter-process communication synchronization module 320 is constructed in the memory model 212 , and in the MILS environment process 301 , a MILS inter-process communication synchronization module 310 is constructed in the memory model 212 .
[0039] The SILS inter-process communication synchronization module 320 is communicably connected to the first component code C1, the third component code C3 and the MILS inter-process communication synchronization module 310. The MILS inter-process communication synchronization module 310 is communicably connected to the second component model M2 and the SILS inter-process communication synchronization module 320.
[0040] The execution result of the first component code C1 obtained by the processor model 211 is sent to the second component model M2 via the SILS-side inter-process communication synchronization module 320 and the MILS-side inter-process communication synchronization module 310 and becomes the input data of the second component model M2.
[0041] The execution result of the second component model M2 obtained by the processor model 211 is sent to the third component code C3 via the MILS-side inter-process communication synchronization module 310 and the SILS-side inter-process communication synchronization module 320, and becomes the input data of the third component code C3.
[0042] In addition, when TCP / IP and UDP are applied to the SILS inter-process communication synchronization module 320 and the MILS inter-process communication synchronization module 310, the MILS environment process 301 may be constructed in another simulation device. In this case, the MILS environment process 301 is executed in the simulation BSW 201 constructed in the other simulation device.
[0043] <Linked simulation execution example>
[0044] Figure 4 Yes means Figure 3 Flowchart of linkage simulation execution example 1 in the linkage simulation environment 300 shown. Figure 4 This is an example of linkage simulation execution when TCP / IP and UDP are applied to the inter-process communication performed by the SILS-side inter-process communication synchronization module 320 and the MILS-side inter-process communication synchronization module 310.
[0045] The SILS environment process 200 generates a SILS socket in the SILS process inter-process communication synchronization module 320 (step S411), and prepares for connection with the MILS socket and waits (step S412). On the other hand, the MILS environment process 301 generates a MILS socket in the MILS process inter-process communication synchronization module 310 (step S421), and requests connection with the SILS socket (step S422). Specifically, for example, the connection request is sent to the SILS environment process 200.
[0046] In step S412, the SILS environment process 200 waits for connection with the MILS socket, and establishes a connection between the SILS socket and the MILS socket by receiving a connection request from the MILS environment process 301. Thus, the SILS environment process 200 and the MILS environment process 301 are set to be executable.
[0047] After the connection is established, the SILS environment process 200 executes a loop process of steps S413 to S416, and the MILS environment process 301 executes a loop process of steps S423 to S425. Both loop processes are executed a predetermined number of times (e.g., the time from when the vehicle is powered on and starts moving until it travels a predetermined distance and stops).
[0048] Specifically, for example, the SILS environment process 200 uses the processor model 211 to execute the processing of the first component code C1 (step S413). Then, the SILS environment process 200 uses the SILS inter-process communication synchronization module 320 to send the data of the execution result of step S413 to the second component model M2 via the MILS inter-process communication synchronization module 310 (step S414).
[0049] The MILS environment process 301 receives the data of the execution result of step S413 using the MILS inter-process communication synchronization module 310 (step S423). The MILS environment process 301 inputs the data received in step S423 to the second component model M2, and uses the processor model 211 to perform the processing of the second component model M2 (step S424). Then, the MILS environment process 301 sends the data of the execution result of step S424 to the third component code C3 via the SILS inter-process communication synchronization module 320 using the MILS inter-process communication synchronization module 310 (step S425).
[0050] The SILS environment process 200 receives the data of the execution result of step S425 using the SILS inter-process communication synchronization module 320 (step S415). The SILS environment process 200 inputs the data received in step S415 into the third component code C3, and executes the processing of the third component code C3 using the processor model 211. After that, the SILS environment process 200 sequentially executes the processing of the fourth component code C4 to the nth component code Cn using the processor model 211 (step S416).
[0051] When the loop processing ends, the SILS environment process 200 disconnects the connection with the MILS side socket (step S417), and ends a series of processing. Similarly, when the loop processing ends, the MILS environment process 301 disconnects the connection with the SILS side socket (step S426), and ends a series of processing.
[0052] in addition, Figure 4 In the example of applying TCP / IP and UDP to inter-process communication, pipe processing and message queues can also be applied.
[0053] Figure 5 Yes means Figure 3 Flowchart of Example 2 of executing the linked simulation in the linked simulation environment 300 shown. Figure 5 This is an example of linkage simulation execution when a shared memory model is applied to inter-process communication. The shared memory model is a predetermined storage area in the memory model 212, and can be accessed by the SILS environment process 200 and the MILS environment process 301. The mutual exclusion control of the shared memory model is managed by semaphores. Figure 5 In the case of Figure 3 The SILS inter-process communication synchronization module 320 and the MILS inter-process communication synchronization module 310 are shown.
[0054] The SILS environment process 200 generates a semaphore object for synchronization with the MILS environment process 301 (step S511). On the other hand, the MILS environment process 301 generates a semaphore object for synchronization with the SILS environment process 200 (step S421).
[0055] The SILS environment process 200 executes a loop process of steps S512 to S517, and the MILS environment process 301 executes a loop process of steps S522 to S526. Both loop processes are executed a predetermined number of times (for example, the time from when the vehicle is powered on and starts moving until it travels a predetermined distance and stops).
[0056] Specifically, for example, the SILS environment process 200 uses the processor model 211 to execute the processing of the first component code C1 (step S512). Then, the SILS environment process 200 writes the data of the execution result of step S512 into the shared memory model (step S513). Then, the SILS environment process 200 releases the MILS synchronization semaphore generated in step S511 (step S514).
[0057] The MILS environment process 301 waits for the SILS environment process 200 to release the MILS synchronization semaphore (step S522). When the MILS synchronization semaphore is released, the MILS environment process 301 can access the shared memory model, so it reads the data written in step S513 from the shared memory model (step S523).
[0058] The MILS environment process 301 inputs the data read in step S523 to the second component model M2, and executes the processing of the second component model M2 using the processor model 211 (step S524). Then, the MILS environment process 301 writes the data of the execution result of step S524 into the shared memory model (step S525). Then, the SILS environment process 200 releases the MILS synchronization semaphore generated in step S521 (step S526).
[0059] The SILS environment process 200 waits for the MILS environment process 301 to release the SILS synchronization semaphore (step S515). When the SILS synchronization semaphore is released, the SILS environment process 200 can access the shared memory model, so it reads the data written in the shared memory model in step S525 from the shared memory model (step S516).
[0060] The SILS environment process 200 inputs the data read in step S516 to the third component code C3, and executes the processing of the third component code C3 using the processor model 211. Then, the SILS environment process 200 executes the processing of the fourth component code C4 to the nth component code Cn in sequence using the processor model 211 (step S517).
[0061] When the loop processing ends, the SILS environment process 200 ends a series of processing. Similarly, when the loop processing ends, the MILS environment process 301 ends a series of processing.
[0062] Thus, according to this embodiment, simulation of software in which code and model are mixed can be facilitated, and an environment in which code and model are mixed can be easily constructed, thereby achieving high efficiency in the development of software in which code and model are mixed.
[0063] In addition, by constructing a mixed environment of code and model, the scope of application of code modeling can be flexibly expanded, and action verification can be performed using simulation, so it is possible to implement a method in which the entire code is modeled while performing equivalence verification.
[0064] Furthermore, by separating the processes executed in the simulation of the code and the model and synchronizing the processes using inter-process communication for bidirectional data exchange across the processes, it is possible to unify the simulation time.
[0065] In addition, the present invention is not limited to the above-mentioned embodiments, and includes various modifications and equivalent structures within the scope of the attached claims. For example, the above-mentioned embodiments are described in detail to explain the present invention in an easy-to-understand manner, and the present invention is not limited to all the structures that must be described. In addition, a part of the structure of a certain embodiment can be replaced with the structure of other embodiments. In addition, the structure of other embodiments can be added to the structure of a certain embodiment. In addition, for a part of the structure of each embodiment, other structures can also be added, deleted, or replaced.
[0066] In addition, the above-mentioned structures, functions, processing parts, processing units, etc. may be partially or entirely implemented by hardware, for example, by designing them in an integrated circuit, or may be implemented by software by interpreting and executing programs that implement the functions by a processor.
[0067] Information such as programs, tables, and files that implement various functions can be stored in storage devices such as memories, hard disks, SSDs (Solid State Drives), or recording media such as IC (Integrated Circuit) cards, SD cards, and DVDs (Digital Versatile Discs).
[0068] In addition, control lines and information lines are shown as those considered necessary for explanation, and not all control lines and information lines necessary for implementation are shown. In fact, it can be considered that almost all structures are connected to each other.
Claims
1. A simulation method for simulating a plurality of codes constituting a program executed by a processor, wherein the program is capable of controlling a control object, the simulation method being characterized by: The processor performs: Setting a first setting process of a first process, wherein the first process performs a software-in-the-loop simulation of actions of a code group other than a specific code among the plurality of codes; Setting a second setting process of a second process, wherein the second process performs a model-in-the-loop simulation of an operation of a specific model obtained by modeling the specific code; a first simulation process of executing, in the first process, a first simulation of the codes in the code group up to the specific code; a second simulation process, performing a second simulation of the specific model in the second process using the execution result of the first simulation through inter-process communication between the first process and the second process; and The third simulation process is to execute a third simulation of the code after the specific code in the first process by using the execution result of the second simulation through the inter-process communication between the first process and the second process.
2. The simulation method according to claim 1, wherein: In the first setting process, the processor sets a first communication module capable of communicating with the second process in the first process. In the second setting process, the processor sets, in the second process, a second communication module capable of communicating with the first process. In the first simulation process, the processor uses the first communication module to send the execution result of the first simulation to the specific model via the second communication module. In the second simulation process, the processor uses the second communication module to receive the execution result of the first simulation to perform the simulation of the specific model in the second process, and uses the second communication module to send the execution result of the second simulation to the code after the specific code via the second communication module. In the third simulation processing, the processor receives the execution result of the second simulation using the first communication module to execute the third simulation of the code after the specific code in the first process.
3. The simulation method according to claim 2, characterized in that: The processor of the first computer executes the first setting process, the first simulation process and the third simulation process, A processor of a second computer different from the first computer executes the second setting process and the second simulation process.
4. The simulation method according to claim 1, wherein: In the first setting process, the processor sets a first semaphore for managing mutual exclusion control of the second process in the first process, and sets the first process to be able to access a shared storage area accessible to the second process. In the second setting process, the processor sets a second semaphore for managing mutual exclusion control of the first process in the second process, and sets the second process to be able to access the shared memory area. In the first simulation process, the processor stores the execution result of the first simulation in the shared storage area to release the first semaphore to the second process. In the second simulation processing, when the first semaphore has been released, the processor obtains the execution result of the first simulation stored in the shared storage area to execute the simulation of the specific model in the second process, and stores the execution result of the second simulation in the shared storage area to release the second semaphore to the first process. In the third simulation processing, the processor obtains the execution result of the second simulation stored in the shared storage area when the second semaphore has been released, to execute the third simulation of the code after the specific code in the first process.
5. The simulation method according to claim 1, wherein: The control object is a vehicle model.
6. A computer-readable recording medium having a simulation program recorded thereon, wherein the simulation program causes a processor to execute a simulation of a plurality of codes constituting a program capable of controlling a control object, characterized in that: The simulation program causes the processor to execute: Setting a first setting process of a first process, wherein the first process performs a software-in-the-loop simulation of actions of a code group other than a specific code among the plurality of codes; Setting a second setting process of a second process, wherein the second process performs a model-in-the-loop simulation of an operation of a specific model obtained by modeling the specific code; a first simulation process of executing, in the first process, a first simulation of the codes in the code group up to the specific code; a second simulation process, performing a second simulation of the specific model in the second process using an execution result of the first simulation through inter-process communication between the first process and the second process; and The third simulation process is to execute a third simulation of the code after the specific code in the first process by using the execution result of the second simulation through the inter-process communication between the first process and the second process.
7. The computer-readable recording medium having the simulation program recorded thereon as claimed in claim 6, wherein: In the first setting process, the processor is caused to set a first communication module capable of communicating with the second process in the first process. In the second setting process, the processor is caused to set a second communication module capable of communicating with the first process in the second process. In the first simulation process, the processor uses the first communication module to send the execution result of the first simulation to the specific model via the second communication module. In the second simulation process, the processor uses the second communication module to receive the execution result of the first simulation, performs the simulation of the specific model in the second process, and uses the second communication module to send the execution result of the second simulation to the code after the specific code via the second communication module. In the third simulation processing, the processor receives the execution result of the second simulation using the first communication module to execute the third simulation of the code after the specific code in the first process.
8. The computer-readable recording medium having the simulation program recorded thereon as claimed in claim 7, wherein: causing a processor of a first computer to execute the first setting process, the first simulation process, and the third simulation process, The second setting process and the second simulation process are executed by a processor of a second computer different from the first computer.
9. The computer-readable recording medium having a simulation program recorded thereon as claimed in claim 6, wherein: In the first setting process, the processor sets a first semaphore for managing mutual exclusion control of the second process in the first process, and sets the first process to be able to access a shared storage area accessible to the second process. In the second setting process, the processor sets a second semaphore for managing mutual exclusion control of the first process in the second process, and sets the second process to be able to access the shared memory area. In the first simulation process, the processor is caused to store the execution result of the first simulation in the shared storage area to release the first semaphore to the second process. In the second simulation processing, the processor is caused to obtain the execution result of the first simulation stored in the shared storage area when the first semaphore has been released, to execute the simulation of the specific model in the second process, and to store the execution result of the second simulation in the shared storage area, to release the second semaphore to the first process. In the third simulation processing, the processor is caused to obtain the execution result of the second simulation stored in the shared storage area when the second semaphore has been released, so as to execute the third simulation of the code after the specific code in the first process.
10. The computer-readable recording medium having the simulation program recorded thereon according to claim 6, wherein: The control object is a vehicle model.
Citation Information
Patent Citations
Simulation system for performance evaluation
JP2004021907A
Absorbent article
JP2019165886A
Master and slave architecture for co-simulation of control systems
EP3291112A1
Method, apparatus, and computer program product for implementing dynamic cosimulation
US20050060133A1