CAN bus response time analysis method supporting error retransmission mechanism, computer program product and terminal
By modeling the CAN system with error retransmission mechanism and calculating the worst-case response time, the problem of difficulty in combining probability real-time analysis with CAN bus technology in the prior art is solved, and the accurate evaluation and analysis of the system in dynamic and uncertain risk environments is achieved.
Patent Information
- Application Number
- CN202510063564.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-04-25
AI Technical Summary
It is difficult for the prior art to effectively combine probability real-time analysis and CAN bus technology to accurately evaluate the comprehensive performance of the system in dynamic and uncertain risk environments.
By modeling the CAN system with the error retransmission mechanism into a set of message sets consisting of n+1 independent sporadic frames, each frame is transmitted on the bus according to a fixed priority non-preemptive scheduling method, calculating the worst-case response time of the frame in a random case, considering the backlog of tasks, retransmission time and interference of high-priority tasks.
Accurate analysis and evaluation of CAN systems with error retransmission mechanisms in real situations is realized, the accuracy of worst-case response time calculation is improved, and the system design and verification cycle is reduced.
Smart Images

Figure CN119892307A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software, and in particular to a CAN bus response time analysis method supporting an error retransmission mechanism, a computer program product and a terminal. Background Art
[0002] Probabilistic real-time analysis has become an important method for analyzing the variation of task execution time in real-time systems. Unlike traditional deterministic analysis, which assumes that each task has a single worst case execution time (WCET), probabilistic analysis uses probability distribution to model the execution time of tasks. This shift provides a more detailed understanding of system behavior, especially in unattended disaster monitoring equipment systems, where the actual probability of the worst case execution time for tasks such as data sampling, network communication, and equipment status perception is usually low, so the use of worst-case estimates alone can easily lead to excessive waste of system resources. Probabilistic real-time analysis provides a more realistic description of system performance by shifting from ensuring that timing requirements are absolutely met to evaluating the possibility of meeting these requirements, allowing system designers to make design decisions based on acceptable risk probabilities. In equipment systems with high reliability requirements, such as railway external environmental disaster monitoring equipment, it is often necessary to define the reliability levels of different functional modules and their corresponding failure rate threshold standards. Probabilistic real-time analysis is consistent with these standards, allowing system designers to evaluate the possibility of timing failures, thereby ensuring compliance decisions within safety thresholds. Among them, the Controller Area Network (CAN) bus plays a key role in the real-time communication of unattended disaster monitoring equipment. Combining probabilistic real-time analysis with CAN bus technology is of great significance for accurately evaluating the comprehensive performance of the system in a dynamic and uncertain risk environment. Therefore, how to realize the combination of probabilistic real-time analysis and CAN bus technology is a technical problem that needs to be solved urgently. Summary of the invention
[0003] The purpose of the present invention is to overcome the problems of the prior art and to provide a CAN bus response time analysis method, a computer program product and a terminal supporting an error retransmission mechanism.
[0004] The object of the present invention is to achieve the following technical solution: a CAN bus response time analysis method supporting an error retransmission mechanism, the method comprising the following steps:
[0005] The CAN system with error retransmission mechanism is modeled as a message set consisting of n+1 independent sporadic frames, each of which is transmitted on the bus according to a non-preemptive scheduling method with fixed priority.
[0006] Calculate the worst case response time R of a frame under random conditionsi,j :
[0007] R i,j =S i,j +C i
[0008] S i,j The time from the release time of a frame instance to the start of error-free transmission, S i,j According to the backlog of release time of the instance in the frame B i,j , Error retransmission time The transmission time of the high priority instance is convolved and calculated; C i Indicates the frame transmission execution time.
[0009] In one example, a limit is set on the number of frame retransmissions, and the frame retransmission probability calculation expression is:
[0010]
[0011] Among them, P n is the probability of exactly n error frame retransmissions; P ok (C) represents the probability that no error occurs during the transmission time of the frame; P errors (C) represents the probability of at least one error occurring during the transmission time of a frame; P errors (C+E) represents the probability of at least one error occurring during the transmission time and retransmission time of the frame; P ok (C+E) represents the probability that no error occurs during the transmission time and retransmission time of the frame.
[0012] In one example, the CAN system with error retransmission mechanism is modeled as a message set consisting of n+1 independent sporadic frames, each frame further comprising:
[0013] The worst response time of the calculation frame under a fixed execution time is calculated based on busy window analysis, critical moment identification, and blocking time evaluation.
[0014] In one example, before calculating the worst response time of a frame under a fixed execution time or calculating the worst response time of a frame under a random situation, the step further includes:
[0015] Definition of busy window: The busy window starts from a certain time t s At the beginning, the high priority frame and the instance of the current frame are released for transmission, and at time t s There is no previous instance of a high-priority frame or the current frame waiting to be transmitted. Any instance with a lower priority than the current frame in the busy window cannot win arbitration and start transmission;
[0016] Determine the critical instant: the moment when the instance of the frame will experience the longest response time;
[0017] Evaluate blocking time: Calculate the blocking caused by low priority frames, the maximum blocking time is given by the longest low priority task transmission time.
[0018] In one example, using the busy window Calculate backlog B i,j , backlog B i,j The probability mass function expression of is:
[0019]
[0020] Among them, r i,j is the frame τ i The jth instance τ i,j release time; Indicates that i,j The probability of the backlog being zero at any given moment; Indicates busy window The part to be processed is shifted left by r i,j The probability distribution after the unit, the part to be processed represents the time from the instance release to the task instance execution end time.
[0021] In one example, the error retransmission time The calculation expression is:
[0022]
[0023] Among them, C i A random variable representing the transmission time.
[0024] In one example, represents the S calculated from the kth frame released by the high priority frame starting from the instance release time of the frame i,j , The calculation expression is:
[0025]
[0026] Indicates that in the time interval [0,r k-1 -r i,j ]Inside The stable part refers to the time window start time to the time when the task instance to be analyzed is released; Indicates that in the time interval (r k-1 -r i,j ,+∞) The pending part refers to the time from when the task instance is released to when the task instance is finished.
[0027] In one example, when And τ i,j Successfully started transmission, worst response time R i,j The calculation expression is:
[0028]
[0029] It should be further explained that the technical features corresponding to the various examples of the above method can be combined or replaced with each other to form a new technical solution.
[0030] The present invention also includes a computer program product, including a computer program, which, when executed by a processor, implements the steps of the CAN bus response time analysis method supporting an error retransmission mechanism formed by any one of the above examples or a combination of multiple examples.
[0031] The present invention also includes a terminal, including a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and when the processor executes the computer instructions, the steps of the CAN bus response time analysis method supporting the error retransmission mechanism formed by any one or more of the above examples are executed.
[0032] Compared with the prior art, the present invention has the following beneficial effects:
[0033] 1. In one example, a CAN system with an error retransmission mechanism is modeled, and the worst-case response time of frames under random conditions is calculated through probability analysis. The probability analysis takes into account the backlog of tasks, retransmission time, and interference from high-priority tasks, thereby realizing the analysis and evaluation of the CAN system with an error retransmission mechanism under realistic conditions, improving the accuracy of the worst-case response time calculation, and combining the characteristics of real monitoring equipment systems in the field of railway disaster monitoring, early warning, and disaster prevention to more realistically reflect the response behavior of tasks in a multi-task system, thereby reducing the gap between the worst-case response time analysis and actual execution.
[0034] At the same time, compared with traditional simulation and calculation methods, the present invention has significantly improved the computational time overhead. By optimizing the implementation scheme and convolution calculation steps, it can process complex task sets with high utilization and multiple messages in a shorter time, which is suitable for real-time verification in real scenarios and helps to shorten the system design and verification cycle.
[0035] 2. In one example, a method for analyzing frame response time under deterministic conditions is provided, which provides a reliable means of evaluating task response time under conditions without random errors. Combined with the technical means of calculating the worst-case response time of frames under random conditions through probability analysis, the CAN bus response time can be comprehensively analyzed. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The specific implementation methods of the present invention are further described in detail below in conjunction with the accompanying drawings. The accompanying drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The same reference numerals are used in these drawings to represent the same or similar parts. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.
[0037] Figure 1 A method flow chart provided for an example of the present invention;
[0038] Figure 2 A schematic diagram of a probability mass function of the worst execution time provided for an example of the present invention;
[0039] Figure 3 A diagram illustrating the operation process of the busy window-backlog convolution method provided as an example of the present invention. DETAILED DESCRIPTION
[0040] The technical solution of the present invention is described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In the description of the present invention, it should be noted that the directions or positional relationships indicated by "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc. are directions or positional relationships based on the drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the use of ordinal numbers (e.g., "first and second", "first to fourth", etc.) is to distinguish objects, and is not limited to this order, and cannot be understood as indicating or implying relative importance.
[0042] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0043] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0044] In one example, if Figure 1 As shown, a CAN bus response time analysis method supporting an error retransmission mechanism comprises the following steps:
[0045] S1: The CAN system with error retransmission mechanism is modeled as a message set consisting of n+1 independent sporadic frames, each of which is transmitted on the bus according to a non-preemptive scheduling method with a fixed priority.
[0046] Among them, CAN is a serial data bus that supports priority-based message arbitration and non-preemptive message transmission, aiming to provide a robust and reliable communication method for short messages. Among them, non-preemptive message transmission means that once a message starts to be transmitted on the CAN bus, it will not be interrupted by other messages, even if these later messages have higher priority. After modeling the CAN system with an error retransmission mechanism, each frame is transmitted on the bus according to a non-preemptive scheduling method with a fixed priority. Each CAN frame is represented by a tuple (C, T, D, p), where C represents the worst-case transmission time, that is, the maximum time required to transmit the entire frame load; T represents the minimum arrival interval time, that is, the minimum time interval required between consecutive arrivals of the same type of frames; D represents the relative deadline, that is, the time that the frame must be successfully transmitted after it is released; p represents a fixed priority, which determines the priority of the frame on the bus. Optionally, the smaller the value, the higher the priority. As a specific example, the parameters of each frame are shown in Table 1:
[0047] Table 1 Frame parameters
[0048] Frame(identifier) C T D p <![CDATA[τ0]]> 1 6 6 0 <![CDATA[τ1]]> 1 10 12 1 <![CDATA[τ2]]> 2 20 20 2
[0049] Furthermore, each frame contains a 15-bit cyclic redundancy check (CRC), through which the receiving node performs error detection. If an error is detected, the receiving node sends an error frame as a signal and starts a new arbitration phase after the frame. The present invention abstracts the analysis problem by modeling the CAN system with an error retransmission mechanism, so as to conduct in-depth research on the analysis of response time and related issues.
[0050] S2: Calculate the worst-case response time (predicted Worst-Case ResponseTime, pWCRT) of the frame under random conditions:
[0051] R i,j =S i,j +C i
[0052] R i,j Indicates the worst case response time; S i,j Represents frame τ i The jth instance τi,j Release time r i,j The time from the start of error-free transmission is frame τ i The sum of the remaining transmission times of all instances where higher priority frames are released and have not yet completed transmission. i,j According to the backlog of release time of the instance in the frame B i,j , Error retransmission time The high priority instance transmission time is calculated by convolution, where the high priority instance transmission time is determined according to the length of the frame, the priority order of the frame, etc.; C i Indicates the frame transmission execution time.
[0053] The response time consists of the time from the release time of the instance to the start of error-free transmission plus the execution time of the task. The start time of error-free transmission in this example is calculated by the convolution of the backlog of tasks at a given time, the error retransmission time, and the transmission time of high-priority tasks. To recursively calculate the worst-case response time for each task instance, the release times of the instances are first sorted in order, and in the case of the same release time, they are sorted by priority. The calculation process divides the time window into two parts: the stable part and the pending part. The stable part refers to the time window start time to the release time of the task instance to be analyzed, and the pending part refers to the release time of the task instance to the end of the task instance execution. The backlog is achieved through busy window analysis. First, the sum is performed within the stable part to determine the probability that the task backlog is zero at a given time. Then, the pending part is adjusted to the release time of the instance and its non-zero part is retained, and these two parts are combined to obtain the backlog value.
[0054] This example calculates the worst-case response time of frames in random situations through probabilistic analysis, which takes into account the backlog of tasks, retransmission time, and interference from high-priority tasks, thereby achieving accurate worst-case response time evaluation.
[0055] In one example, the error retransmission mechanism of the CAN system is analyzed. The retransmission probability of a frame includes the probability of an error event and the retransmission probability. In the case of a single-bit error model, the occurrence of an error event can be modeled using a Poisson process. The error rate λ is determined by the required transmission guarantee. Within a given time interval δ, the probability of m error events occurring exactly P(x=m,δ) and the probability of no error occurring at all P ok (δ), and the probability of at least one error occurring P errors The calculation expressions of (δ) are:
[0056]
[0057] P ok (δ) = e -λδ
[0058] P errors (δ) = 1-e -λδ .
[0059] like Figure 2 As shown in Figure 2, considering that the number of error events has a probability distribution, the total overhead of each instance needs to be considered using a probability mass function. Since there is no upper limit to the number of retransmissions caused by frame errors, a limit k is set on the maximum number of retransmissions for the convenience of analysis and practical considerations. The value of k is determined by the channel quality. n is the probability of exactly n erroneous retransmissions, which can be expressed as:
[0060]
[0061] Among them, P ok (C) represents the probability that no error occurs during the transmission time of the frame; P errors (C) represents the probability of at least one error occurring during the transmission time of a frame; P errors (C+E) represents the probability of at least one error occurring during the transmission time and retransmission time of a frame, and E represents the error signal overhead in the worst case; P ok (C+E) represents the probability that no error occurs during the transmission time and retransmission time of the frame. As a specific example, the probability distribution of errors in each frame is shown in Table 2:
[0062] Table 2 Probability distribution of errors in each frame
[0063]
[0064] Therefore, according to the error retransmission mechanism, the worst-case transmission time of an instance of a released frame should be given by the random variable For sporadic frames, T represents the minimum inter-arrival time, assuming it satisfies the constraint deadline, i.e., D <T。
[0065] In one example, the method of the present invention further includes a deterministic analysis step, which is specifically performed after step S1 to evaluate the response time of the frame under a fixed execution time, thereby ensuring that the time constraint of the system is met. Specifically, the deterministic analysis includes:
[0066] The worst response time of the calculation frame under a fixed execution time is calculated based on busy window analysis, critical moment identification, and blocking time evaluation.
[0067] Optionally, before calculating the worst response time of a frame under a fixed execution time and calculating the worst response time of a frame under a random situation, it also includes defining a response time, defining a busy window, determining a critical moment, and evaluating a blocking time, which are described in detail below.
[0068] Define response time: Response time R i,j is from the instance τ i,j The time interval from the start of release until the complete transmission of the instance is completed, which is composed of the time from the release time of the instance to the start of error-free transmission plus the execution time of the task, with special attention to the worst-case response time. i The worst-case response time of occurs in some instances when it is released within a specific busy window that starts immediately after the longest lower priority frame begins transmission, at which point the system enters a high-load processing phase, which may cause frame τ i The response time is affected.
[0069] Definition of busy window: The busy window starts from a certain time t s At the beginning, the high priority frame and the instance of the current frame are released for transmission, and at time t s There are no previous instances of higher priority frames or current frames waiting to be transmitted. The busy window is a continuous interval of time during which any instance with a lower priority than the current frame cannot win arbitration to start transmission. The busy window is the earliest time t that the bus becomes idle and ready for the next round of transmission and arbitration. e ends, and at time t e There is no instance of a high-priority frame or current frame release waiting for transmission. By defining a busy window, the transmission process of the current frame and the high-priority frame is analyzed. Within the busy window, the low-priority frame cannot win the bus arbitration, ensuring the calculation of the worst-case time overhead.
[0070] Determine critical instants: Identify critical instants, i.e., the moments when instances of a frame will experience the longest response time, in order to analyze the correct worst-case frame behavior. Specifically, the maximum busy window starts at the so-called critical instant. Under single-bus non-preemptive fixed-priority scheduling, the critical instant of a frame occurs when an instance of a frame is released: a) each frame with a higher priority than the current frame releases an instance at the same time as the current frame instance is released; b) all subsequent higher priority frame instances are released as early as possible, respecting their minimum inter-arrival time; c) each instance is executed with its worst-case transmission time.
[0071] Evaluating blocking time: Since the execution time of low-priority tasks directly affects the response time of high-priority tasks, that is, when a low-priority task is using a resource, even if a high-priority task needs the resource, it must wait for the low-priority task to release the resource. Therefore, it is necessary to calculate the blocking time B that may be caused by the low-priority frame lp(i). i , evaluate its impact on frame response time, especially under non-preemptive scheduling. The maximum blocking time is given by the longest low-priority task transmission time (including error conditions), blocking B i The calculation expression is:
[0072]
[0073] Among them, C j represents the worst-case transmission time of the jth task.
[0074] The deterministic analysis steps proposed in the present invention provide a set of rigorous tools for evaluating the reliability of task response time in real-time system design. When high-priority tasks occur frequently and the bus utilization is high, deterministic analysis can effectively evaluate the performance of the system under the most extreme conditions.
[0075] In one example, if Figure 3 As shown, using the busy window Calculate backlog B i,j ,Even if the transmission time is a random variable, the critical instant assumption is still valid. According to the release order of the instances, the busy window is iteratively calculated, including:
[0076] At the beginning of the analysis, t = 0, the initial state of the i-level busy window is recorded as Defined as:
[0077]
[0078] B i It means that at the beginning of the analysis, t = 0, the frame τ i The sum of the remaining transmission times of all instances where frames with higher priority are released but have not yet completed transmission. Assume that at time r n When the frame τ i The state of the sum of the remaining transmission time of all instances of higher priority frames released and not yet completed transmission Known, need to calculate Indicates that at time r n+1 When τ i The state of the sum of the remaining transmission time of all instances of higher priority frames released and not yet completed transmission, where r n+1 Greater than r n , and r n is τ i The time when the nth instance is released by the frame with higher priority. Sort by the release time of the instances. If the release time is the same, sort by priority. It is decomposed into two parts: the stable part and the part to be processed. The stable part is defined as the interval [0, t] The part to be processed is defined as the interval (t, +∞) At this time, the piecewise function f [a,b] (x) is the stable part and the pending part of the busy window, the piecewise function f [a,b] (x) The calculation expression is:
[0079]
[0080] Among them, a and b represent the range of the function, a=0, b=t. , the new instance affects only the pending part. This can be done by combining the part to be processed with the n The released instance is convolved and then combined with the stable part to obtain the calculation expression:
[0081]
[0082] when In the iteration of , when the probability that the next instance released by a frame falls within the busy window is less than ε, the iteration stops. At this time, the subsequent instance τ i,j are outside the busy window, so the global computation can be terminated because they do not contribute to the worst-case deadline miss probability. The threshold ε is usually derived from a confidence interval. This stopping condition can be expressed as:
[0083]
[0084] Where k represents the instance index; in the calculation If multiple r n In r i,j Release at, we choose the smallest n corresponding to That is, in the first instance, i,j Release the previous busy window.
[0085] Then, use the busy window Calculate backlog B i,j First, The stable part of the sum is summed to find the i,j The probability that the backlog is zero at this moment. Then, the part to be processed is shifted left by r i,j Unit, keep the part greater than zero, and combine the two parts to get B i,j The probability mass function of the backlog is B i,j The calculation is as follows:
[0086]
[0087] in, Indicates that i,j The probability of the backlog being zero at any given moment; Indicates busy window The part to be processed is shifted left by r i,j The probability distribution after the unit, the part to be processed represents the time from the instance release to the task instance execution end time.
[0088] In one example, since the bus will be re-arbitrated after each frame error transmission, which will extend the busy window, but there is no guarantee that the subsequent retransmission will be successful, the frame τ i The cumulative time of error retransmission The calculation expression is:
[0089]
[0090] Among them, C i A random variable representing the transmission time. At the beginning of the window calculation, the execution time C of the last successful transmission is subtracted. i .
[0091] In one example, Indicates that from r i,j S calculated for the kth frame starting with the release of high priority frames i,j ,calculate The high priority instance transmission time, at this time there is no need to backlog the release time of the instance in the frame B i,j , Error retransmission time High priority instance transmission time for convolution calculation S i,j , directly based on The transmission execution time of the frame is calculated to obtain the worst-case response time of the frame under random conditions. Specifically, Initialized to:
[0092]
[0093] Similar to the calculation of the busy window, In the iterative process, keep [0,r k-1 -r i,j ] part, for (r k-1 -r i,j ,+∞) part. If k>0, the iterative process can be expressed as:
[0094]
[0095] in, Indicates that in the time interval [0,r k-1 -r i,j ]Inside The stable part refers to the time window start time to the time when the task instance to be analyzed is released; Indicates that in the time interval (r k-1 -r i,j ,+∞) The pending part refers to the time from when the task instance is released to when the task instance is finished. i,j The released high priority frames will take precedence over τi,j Transmission affects r i,j The backlog at t = 0 corresponds to the zero time point of the backlog. Therefore, in the calculation process, the time point t = 0 should be included in the convolution interval.
[0096] When the next instance falls on When the probability within is less than the threshold, stop the iterative calculation It is expressed as:
[0097]
[0098] At this time, when And τ i,j Successfully started transmission, worst response time R i,j The calculation is as follows:
[0099]
[0100] Therefore, the frame τ i,j The probability of the worst response time transcendental function That is, the probability that WCRT exceeds a certain time t0 can be expressed as:
[0101]
[0102] The above examples are combined to obtain a preferred example of the present invention, in which the method comprises the following steps:
[0103] S10: Modeling of CAN system with error retransmission mechanism: Model the CAN system with error retransmission mechanism as a message set consisting of n+1 independent sporadic frames;
[0104] S20: Deterministic analysis step: define response time, define busy window, determine critical moment and evaluate blocking time, and calculate the worst response time of the frame under fixed execution time based on busy window analysis, critical moment identification and blocking time evaluation;
[0105] S30: Probabilistic analysis step: Calculate the worst-case response time R of a frame under random conditions i,j :
[0106] R i,j =S i,j +C i ;
[0107] Preferably, when And τ i,j Successfully started transmission, worst response time R i,j The calculation is as follows:
[0108]
[0109] The CAN system model of the error retransmission mechanism in step S10 is the basis of the entire framework, which is used to describe and model the behavior of the controller area network system with an error retransmission mechanism, including error detection and retransmission mechanisms. This model provides the necessary system structure and operation rules for subsequent analysis.
[0110] Step S20 deterministic analysis is based on the S10 model and provides an analysis method for frame response time under deterministic conditions. This method calculates the worst response time of a task under a fixed execution time through steps such as busy window analysis, critical moment identification, and blocking time evaluation, providing system designers with a reliable means to evaluate task response time without random errors.
[0111] Step S30 probabilistic analysis expands on the deterministic analysis in S20 and extends the analysis to random situations, especially those involving errors and retransmissions. It uses the system model in S10 and combines it with convolution calculations to evaluate the worst-case response time of tasks. The probabilistic analysis takes into account the backlog of tasks, retransmission time, and interference from high-priority tasks, thereby achieving an in-depth evaluation of system performance under the influence of random events.
[0112] In summary, the S10 model is the basis of the entire framework, providing the necessary background and operating rules; the S20 deterministic analysis conducts preliminary analysis based on this model; the S30 probabilistic analysis method further expands the S20 analysis, covering the system performance under random events, thereby realizing the analysis and evaluation of the CAN system with an error retransmission mechanism in real situations.
[0113] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the CAN bus response time analysis method supporting an error retransmission mechanism formed by any one of the above examples or a combination of multiple examples. The processor may be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
[0114] The present invention also provides a storage medium, which has the same inventive concept as a CAN bus response time analysis method supporting an error retransmission mechanism formed by any one of the above examples or a combination of multiple examples, and stores computer instructions thereon, which, when executed, execute the steps of the CAN bus response time analysis method supporting an error retransmission mechanism formed by any one of the above examples or a combination of multiple examples.
[0115] Based on this understanding, the technical solution of this embodiment, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0116] The present invention also provides a terminal, which has the same inventive concept as any example or a combination of multiple examples corresponding to the above-mentioned method for analyzing the response time of a CAN bus supporting an error retransmission mechanism, and includes a memory and a processor, wherein the memory stores computer instructions that can be run on the processor, and the processor executes the steps of the above-mentioned method for analyzing the response time of a CAN bus supporting an error retransmission mechanism when running the computer instructions. The processor can be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
[0117] In one example, the terminal, i.e., the electronic device, is presented in the form of a general-purpose computing device, and the components of the electronic device may include but are not limited to: at least one processing unit (processor) mentioned above, at least one storage unit mentioned above, and a bus connecting different system components (including storage units and processing units).
[0118] The storage unit stores a program code, and the program code can be executed by the processing unit, so that the processing unit executes the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification. For example, the processing unit can execute the above-mentioned CAN bus response time analysis method supporting an error retransmission mechanism.
[0119] The storage unit may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 3201 and / or a cache memory unit, and may further include a read-only memory unit (ROM).
[0120] The storage unit may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0121] The bus may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0122] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0123] Through the above description, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to this exemplary embodiment can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method of the exemplary embodiment of the present application.
[0124] The above specific implementation methods are detailed descriptions of the present invention. It cannot be determined that the specific implementation methods of the present invention are limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions and substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A CAN bus response time analysis method supporting an error retransmission mechanism, characterized in that: The following steps are involved: The CAN system with error retransmission mechanism is modeled as a message set consisting of n+1 independent sporadic frames, each of which is transmitted on the bus according to a non-preemptive scheduling method with fixed priority. Calculate the worst case response time R of a frame under random conditions i,j : R i,j =S i,j +C i Among them, S i,j The time from the release time of the frame instance to the start of error-free transmission; S i,j According to the backlog of release time of the instance in the frame B i,j , Error retransmission time The transmission time of the high priority instance is convolved and calculated; C i Indicates the frame transmission execution time.
2. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 1, characterized in that: Set a limit on the number of frame retransmissions. The frame retransmission probability calculation expression is: Among them, P n is the probability of exactly n error frame retransmissions; P ok (C) represents the probability that no error occurs during the transmission time of the frame; P errors (C) represents the probability of at least one error occurring during the transmission time of a frame; P errors (C+E) represents the probability of at least one error occurring during the transmission time and retransmission time of the frame; P ok (C+E) represents the probability that no error occurs during the transmission time and retransmission time of the frame.
3. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 1, characterized in that: The CAN system with error retransmission mechanism is modeled as a message set consisting of n+1 independent sporadic frames, each of which further includes the following after being transmitted on the bus according to a non-preemptive scheduling method with a fixed priority: The worst response time of the calculation frame under a fixed execution time is calculated based on busy window analysis, critical moment identification, and blocking time evaluation.
4. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 3 is characterized in that: The calculation of the worst response time of the frame under a fixed execution time or the worst response time of the frame under a random situation also includes: Definition of busy window: The busy window starts from a certain time t s At the beginning, the high priority frame and the instance of the current frame are released for transmission, and at time t s There is no previous instance of a high-priority frame or the current frame waiting to be transmitted. Any instance with a lower priority than the current frame in the busy window cannot win arbitration and start transmission; Determine the critical instant: the moment when the instance of the frame will experience the longest response time; Evaluate blocking time: Calculate the blocking caused by low priority frames, the maximum blocking time is given by the longest low priority task transmission time.
5. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 1, characterized in that: Use Busy Window Calculate backlog B i,j , backlog B i,j The probability mass function expression of is: Among them, r i,j is the frame τ i The jth instance τ i,j release time; Indicates that i,j The probability of the backlog being zero at any given moment; Indicates busy window The part to be processed is shifted left by r i,j The probability distribution after the unit, the part to be processed represents the time from the instance release to the task instance execution end time.
6. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 1, characterized in that: The error retransmission time The calculation expression is: Among them, C i A random variable representing the transmission time.
7. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 1, characterized in that: represents the S calculated from the kth frame released by the high priority frame starting from the instance release time of the frame i,j , The calculation expression is: in, Indicates that in the time interval [0,r k-1 -r i,j ]Inside The stable part refers to the time window start time to the time when the task instance to be analyzed is released; Indicates that in the time interval (r k-1 -r i,j ,+∞) The pending part refers to the time from when the task instance is released to when the task instance is finished.
8. The CAN bus response time analysis method supporting error retransmission mechanism according to claim 7, characterized in that: when And τ i,j Successfully started transmission, worst response time R i,j The calculation expression is:
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the CAN bus response time analysis method supporting an error retransmission mechanism described in any one of claims 1 to 8 are implemented.
10. A terminal comprising a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, characterized in that: When the processor runs the computer instructions, the processor executes the steps of the CAN bus response time analysis method supporting the error retransmission mechanism described in any one of claims 1-8.