Simulation device and simulation method
The simulation device and method address inaccuracies in timer simulations by adjusting virtual count times based on reference pulse periods, enhancing the accuracy and reliability of in-vehicle control systems.
Patent Information
- Application Number
- JP2021201794
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-12-13
- Publication Date
- 2025-05-21
- Estimated Expiration
- 2041-12-13
AI Technical Summary
Existing simulation technologies for microcomputer timers in control systems inaccurately represent the timing of counter value changes, leading to deviations between simulated and actual count times, especially when the reference pulse period is long, which can compromise the reliability of in-vehicle control systems.
A simulation device and method that simulate timers by storing a virtual pulse start time and calculating the counter value satisfaction time based on a specified multiple of the reference pulse period, adjusting for the detection edge timing to align with actual count start times, thereby reducing timing discrepancies.
The simulation device and method enhance the accuracy of timer operations in software simulations, making them closer to real-world environments and reducing deviations in simulation results, thus improving the reliability of in-vehicle control systems.
Smart Images

Figure 0007680811000001 
Figure 0007680811000002 
Figure 0007680811000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a simulation technique for checking the operation of control software built into a microcomputer. [Background technology]
[0002] A known conventional simulation technology is one that simulates a control system in which an electronic control device with a built-in microcomputer controls a controlled object entirely through software processing (see, for example, Patent Document 1). This technology makes it possible to check the operation of control software built into a microcomputer without using hardware related to the control system. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2007-233675 A Summary of the Invention [Problem to be solved by the invention]
[0004] In actual control systems, some timers in microcomputers of electronic control devices output a timer when a counter value, which changes with the detection edge of a reference pulse as a trigger, satisfies a predetermined condition (such as underflow). In such timers, when the detection edge timing of the reference pulse coincides with the count start timing, the time from the start of counting until the counter value satisfies the predetermined condition (actual count time) is a predetermined multiple of the reference pulse period. However, in reality, the count start timing does not necessarily coincide with the detection edge timing of the reference pulse, so the actual count time may not reach the predetermined multiple of the reference pulse period.
[0005] On the other hand, in the above simulation technology, the hardware of the electronic control device is realized by software, and the counting of the reference pulse in the timer is not simulated. Therefore, it is considered that the time from the virtual start of counting until the counter value satisfies a predetermined condition (virtual count time) is regarded as a predetermined time fixed to a predetermined multiple of the reference pulse period. Such a virtual count time tends to be longer than the actual count time, which may not reach the predetermined multiple of the reference pulse period, and the deviation between the actual count time and the virtual count time may become significant especially when the reference pulse period is long. This may result in simulation results that deviate from the actual in-vehicle control system, and may even lead to a decrease in product reliability.
[0006] In view of the above problems, the present invention has an object to provide a simulation device and a simulation method that bring the operation model of a timer in a microcomputer, when simulating the timer by software processing, closer to the operation in a real environment. [Means for solving the problem]
[0007] For this reason, the present invention The simulation device This simulates, through software processing, a timer which outputs when a counter value, which changes in response to the detection edge of a reference pulse, satisfies a specified condition. A virtual pulse start time is stored as the time before the virtual count start time, which is the time when counting is virtually started, when the reference pulse virtually starts. The time when the counter value satisfies the specified condition is determined by adding a specified multiple of the period of the reference pulse to the time of the detection edge of the reference pulse that virtually started from the virtual pulse start time, which is immediately before the virtual count start time. Furthermore, a simulation method according to the present invention uses a simulation device equipped with a computer to simulate through software processing a timer that outputs when a counter value that changes in response to a detection edge of a reference pulse satisfies a predetermined condition, and the simulation device stores a virtual pulse start time as the time before the virtual count start time, which is the time when counting is virtually started, as the time when the reference pulse virtually starts, and regards the time when the counter value satisfies the predetermined condition as being obtained by adding a predetermined multiple of the period of the reference pulse to the time of the detection edge of the reference pulse that virtually started from the virtual pulse start time, which is immediately before the virtual count start time, as the time when the counter value satisfies the predetermined condition. Effect of the Invention
[0008] According to the simulation device and simulation method of the present invention, it is possible to make the operation model of a timer when simulating a timer of a microcomputer by software processing closer to the operation in a real environment. [Brief description of the drawings]
[0009] [Figure 1] FIG. 2 is a block diagram showing an example of a software configuration of the simulation apparatus. [Diagram 2] 1 is a block diagram showing a schematic configuration of an in-vehicle control system; [Diagram 3] FIG. 2 is a block diagram showing an example of a hardware configuration of the simulation device. [Figure 4] FIG. 2 is an explanatory diagram showing an example of an overall simulated operation of an in-vehicle microcomputer; [Diagram 5] FIG. 2 is an explanatory diagram showing an example of the overall operation of an in-vehicle microcomputer; [Figure 6] FIG. 4 is an explanatory diagram showing an example of a down counter operation of an in-vehicle microcomputer; [Figure 7] FIG. 1 is an explanatory diagram showing an example of a conventional simulation operation regarding a down counter. [Figure 8] FIG. 2 is an explanatory diagram showing a first embodiment of a simulation operation regarding a down counter. [Figure 9] FIG. 11 is an explanatory diagram showing a second embodiment of a simulation operation regarding a down counter. [Figure 10] FIG. 1 is an explanatory diagram showing an example of a conventional simulation operation related to estimation of a counter value. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0010] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings.
[0011] [First embodiment] Fig. 1 shows an example of a software configuration of a simulation device. The simulation device 1 includes a computer and simulates the operation of an in-vehicle control system. Fig. 2 will now be referred to in order to explain the in-vehicle control system to be simulated.
[0012] 2, the in-vehicle control system 100 to be simulated includes an in-vehicle electronic control unit (hereinafter referred to as "ECU") 120 incorporating a microcomputer (hereinafter referred to as "in-vehicle microcomputer") 110, and an in-vehicle control target 130 controlled by the ECU. The ECU 120 receives a detection signal output from a sensor (not shown) that detects the operating state of the in-vehicle control target 130, and outputs a control signal to the in-vehicle control target 130 so that the operating state acquired based on the detection signal becomes a target state, thereby controlling the in-vehicle control target 130. In this way, the ECU 120 performs feedback control of the in-vehicle control target 130.
[0013] Control software (hereinafter referred to as "control software") 111 is prestored in a nonvolatile memory (not shown) such as a ROM in the in-vehicle microcomputer 110. This control software 111 is read into a volatile memory (not shown) such as a RAM via a microcomputer OS (Operating System) described below by a processor (not shown) such as a CPU in the in-vehicle microcomputer 110 and executed. In this way, the in-vehicle microcomputer 110 obtains the operating state of the in-vehicle control target 130 based on the above detection signal, and generates the above control signal so that the operating state becomes a target state.
[0014] The control software 111 has a hierarchical structure 111A, 111B, and 111C composed of a plurality of layers, and a microcomputer OS 111D that manages the processing of each layer. The hierarchical structure has, for example, three layers: a microcomputer-dependent layer 111A, a hardware-dependent layer 111B, and an application layer 111C. The microcomputer-dependent layer 111A is a layer that abstracts the hardware of the in-vehicle microcomputer 110, such as the port arrangement of the in-vehicle microcomputer 110. The hardware-dependent layer 111B is a layer that abstracts the control mechanism of the hardware of the in-vehicle control target 130. The application layer 111C is a layer that realizes an application using the software components of the hardware-dependent layer 111B.
[0015] Signals input / output between the in-vehicle microcomputer 110 and the in-vehicle controlled object 130 are transmitted via hardware such as the microcomputer resource 112 and the ECU interface 140. The microcomputer resource 112 is hardware inside the in-vehicle microcomputer 110, having a timer function, a PWM (Pulse Width Modulation) function, an A / D (Analog to Digital) conversion function, etc. The ECU interface 140 is hardware inside the ECU 120 other than the in-vehicle microcomputer 110, including a circuit for processing input / output signals of the in-vehicle microcomputer 110.
[0016] 1 again, the software configuration of the simulation device 1 will be described. The simulation device 1 executes the control software 111 having the above-mentioned hierarchical structure 111A, 111B, 111C by executing simulation software (hereinafter referred to as "simulation software") 2 instead of all the operations of the hardware related to the control of the in-vehicle control target 130 by so-called SILS (Software In the Loop Simulation). With such a simulation device 1, the operation of the control software 111 is confirmed without using any hardware related to the control of the in-vehicle control target 130, including the in-vehicle microcomputer 110 as hardware.
[0017] The simulation software 2 simulates the operation of hardware related to the control of the in-vehicle control target 130 in the in-vehicle control system 100, based on the execution result of the control software 111. The simulation software 2 includes a virtual microcomputer resource 21, a virtual ECU interface 22, an I / O conversion model 23, and a vehicle model 24.
[0018] The simulation software 2 replaces each hardware configuration of the in-vehicle control system 100 as follows. That is, the virtual microcomputer resource 21 performs software processing using a model of the microcomputer resource 112, and simulates the operation of the microcomputer resource 112. The virtual ECU interface 22 performs software processing using a model of the ECU interface 140, and simulates the operation of the ECU interface 140. The I / O conversion model 23 performs software processing using models of the in-vehicle control target 130 and sensors (not shown), and simulates the operation of the in-vehicle control target 130 and sensors for detecting its operating state. The vehicle model 24 performs software processing using a model of characteristics related to the vehicle's motion, and simulates the behavior of the vehicle accompanying the operation of the in-vehicle control target 130.
[0019] When the operation of the in-vehicle control system 100 when a control signal is output from the in-vehicle microcomputer 110 to the in-vehicle control target 130 is simulated by the simulation device 1, the simulation software 2 is executed as follows. That is, the virtual microcomputer resource 21 is executed using the execution result of the control software 111, and the virtual ECU interface 22 is executed using the execution result of the virtual microcomputer resource 21. Thereafter, the I / O conversion model 23 is executed using the execution result of the virtual ECU interface 22, and the vehicle model 24 is executed using the execution result of the I / O conversion model 23.
[0020] On the other hand, when the operation of the in-vehicle control system 100 when the in-vehicle microcomputer 110 inputs a detection signal from the in-vehicle control target 130 is simulated by the simulation device 1, the simulation software 2 is executed as follows. That is, the I / O conversion model 23 is executed using the execution result of the vehicle model 24, and the virtual ECU interface 22 is executed using the execution result of the I / O conversion model 23. Thereafter, the virtual microcomputer resource 21 is executed using the execution result of the virtual ECU interface 22, and the control software 111 is executed using the execution result of the virtual microcomputer resource 21.
[0021] In the simulation device 1, similarly to the in-vehicle microcomputer 110, the control software 111 is executed to virtually output a control signal, and then is executed again in response to a virtually input of a detection signal based on the execution result of the simulation software 2, thereby simulating feedback control. However, the control software 111 is not limited to being executed in response to a virtually input of a detection signal. For example, a part of the control software 111 may be executed as an interrupt process in response to a sudden event due to the execution result of the simulation software 2 or an event preset in a simulation OS described below.
[0022] The execution of the control software 111 and the simulation software 2 is managed by a simulation OS (Operating System) 3. The simulation OS 3 sequentially acquires the execution results of the control software 111 and the simulation software 2, and can cause a display or the like to display an image 4 of the execution results, or can cause data storage 5 to be performed as a log file.
[0023] 3 shows an example of a hardware configuration of the simulation device 1. The simulation device 1 includes a processor 11 such as a CPU (Central Processing Unit) that performs arithmetic control. The simulation device 1 also includes a volatile storage means 12 such as an SRAM (Static Random Access Memory) or a DRAM (Dynamic Random Access Memory) that temporarily stores information, and a non-volatile storage means 13 such as a flash memory or a hard disk that permanently stores information. The simulation device 1 also includes an input means 14 such as a mouse or a keyboard, and an output means 15 such as a display or a printer. These devices are connected to each other via a bus 16 so that they can communicate with each other.
[0024] The non-volatile storage means 13 stores the control software 111, the simulation software 2, and the simulation OS 3 in advance, and the processor 11 reads these into the volatile storage means 12 and executes them. The non-volatile storage means 13 may be a portable storage medium such as a data disk or a USB (Universal Serial Bus), or an external device capable of communicating with the simulation device 1. When at least a part of the control software 111 and the simulation software 2 is stored in a portable storage medium or an external device, the software is directly read into the volatile storage means 12 via the bus 16, or is temporarily stored in the non-volatile storage means 13 and then read into the volatile storage means 12.
[0025] The processor 11 first reads the simulation OS 3 into the volatile storage means 12 and starts the simulation OS 3. When the simulation OS 3 is started, a user operation screen may be displayed on the output means 15 such as a display. When the user performs an operation to start the simulation via the input means 14 such as a keyboard, the processor 11 reads the control software 111 and the simulation software 2 into the volatile storage means 12 and executes them. An image display 4 relating to the execution results of the control software 111 and the simulation software 2 is performed by the output means 15 via the simulation OS 3. Moreover, data storage 5 relating to the execution results is performed by the non-volatile storage means 13 via the simulation OS 3.
[0026] Fig. 4 shows an example of a simulated operation when the overall operation of the in-vehicle microcomputer 110 is simulated by the simulation device 1. Here, referring to Fig. 5 in addition to Fig. 4, features of the simulated operation by the simulation device 1 will be described. Fig. 5 shows an example of the overall operation of the in-vehicle microcomputer 110. Note that the simulated operation by the simulation device 1 in Fig. 4 is shown corresponding to the operation of the in-vehicle microcomputer 110 in the real environment in Fig. 5.
[0027] First, as shown in FIG. 5, the vehicle-mounted microcomputer 110 counts a predetermined time t SW_INTERVALEach time t1, t2, t3, and t4 pass, the first control software of the control software 111 is executed as a routine process. In the figure, the times at which the execution of the first control software starts are times t1, t2, t3, and t4 on the real time axis that indicates the actual passage of time. Then, while the first control software is being executed, the in-vehicle microcomputer 110 sets a down counter, if necessary, to cause a second microcomputer resource of the microcomputer resources 112, which has a timer function using a down counter, to start counting. Here, the time at which the down counter starts counting is referred to as the actual count start time t1. START The down counter sequentially decreases the counter value C for each predetermined pulse of the count clock, and when an underflow occurs in the counter value C, it changes the output signal of the vehicle-mounted microcomputer 110. Here, the time when the underflow occurs in the counter value C is called the actual underflow time t1. UDF In addition, when the first microcomputer resource having an A / D conversion function or the like among the microcomputer resources 112 detects a change in the input signal of the in-vehicle microcomputer 110, the second control software among the control software 111 is executed as non-stationary processing (times t2a to t2b, t3a to t3b). As is clear from FIG. 5, at times t1 UDF At times such as t2, t2b to t3, and t3b to t4, there are times when the first control software is to be waited for execution.
[0028] On the other hand, as shown in FIG. 4, the simulation device 1 executes the first control software as stationary processing and the second control software as non-stationary processing, similar to the in-vehicle microcomputer 110. The execution of these control software 111 is indicated by open rectangles in the figure. The time at which the simulation device 1 starts executing the first control software is set in advance by the simulation OS3 on a virtual time axis in the simulation, which has a different time progression from the real time axis, to the same time as the time at which the in-vehicle microcomputer 110 executes the first control software. In other words, the time at which the first control software is executed is set in advance by the simulation OS3 on the virtual time axis from time t1 V ,t2 V ,t3 V ,t4 VIn the following description, on the real time axis and the virtual time axis, times marked with the same symbol except for "V" indicate a common time.
[0029] In addition, in the simulation device 1, the operation of the microcomputer resource 112 in the vehicle-mounted microcomputer 110 is simulated by executing the first virtual microcomputer resource and the second virtual microcomputer resource of the virtual microcomputer resource 21. Specifically, the first virtual microcomputer resource is executed to simulate the operation of the first microcomputer resource, and the second virtual microcomputer resource is executed to simulate the operation of the second microcomputer resource. As a result of executing the first control software, information on a virtual output signal corresponding to an output signal of the vehicle-mounted microcomputer 110 (e.g., information on an output level of an output signal) is used to execute the simulation software 2. Information on a virtual input signal corresponding to an input signal of the vehicle-mounted microcomputer 110 (e.g., information on an input level of an input signal) may change as a result of executing the simulation software 2 or due to an event preset in the simulation OS 3. The execution of other software such as the simulation software 2 other than these control software 111 is indicated by a shaded rectangle in the figure.
[0030] By the way, at time t1 on the virtual time axis V From time t2 V Time to Δt 1-2 and a predetermined time t which is an interval for executing the first control software on the real time axis. SW_INTERVAL When compared on the same real time axis, the two are different times. V From time t3 V Time to Δt 2-3 Or, time t3 on the virtual time axis V From time t4 V Time to Δt 3-4 The same is true for the time interval for executing the first control software in the simulation device 1. SW_INTERVALThis is not the case. Firstly, in the simulated operation by the simulation device 1, the simulation OS3 does not manage the execution timing of the first control software, which is a regular process, by a count clock. In other words, when the execution of the second virtual microcomputer resource and the second control software ends, the simulation OS3 immediately executes the first control software without waiting for execution. Secondly, this is because the processing time by the simulation software 2 (the first and second virtual microcomputer resources in FIG. 4) and the simulation OS3, which simulate the operation of the first and second microcomputer resources, differs from the actual hardware processing time of the first and second microcomputer resources of the in-vehicle microcomputer 110. Note that the above-mentioned time Δt 1-2 ,Δt 2-3 ,Δt 3-4 is usually a given time t SW_INTERVAL will be shorter than
[0031] The simulation device 1 is V The first control software is started to be executed as a routine process of the first control software. When a count by a down counter becomes necessary during the execution of the first control software, the simulation device 1 sets the down counter. Then, the simulation device 1 sets a virtual count start time t1 via the simulation OS 3 as the time when the count is virtually started. V_START is stored in the volatile storage means 12.
[0032] Virtual count start time t1 V_START If the processing speed of the processor of the in-vehicle microcomputer 110 and the processor 11 of the simulation device 1 are the same, the virtual count start time t1 can be calculated as follows. V_START At time t1 V Virtual count start time t1 V_START The actual time required to reach time t1 V This is because the execution time of the first control software in the simulation device 1 and the execution time of the first control software in the vehicle-mounted microcomputer 110 are theoretically the same. On the other hand, the virtual count start time t1 V_STARTIn the case where the processing speeds of the processors of the vehicle-mounted microcomputer 110 and the simulation device 1 are different, the following may be performed. That is, the time t1 is set according to the ratio or difference between the known processing speeds of the processors of the simulation device 1 and the vehicle-mounted microcomputer 110. V Virtual count start time t1 V_START The actual time up to time t1 is corrected, and the correction value is V By adding to the virtual count start time t1 V_START may be calculated.
[0033] The simulation device 1 executes the second virtual microcomputer resource immediately after the execution of the first control software ends. As described above, the simulation device 1 does not simulate the count clock of the in-vehicle microcomputer 110, and therefore does not simulate the operation of sequentially decrementing the counter value C for each predetermined pulse of the count clock, as in the second microcomputer resource. Instead, the simulation device 1 determines the virtual underflow time t1 at which an underflow occurs in the counter value C due to the execution of the second virtual microcomputer resource, as described below. V_UDF and stores the result in the volatile storage means 12. V_UDF In the above, the second virtual microcomputer resource changes the information of the virtual output signal and stores it in the volatile storage means 12.
[0034] When the execution of the second virtual microcomputer resource ends, the simulation device 1 immediately V The simulation device 1 executes the first control software as a routine process in the simulation OS 3. After the execution of the first control software ends, the simulation device 1 executes the first virtual microcomputer resource in response to a change in the information of the virtual input signal. The change in the information of the virtual input signal occurs due to the execution result of the simulation software 2 or an event that is preset in the simulation OS 3. The simulation device 1 then executes the first virtual microcomputer resource at time t3 on the virtual time axis based on the execution result of the first virtual microcomputer resource. V The second control software is executed as a regular process at time t3 in the figure. VThe following simulation operation starts at time t2 on the virtual time axis. V From time t3 V Since the above is the same as the above, the explanation will be omitted.
[0035] Here, the downcounter operation of the in-vehicle microcomputer 110 and the conventional simulation operation of the downcounter of the simulation device 1 will be described with reference to FIGS. 6 and 7. Then, the virtual underflow time t1 due to the execution of the second virtual microcomputer resource will be described. V_UDF The calculation method will be explained.
[0036] First, as shown in Fig. 6, the in-vehicle microcomputer 110 starts up at time t0, and then starts executing the first control software at time t1 in Fig. 5. If necessary, during the execution of the first control software, the in-vehicle microcomputer 110 sets the down counter in the second microcomputer resource to, for example, 5, and starts counting at actual count start time t1. START The second microcontroller resource starts counting at the reference pulse frequency f CLK That is, the period Δt CLK (=1 / f CLK The counter value C is decreased by one at each rising edge (detection edge) of a square-wave count clock (hereinafter referred to as the "actual clock"). START Due to the phase relationship between the actual clock and the actual count start time t1 START is a time that is delayed from the rising edge of the actual clock pulse immediately before it. This delay time is called the actual shift time Δt SFT (0≦Δt SFT <Δt CLK In the second microcomputer resource, an underflow occurs when the first rising edge of the actual clock pulse is triggered after the counter value C becomes 0 (zero). Therefore, the actual count start time t1 START The actual underflow time t1, which is the time when the underflow occurred. UDF Actual count time Δt1 TC The actual count time Δt1 is as follows: TCis the actual shift time Δt SFT Depending on the size of 5×Δt CLK <Δt1 TC ≦6×Δt CLK The value will be in the range.
[0037] On the other hand, as shown in FIG. 7, the simulation device 1 V Assume that the in-vehicle microcomputer 110 is virtually started up at time t1 in FIG. V The first control software is executed as a routine process of the first control software. If a count by a down counter is required during the execution of the first control software, the down counter is set to a set value of, for example, 5. The set value of the down counter is stored in the volatile storage means 12 via the simulation OS 3. A virtual count start time t1 is set as the time when the count is virtually started. V_START is stored in the volatile storage means 12 via the simulation OS3, as described above.
[0038] When the execution of the first control software ends, the simulation device 1 executes the second virtual microcomputer resource, which causes a virtual underflow time t1 V_UDF The simulation device 1 does not simulate the operation of sequentially decreasing the counter value C for each predetermined pulse of the real clock (see the dashed line which changes in a step-like manner) as in the in-vehicle microcomputer 110, so it calculates a virtual counter value C equivalent to the counter value C. V The frequency f CLK That is, the period Δt CLK (=1 / f CLK ) is called the virtual clock. V_UDF is calculated as follows: V_UDF is the virtual count start time t1 V_START is calculated assuming that the timing is the same as the rising edge of the virtual clock pulse. V_UDF is the virtual count start time t1V_START From virtual underflow time t1 V_UDF Time until (virtual count time) Δt1 V_TC is the period Δt CLK [t1 V_UDF =t1 V_START +6×Δt CLK ]. Virtual underflow time t1 V_UDF When this virtual underflow time t1 is calculated, V_UDF is stored in the volatile storage means 12, and the virtual counter value C V is reset to 0 (zero).
[0039] However, as shown in FIG. 6, in the downcounting operation of the in-vehicle microcomputer 110, the actual counting start time t1 START Due to the phase relationship with the actual clock, the actual shift time Δt SFT Therefore, the actual count time Δt1 TC As mentioned above, 5 × Δt CLK <Δt1 TC ≦6×Δt CLK Therefore, in the simulation operation of the down counter of the simulation device 1 of FIG. V_START is the actual shift time Δt SFT It is preferable to consider the possibility of a delay corresponding to the virtual count time Δt1. V_TC However, the actual count time Δt1 TC Similarly, 5×Δt CLK <Δt1 V_TC ≦6×Δt CLK Nevertheless, in the simulation operation of the down counter of the simulation device 1, it is preferable to assume that the virtual count start time t1 V_START If it is assumed that there is no time delay with respect to the rising edge of the virtual pulse, the following problem occurs. That is, if there is a phase difference between the virtual clock and the actual clock in FIG. 7, the virtual underflow time t1V_UDF However, the actual underflow time t1 UDF For the actual shift time Δt SFT The error Δt error As a result, there is a risk that the simulation results obtained by the simulation device 1 may deviate from the operation of the vehicle-mounted microcomputer 110 in the actual environment.
[0040] 8 shows a first embodiment of a simulation operation for a down counter of the simulation device 1. In this simulation operation, the virtual underflow time t1 V_UDF Unlike the simulated operation of FIG. 7, the actual shift time Δt SFT The virtual shift time Δt V_SFT (0≦Δt V_SFT <Δt CLK ) is calculated taking into account the virtual shift time Δt V_SFT is the virtual count start time t1 V_START It is the time from the virtual underflow time t1 to the rising edge of the virtual clock pulse immediately before it. V_UDF is the virtual count time Δt1 V_TC However, the actual count time Δt1 TC Similarly, 5×Δt CLK <Δt1 V_TC ≦6×Δt CLK The calculation is performed on the assumption that the input signal can vary within the range of
[0041] As shown in FIG. 8, in the simulation device 1, at time t0 V At time t0, the in-vehicle microcomputer 110 is virtually started. V In the following simulation operations, unlike the simulation operations in Fig. 7, the period Δt CLK (=1 / f CLK ) is considered to have started at the virtual clock start time t V_CLK_START is stored in the volatile storage means 12 by the simulation OS3. The virtual clock start time t V_CLK_START At least, the virtual count start time t1 V_STARTUnder this condition, if the start time (first pulse rising time) of the actual clock in the vehicle-mounted microcomputer 110 is known, the start time of the actual clock or the time when the period Δt CLK The time obtained by adding or subtracting a multiple of t is the virtual clock start time t V_CLK_START In other words, the virtual clock start time t V_CLK_START may be set to a time having the same phase as the rising edge of the pulse of the actual clock.
[0042] The simulation device 1 detects the virtual clock start time t V_CLK_START After storing the data, at time t1 in FIG. V The first control software is executed as a routine process of the first control software. If a count by a down counter is required during the execution of the first control software, the down counter is set to a set value of, for example, 5. The set value of the down counter is stored in the volatile storage means 12 by the simulation OS3, and then, at the virtual count start time t1 V_START is stored in the volatile storage means 12 by the simulation OS3.
[0043] When the execution of the first control software ends, the simulation device 1 executes the second virtual microcomputer resource, which causes a virtual underflow time t1 V_UDF As described above, in the simulation device 1, the virtual counter value C V The virtual underflow time t1 remains unchanged at the set value (for example, 5). V_UDF As shown in the following equation (1), the virtual count start time t1 V_START For the virtual clock period Δt CLK Six times the value of [6×Δt CLK ] and the virtual shift time Δt V_SFT The virtual shift time Δt V_SFT As shown in the following equation (2), the virtual count start time t1 V_START From the virtual clock start time t V_CLK_START The difference time subtracted from the virtual clock period Δt CLKThe remainder is obtained when dividing by t1. V_UDF When this virtual underflow time t1 is calculated, V_UDF is stored in the volatile storage means 12, and the virtual counter value C V is reset to 0 (zero). Note that in the following formula (2), "%" represents the remainder symbol. t1 V_UDF =t1 V_START +6×Δt CLK -Δt V_SFT …(1) Δt V_SFT =(t1 V_START -t V_CLK_START )%Δt CLK …(2)
[0044] As described above, the simulation device 1 starts executing the first control software at time t1. V and the time t1 at which the first control software is executed by the in-vehicle microcomputer 110 are the same for both. In addition, if the processing speed of the first control software in the simulation device 1 and the in-vehicle microcomputer 110 is the same for both, the actual execution time from the start of execution of the first control software to the start of counting is theoretically the same for both. Therefore, theoretically, the actual counting start time t1 START and virtual count start time t1 V_START On the other hand, even if the processing speed of the first control software differs between the simulation device 1 and the in-vehicle microcomputer 110, as described above, the virtual count start time t1 V_START The virtual count start time t1 calculated in this way can be calculated. V_START Theoretically, the actual count start time t1 START Here, the virtual clock start time t V_CLK_START is the start time of the real clock, or the start time of the real clock has a period Δt CLK If the time is set to a multiple of Δt, the virtual shift time is V_SFT and actual shift time Δt SFT In this case, the virtual underflow time t1V_UDF and actual underflow time t1 UDF It can be said that these are consistent.
[0045] Also, the virtual clock start time t V_CLK_START is the start time of the real clock, or the start time of the real clock has a period Δt CLK Even if the time is not set to a multiple of , the following advantages are available:
[0046] The downcounting operation of the in-vehicle microcomputer 110 is assumed to be performed not only during the execution of the first control software from time t1, but also during the execution of the first control software from other times. For example, the downcounting may be performed from the actual counting start time t2 during the execution of the first control software from time t2. START The actual count time is Δt2. TC Actual underflow time t2 after UDF Consider a case where an underflow occurs at time t1. Even if times t1 and t2 are synchronized with the actual clock in the vehicle-mounted microcomputer 110, the actual counting starts at time t2. START The time from time t1 to the actual count start time t1 START There is a possibility that the time may deviate slightly from the time until the actual count start time t1 START ,t2 START Regarding the actual shift time Δt SFT fluctuates (0≦Δt SFT <Δt CLK ), actual count time Δt1 TC ,Δt2 TC And finally, the actual underflow time t1 UDF ,t2 UDF There is also a possibility of variation.
[0047] On the other hand, in the simulation operation of the down counter of the simulation device 1, at time t1 V It is assumed that the virtual counting by the down counter is performed not only during the execution of the first control software from time t2 but also during the execution of the first control software from other times. VDuring execution of the first control software, the virtual count starts at time t2. V_START The virtual count time Δt2 starts at V_TC Virtual underflow time t2 has elapsed V_UDF Consider the case where an underflow occurs at time t1 in the simulation device 1. V ,t2 V Even if the virtual clock is synchronized with the virtual clock, at time t2 V Virtual count start time t2 V_START The time until time t1 V Virtual count start time t1 V_START In this case, the virtual count start time t1 may deviate slightly from the time until the virtual count start time t1. V_START ,t2 V_START Regarding the virtual shift time Δt V_SFT fluctuates (0≦Δt V_SFT <Δt CLK ), virtual count time Δt1 V_TC ,Δt2 V_TC In turn, the virtual underflow time t1 V_UDF ,t2 V_UDF It also becomes scattered.
[0048] According to the simulation device 1, the virtual underflow time t1 V_UDF The actual underflow time t1 UDF Since it is possible to make the simulation operation of the down counter closer to the down counter operation of the vehicle-mounted microcomputer 110, the simulation operation of the down counter can be made to match the actual operation of the vehicle-mounted microcomputer 110.
[0049] In addition, in the simulation device 1, the virtual underflow time t1 V_UDF ,t2 V_UDF The actual underflow time t1 that may occur in the downcounter operation of the in-vehicle microcomputer 110 is UDF ,t2 UDF Therefore, the virtual shift time Δt V_SFTCompared with the case where the simulation operation of the down counter is performed without considering the period Δt CLK When is long, the actual underflow time t1 UDF Virtual underflow time t1 for V_UDF There is a high possibility that the total deviation value will decrease.
[0050] Second Embodiment 9 shows a second embodiment of the simulation operation of the down counter of the simulation device 1. In the second embodiment of the simulation operation of the down counter of the simulation device 1, unlike the first embodiment (see FIG. 8), a virtual counter value C V In the second embodiment, the same components as those in the first embodiment are denoted by the same reference numerals, and the description thereof will be omitted or simplified. The same applies below.
[0051] In the simulated operation of FIG. 9, the virtual count start time t1 V_START Then the virtual counter value C V When a confirmation request is made, the virtual counter value C V is the actual shift time Δt of the in-vehicle microcomputer 110 SFT The virtual shift time Δt V_SFT The virtual counter value C V The confirmation request is generated due to an unexpected event such as the execution result of the simulation software 2 or an event set in advance in the simulation OS 3. V The time when the confirmation request was made is the virtual event time t1 V_EVENT Let us assume that.
[0052] Virtual event time t1 V_EVENT Virtual counter value C in V is the virtual counter value C, which is the calculated value obtained by performing a specific calculation as shown in the following formula (3). VThe above predetermined calculation is performed by subtracting a set value (for example, 5) from the virtual event time t1. V_EVENT For virtual shift time Δt V_SFT Add and virtual count start time t1 V_START The time obtained by subtracting CLK The quotient is calculated by dividing the virtual shift time Δt V_SFT As shown in the above equation (2), the virtual count start time t1 V_START From the virtual clock start time t V_CLK_START The difference time subtracted from the virtual clock period Δt CLK The remainder is obtained by dividing by the virtual event time t1. V_EVENT Virtual counter value C in V When is calculated, the virtual counter value C stored in the volatile storage means 12 V may be changed to the calculated value. In the following formula (3), "INT" represents an integer function that truncates the value obtained by division in parentheses to an integer. C V =5-INT((t1 V_EVENT -(t1 V_START -Δt V_SFT )) / Δt CLK ) …(3)
[0053] Here, the virtual counter value C according to the second embodiment V To confirm the effect of estimating the virtual counter value C V FIG. 10 shows a method for estimating the virtual counter value C for the simulated operation of the down counter in FIG. V A simulated operation that allows further estimation of
[0054] In FIG. 10, if the simulation device 1 performs a simulated operation of a down counter based on a virtual clock, the virtual event time t1 V_EVENT Virtual counter value C in V On the other hand, in the conventional simulation operation of the down counter of the simulation device 1, as described above with reference to FIG.V_UDF is the virtual shift time Δt V_SFT Therefore, the virtual event time t1 V_EVENT Virtual counter value C in V In the above equation (3), the virtual shift time Δt V_SFT is calculated as 0 (zero) [C V =5-INT((t1 V_EVENT -t1 V_START ) / Δt CLK )]. That is, the virtual event time t1 V_EVENT Virtual counter value C in V is the virtual count start time t1 V_START From virtual event time t1 V_EVENT The calculation is based on the number of periods (integer) of the virtual clock included in the time until the virtual event time t1. V_EVENT Virtual counter value C in V is 3, and the virtual counter value C when the down counter is simulated based on the virtual clock V This deviates from the virtual counter value C V t1, the virtual count start time of the virtual clock V_START From virtual event time t1 V_EVENT This indicates that the number of pulse rises up to the time when the pulse width is 100 is not accurately reflected. Therefore, the simulated operation of the down counter of the simulation device 1 may deviate from the down counter operation of the in-vehicle microcomputer 110.
[0055] In contrast, in the simulated operation of FIG. 9, the virtual event time t1 V_EVENT Virtual counter value C in V However, the virtual count start time t1 V_START Virtual shift time Δt V_SFT From the backdated time, the virtual event time t1 V_EVENT The calculation is based on the number of periods (integer) of the virtual clock included in the time until the virtual event time t1. V_EVENT Virtual counter value C in V is the virtual count start time t1 of the virtual clock. V_STARTFrom the rising edge of the pulse immediately before the virtual event time t1 V_EVENT The calculation is based on the number of periods (integer) of the virtual clock included in the time until the virtual event time t1. V_EVENT Virtual counter value C in V is 2, and the virtual counter value C when the down counter is simulated based on the virtual clock V (=2). This is the virtual counter value C V t1, the virtual count start time of the virtual clock V_START From virtual event time t1 V_EVENT This shows that the number of pulse rises up to the point where the pulse width is 100 μs is accurately reflected.
[0056] In such a simulation device 1, a virtual event time t1 V_EVENT Virtual counter value C in V The virtual count start time t1 in the virtual clock V_START Therefore, the simulation device 1 can make the simulated operation of the down counter closer to the down counter operation of the in-vehicle microcomputer 110.
[0057] The contents of the present invention have been specifically described above with reference to preferred embodiments. However, it is obvious that a person skilled in the art can adopt various modified embodiments as described below based on the basic technical concept and teachings of the present invention.
[0058] In the above first and second embodiments, the simulation device 1 simulates the down counter operation of the in-vehicle microcomputer 110 that outputs a timer when an underflow occurs in the count by the down counter, but this is not limited to this. For example, the simulation device 1 may simulate the down or up counter operation of the in-vehicle microcomputer 110 that outputs a timer when an overflow occurs in the up counter, or when a compare match occurs in the down counter or the up counter. Furthermore, the down counter or the up counter of the in-vehicle microcomputer 110 that is the target of simulation in the simulation device 1 may change the counter value C when the falling edge of the pulse of the real pulse is detected.
[0059] In the above-described first and second embodiments, the time when the simulation device 1 starts executing the first control software does not have to be preset to the same time when the in-vehicle microcomputer 110 starts executing the first control software. In this case, the simulation device 1 stores the time when the execution of the first control software is started in real time (actual measured time) in the volatile storage means 12 via the simulation OS 3. Then, for example, the virtual count start time t1 V_START The actual measured time is stored, and the virtual count start time t1 is added to this time. V_START The virtual clock start time t V_CLK_START Even if the time is the same phase as the rising edge of the actual clock pulse, the actual underflow time t1 UDF and virtual underflow time t1 V_UDF Although it deviates from the actual count time Δt2 V_TC and the virtual count time Δt2 V_TC The deviation from this can be reduced.
[0060] In the above first and second embodiments, the simulation device 1 executes the control software 111 by substituting the simulation software 2 for all operations of the hardware related to the control of the in-vehicle control target 130 by so-called SILS. However, the simulation device 1 does not need to substitute the operations of a part of the hardware by executing the simulation software 2, except for a timer function such as a down counter among the microcomputer resources 112 of the in-vehicle microcomputer 110. Furthermore, the simulation device 1 is not limited to one that simulates the operations of the in-vehicle control system 100, and may also be one that simulates the operations of stationary production equipment or machines.
[0061] The technical ideas explained in the above embodiments and the variations based thereon can be used in any suitable combination as long as no contradiction occurs. [Explanation of symbols]
[0062] 1...simulation device, 2...simulation software, 3...simulation OS, 11...processor, 12...volatile storage means, 13...non-volatile storage means, 21...virtual microcomputer resource, 112...microcomputer resource, C...counter value, C V …Virtual counter value, t1 V_START …Virtual count start time, t V_CLK_START …Virtual clock start time (virtual pulse start time), t1 V_EVENT … Virtual event time (second time), t1 V_UDF ,t2 V_UDF …Virtual underflow time, t1 UDF ,t2 UDF …Actual underflow time, Δt V_SFT …Virtual shift time, Δt CLK …period
Claims
1. A simulation device that uses software processing to simulate a timer that outputs an output when a counter value that is changed using a detected edge of a reference pulse as a trigger satisfies a predetermined condition, a storage means for storing a virtual pulse start time as a time when the reference pulse is virtually started among times before a virtual count start time which is a time when counting is virtually started; a processor that regards a time obtained by adding a time that is a predetermined multiple of a period of the reference pulse to a first time that is a time of a detection edge of the reference pulse that has virtually started from the virtual pulse start time and that is immediately before the virtual count start time, as the time at which the counter value satisfies the predetermined condition; A simulation device comprising:
2. 2. The simulation device according to claim 1, wherein the counter value at a second time when a request to confirm the counter value is made after the virtual count start time is calculated based on a quotient obtained by dividing a time from the first time to the second time by a period of the reference pulse.
3. 3. The simulation device according to claim 1, wherein the first time is calculated based on a remainder obtained when a time from the virtual pulse start time to the virtual count start time is divided by a period of the reference pulse.
4. 4. The simulation device according to claim 1, wherein the virtual pulse start time is a time that has the same phase as a detected edge of the reference pulse.
5. A simulation method for simulating, by software processing, a timer that outputs when a counter value that changes in response to a detection edge of a reference pulse satisfies a predetermined condition, using a simulation device equipped with a computer, comprising: a virtual pulse start time is stored as the time before a virtual count start time, which is the time when counting is virtually started, at which the reference pulse virtually starts; and a time obtained by adding a predetermined multiple of the period of the reference pulse to the time of the detection edge of the reference pulse that virtually started from the virtual pulse start time and that immediately precedes the virtual count start time is regarded as the time at which the counter value satisfies the predetermined condition.
Citation Information
Patent Citations
Simulation device
JP1999328153A
Simulation device
JP2007233675A
System, method, and program for simulating evaluation, and storage medium
JP2010238018A
Information processing unit and program
JP2012226444A