Message sending method, electronic equipment, vehicle and storage medium
By dynamically scheduling the actual transmission time of messages based on the nominal message transmission period and time offset tolerance under the AUTOSAR architecture, the problems of peak resource contention and lag in the system are solved, and the system load is smoothed and the stability is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-03-24
AI Technical Summary
Under the AUTOSAR architecture, the simultaneous transmission of multiple periodic messages leads to peak system resource contention and stuttering issues, affecting the system's real-time performance and stability.
By obtaining the nominal sending period and time offset tolerance of the message, the actual sending time of the message is dynamically scheduled, and the message sending is optimized by using time slot tasks to avoid resource contention.
Without changing the message scheduling cycle, it effectively smooths system load, avoids resource contention, and improves system real-time performance and stability.
Smart Images

Figure CN121728104A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive communication technology, and more particularly to a message transmission method, electronic device, vehicle, and storage medium. Background Technology
[0002] AUTOSAR (Automotive Open System Architecture) is a widely adopted standard architecture in the field of automotive embedded software. In this architecture, application software components (SW-C) interact with the underlying base software (BSW) through the runtime environment (RTE). The communication module (COM) is a key component of the communication abstraction layer in AUTOSAR, providing basic communication services across different buses, specifically responsible for message assembly and transmission scheduling.
[0003] In related technologies, COM modules typically rely on statically configured transmission timing. During the system design phase, each message or group of messages is assigned a fixed, periodic transmission task (usually triggered by OS timer or counter events). These periods are typically pre-defined based on functional requirements, such as 10ms, 20ms, 50ms, 100ms, etc. However, because message transmission tasks with different periods may be triggered simultaneously at a certain point in time (e.g., 10ms, 20ms, and 100ms tasks expire simultaneously at timestamp t=100ms), a significant communication load peak occurs at that point. A large number of messages need to be processed, assembled, and transmitted at this moment, drastically increasing CPU, memory, and bus bandwidth utilization—a peak load and resource contention. This periodic peak load keeps the CPU under high load for extended periods, potentially preventing other tasks of equal or lower priority from being scheduled in a timely manner. This results in system resource contention peaks and stuttering due to the simultaneous transmission of multiple periodic messages during scheduling.
[0004] Therefore, based on the AUTOSAR architecture, how to dynamically optimize the message sending timing, improve message sending efficiency, smooth system load, avoid peak load and resource contention, and improve system real-time performance and stability are problems that need to be solved. Summary of the Invention
[0005] This application provides a message transmission method, electronic device, vehicle, and storage medium to at least solve the system resource contention peaks and lag problems caused by the simultaneous transmission of multiple periodic messages during scheduling in related technologies based on the AUTOSAR architecture. The technical solution of this application is as follows: According to a first aspect of the embodiments of this application, a message transmission method is provided, including: Obtain the message sending requirements of the message to be sent, wherein the message sending requirements include: message nominal sending period and time offset tolerance; Based on the nominal transmission period of each message and the time offset tolerance, determine the time slot task where the best actual transmission time of the corresponding message is located within the message transmission time window; Each message is scheduled to the time slot task corresponding to the optimal actual sending time; The corresponding message is sent according to the actual sending time of each message in each time slot task.
[0006] Optionally, the method further includes: pre-generating multiple time-slot tasks in the following manner: Obtain the minimum scheduling granularity of the system; Using the minimum scheduling granularity of the system as the time unit, a scheduling period is divided into multiple time slot tasks, and the scheduling period is the least common multiple of the nominal sending periods of all messages.
[0007] Optionally, the task of determining the optimal actual transmission time slot for the corresponding message within the message transmission time window based on the nominal transmission period of each message and the time offset tolerance includes: Based on the nominal transmission period of each message, determine the nominal transmission time of each message to be sent within a scheduling period; Based on the nominal transmission time of each message and the time offset tolerance, determine the message transmission time window for the corresponding message; Centered on the nominal transmission time of each message, within the corresponding message transmission time window, determine the time slot task where the best actual transmission time of the corresponding message is located.
[0008] Optionally, the task of determining the optimal actual transmission time of a corresponding message within the corresponding message transmission time window, centered on the nominal transmission time of each message, includes: Centered on the nominal transmission time of each message, within the corresponding message transmission time window, the time slot task containing the best actual transmission time of the corresponding message is selected according to the scheduling optimization strategy. The time slot task is the time slot task with the lowest load. The scheduling optimization strategy includes at least one of minimizing peak load, minimizing scheduling deviation, and / or scheduling period.
[0009] Optionally, in triggering the transmission of corresponding messages according to the actual transmission time of each message in the time slot task, the method further includes: The system load resources are monitored in real time, including at least one of the following: CPU utilization, communication bus load, running time of each time slot task, and remaining resources. When the monitoring results meet the corresponding load monitoring threshold, the time slot task for re-determining the optimal actual sending time for the message that meets the corresponding load monitoring threshold is set. Messages that meet the corresponding load monitoring threshold will be reassigned to the time slot task where the optimal actual sending time is determined again.
[0010] Optionally, in triggering the transmission of corresponding messages according to the actual transmission time of each message in the time slot task, the method further includes: At least one of the following parameters is detected: driving mode, rescheduling cycle, and scheduling stability parameter; When a driving mode switch is detected, when the rescheduling cycle is optimized, or / and when the scheduling stability parameter is changed, the optimal actual transmission time of the message in the time slot task is rescheduled.
[0011] Optionally, the method further includes: When time slot task conflicts occur during rescheduling and cannot be completely avoided, the corresponding time slot tasks are occupied in order of message priority.
[0012] According to a second aspect of the embodiments of this application, a message sending apparatus is provided, comprising: The acquisition module is used to acquire the message transmission requirements of the message to be sent, which include: the nominal message transmission period and the time offset tolerance; The determination module is used to determine the time slot task where the corresponding message is located within the message transmission time window based on the message nominal transmission period and time offset tolerance of each message. The scheduling module is used to schedule each message to the time slot task where the corresponding optimal actual sending time is determined by the determining module; The trigger module is used to trigger the sending of the corresponding message according to the actual sending time of each message in each time slot task.
[0013] Optionally, the apparatus further includes a generation module for pre-generating multiple time slot tasks.
[0014] Optionally, the generation module includes: The scheduling granularity acquisition module is used to obtain the minimum scheduling granularity of the system; The time slot task generation module is used to divide a scheduling period into multiple time slot tasks using the minimum scheduling granularity of the system as the time unit. The scheduling period is the least common multiple of the nominal sending periods of all messages.
[0015] Optionally, the determining module includes: The first determining module is used to determine the nominal transmission time of each message to be sent within a scheduling period based on the nominal transmission period of each message. The second determining module is used to determine the message transmission time window of the corresponding message based on the nominal transmission time of each message and the time offset tolerance. The third determination module is used to determine the time slot task where the best actual sending time of the corresponding message is located within the corresponding message sending time window, with the nominal sending time of each message as the center.
[0016] Optionally, the third determining module is specifically used to select, within the corresponding message sending time window, the time slot task where the best actual sending time of the corresponding message is located according to the scheduling optimization strategy, with the nominal sending time of each message as the center. The time slot task is the time slot task with the lowest load. The scheduling optimization strategy includes at least one of minimizing peak load, minimizing scheduling deviation, and / or scheduling period.
[0017] Optionally, the device further includes: The monitoring module is used to monitor the system load resources in real time when the triggering module triggers the corresponding message to be sent according to the actual sending time of each message in the time slot task. The load resources include at least one of CPU utilization, communication bus load, running time of each time slot task and remaining resources. The time slot re-determination module is used to re-determine the time slot task where the best actual sending time of the message that meets the corresponding load monitoring threshold is located when the monitoring result meets the corresponding load monitoring threshold. The adjustment module is used to adjust messages that meet the corresponding load monitoring threshold to the time slot task where the optimal actual sending time is determined again.
[0018] Optionally, the device further includes: The detection module is used to detect at least one of the driving mode, rescheduling cycle, and scheduling stability parameters when the triggering module triggers the corresponding message transmission according to the actual transmission time of each message in the time slot task. The rescheduling module is used to reschedule the optimal actual transmission time of the message in the time slot task when the detection module detects a driving mode switch, when the rescheduling cycle is optimized, or / and when the scheduling stability parameter is changed.
[0019] Optionally, the device further includes: The priority scheduling module is used to occupy the corresponding time slot tasks in order of message priority when time slot task conflicts occur during the rescheduling process of the rescheduling module and cannot be completely avoided.
[0020] According to a third aspect of the embodiments of this application, an electronic device is provided, comprising: It includes a processor, a memory; and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the message sending method as described above.
[0021] According to a fourth aspect of the embodiments of this application, a vehicle is provided, including the electronic equipment described above.
[0022] According to a fifth aspect of the embodiments of this application, a readable storage medium is provided, on which a program or instructions are stored, which, when executed by a processor of an electronic device, implement the steps of the message transmission method as described above.
[0023] According to a sixth aspect of the embodiments of this application, a computer program product is provided, including a computer program or instructions, which, when executed by a processor of an electronic device, implement the steps of the message transmission method as described above.
[0024] The technical solutions provided by the embodiments of this application have at least the following beneficial effects: In this embodiment, the message sending requirements of the messages to be sent are obtained. These requirements include: the nominal message sending period and the time offset tolerance. Based on the nominal message sending period and time offset tolerance of each message, the time slot task containing the optimal actual sending time of the corresponding message within the message sending time window is determined. Each message is scheduled to the corresponding time slot task containing the optimal actual sending time. The corresponding message is sent according to the actual sending time of each message in each slot task. In other words, in this embodiment, without changing the message scheduling period, the actual message sending period is dynamically scheduled and optimized based on the nominal message sending period and time offset tolerance, effectively smoothing the system load, avoiding stuttering caused by resource contention, and improving the real-time performance and stability of the system.
[0025] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0026] The accompanying drawings, incorporated in and forming part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. They do not constitute an undue limitation of this application. To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0027] Figure 1 This is a flowchart of a message sending method provided in an embodiment of this application.
[0028] Figure 2 This is a schematic diagram of an adaptive optimization scheduling method for time slot tasks provided in an embodiment of this application.
[0029] Figure 3 This is a schematic diagram illustrating the application of a message sending method provided in an embodiment of this application.
[0030] Figure 4 This is a block diagram of a message sending device provided in an embodiment of this application.
[0031] Figure 5 This is another block diagram of a message sending device provided in the embodiments of this application.
[0032] Figure 6 This is a block diagram of a generation module provided in an embodiment of this application.
[0033] Figure 7 This is a block diagram of a determining module provided in an embodiment of this application.
[0034] Figure 8 This is a block diagram of an electronic device provided in an embodiment of this application.
[0035] Figure 9 This is a block diagram of an apparatus for sending messages provided in an embodiment of this application. Detailed Implementation
[0036] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0037] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0038] Figure 1 This is a flowchart of a message sending method provided in an embodiment of this application, such as... Figure 1 As shown, the message sending method includes the following steps: Step 101: Obtain the sending requirements of the message to be sent, the sending requirements including: message nominal sending period and time offset tolerance.
[0039] Step 102: Based on the nominal transmission period and time offset tolerance of each message, determine the time slot task where the corresponding message is located within the message transmission time window at the optimal actual transmission time.
[0040] Step 103: Schedule each message to the time slot task corresponding to the optimal actual sending time.
[0041] Step 104: Trigger the corresponding message sending according to the actual sending time of each message in each time slot task.
[0042] In this embodiment, without changing the message scheduling period, the actual message sending period is dynamically scheduled and optimized based on the nominal message sending period and time offset tolerance. This effectively smooths the system load, avoids lag caused by resource contention, and improves the real-time performance and stability of the system.
[0043] The message sending method described in this application can be applied to vehicle-side, cloud-side, etc., without limitation. The vehicle-side implementation equipment can be an in-vehicle terminal, vehicle control platform, industrial control computer, or other electronic equipment. The cloud can be an independent server, a server cluster, or a server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, or big data and artificial intelligence platforms, etc., without limitation.
[0044] The following is combined Figure 1This application provides a detailed description of the specific implementation steps of a message sending method provided in an embodiment. This embodiment takes the dynamic scheduling and optimization of the message sending cycle that needs to be sent under the AUTOSAR architecture as an example.
[0045] In step 101, the message sending requirements of the message to be sent are obtained, and the message sending requirements include: message nominal sending period and time offset tolerance.
[0046] In this step, upon system startup, the transmission requirements for the messages to be sent are obtained. This involves reading the pre-configured transmission requirements for the messages to be sent. These requirements may include, but are not limited to, the nominal transmission period (T_nominal), time offset tolerance (T_tolerance), and, of course, parameters such as the message identifier ID. The time offset tolerance can be the minimum transmission interval (T_min), typically determined by functional safety or network performance requirements. Alternatively, the time offset tolerance can also be determined with reference to parameters such as the message ID, message priority, importance, service relationship, and functional requirements.
[0047] It should be noted that message priority can be determined based on message ID; the smaller the message ID, the higher the message priority, and vice versa. Of course, this is only one way to determine message priority; other methods (such as subjectively setting priority) or a combination of other methods can also be used, and this embodiment does not impose any restrictions.
[0048] In this embodiment, a maximum time range within which the actual transmission time of a message can be earlier or later than its nominal transmission period is defined based on the time offset tolerance (T_tolerance). The nominal transmission period is the ideal transmission period required by the message function, such as 10ms or 100ms. This is the original requirement of the function and serves as the benchmark for optimization.
[0049] In other words, in this embodiment, the nominal transmission period T_nominal and the time offset tolerance T_tolerance (or T_min) of the read message are the foundation for implementing this application embodiment. Without the offset tolerance, there is no room for optimization. The time offset tolerance (T_tolerance) defines the maximum allowable range (± T_tolerance) that the actual transmission time of a message can deviate from its nominal transmission time (k * T_nominal). It is usually determined by functional safety or network performance requirements. For example, for a message with a 100ms period, if T_tolerance = ±10ms, then its actual transmission time must be within the message transmission window of [90ms, 110ms]. That is, taking the nominal transmission time of each message as the center, within the corresponding message transmission time window, the time slot task where the best actual transmission time of the corresponding message is located is determined, that is, the time slot task with the lowest load. This provides operational space for dynamic scheduling while ensuring the correctness of the function.
[0050] In this embodiment, the minimum transmission interval (T_min) can be used as an alternative or supplementary parameter to T_tolerance. It specifies the minimum time interval that must be satisfied between two identical frames of messages, typically T_min = T_nominal - 2 * T_tolerance. By setting this parameter, the scheduler can be prevented from scheduling two transmissions of the same message too close together.
[0051] In step 102, based on the nominal transmission period of each message and the time offset tolerance, the time slot task in which the best actual transmission time of the corresponding message is located within the message transmission time window is determined.
[0052] In this step, firstly, based on the nominal transmission period of each message, all nominal transmission times (t_nominal) of each message to be sent within a scheduling period are determined. The scheduling period is the least common multiple of the nominal transmission periods of all messages.
[0053] In this step, for each message to be sent, calculate all nominal transmission times (t_nominal) within a least common multiple (LCM) period. The formula for calculating all nominal transmission times is as follows: t_nominal = k * T_nominal, k=0,1,2,....
[0054] Where T_nominal represents the nominal sending period of the message, and k represents the number of messages.
[0055] Secondly, based on the nominal transmission time and time offset tolerance of each message, the message transmission time window for the corresponding message is determined.
[0056] In this step, the corresponding time offset tolerance is added to or subtracted from each nominal transmission time to obtain the corresponding message transmission time window (also called the message transmission time window, within which a message can be transmitted at any time), i.e., [t_nominal - T_tolerance, t_nominal + T_tolerance], where t_nominal represents the nominal transmission time of each message, and T_tolerance represents the time offset tolerance of each message transmission. Of course, the corresponding message transmission time window can also be [t_nominal - T_min, t_nominal + T_min], etc.
[0057] Finally, taking the nominal transmission time of each message as the center, within the corresponding message transmission time window, determine the time slot task where the best actual transmission time of the corresponding message is located.
[0058] In this step, for each packet's nominal transmission time, within the packet transmission time window of [t_nominal - T_tolerance(T_min), t_nominal + T_tolerance(T_min)], the optimal actual transmission time (t_actual) for the corresponding packet is determined. This involves finding the optimal time slot for the packet's actual transmission time (t_actual), with the goal of avoiding time slots already occupied by high-priority packets or a large number of packets, and selecting the time slot with the lowest estimated system load.
[0059] In one embodiment, taking the nominal transmission time of each message as the center, within the corresponding message transmission time window, the time slot task containing the optimal actual transmission time of the corresponding message is determined, including: Centered on the nominal transmission time of each message, within the corresponding message transmission time window, the time slot task containing the best actual transmission time of the corresponding message is selected according to the scheduling optimization strategy. The time slot task is the time slot task with the lowest load. The scheduling optimization strategy may include at least one of minimizing peak load, minimizing scheduling deviation, and / or scheduling cycle. Of course, in practical applications, the scheduling optimization strategy is not limited to this for different situations.
[0060] Minimizing peak load aims to ensure the most even distribution of packets to be sent within each time slot. Minimizing scheduling bias prioritizes the time closest to t_nominal while meeting load requirements, i.e., minimizing |t_actual - t_nominal|. The scheduling period is typically the least common multiple (LCM) of all nominal sending periods T_nominal. Within this period, the sending pattern of all packets repeats once, so only the scheduling table for one LCM period needs to be calculated.
[0061] In step 103, each message is scheduled to the time slot task corresponding to the optimal actual sending time.
[0062] In this step, the main function (Com_Mainfunction_Tx) for the sending cycle of each message to be sent is scheduled into the time slot task where the optimal actual sending time for each message is located, according to the deployment method of different cycles. Specifically, as follows... Figure 2 The diagram shown is a schematic representation of an adaptive optimization scheduling method for time slot tasks provided in an embodiment of this application. This scheduling method uses task scheduling under the AUTOSAR architecture as an example, but in practical applications, it is not limited to this.
[0063] like Figure 2 As shown, the least common multiple (LCM) of the nominal periods of all messages is taken as 50ms, which is one scheduling period. In this embodiment, the minimum scheduling granularity (T_granularity) is taken as 5ms. Using a minimum scheduling granularity of 5ms as the time unit, a scheduling period of 50ms is divided into 10 time slot tasks. Then, according to the time slot task where the optimal actual sending time of each message is located, the message to be sent is deployed to these 10 time slot tasks. For example, consider five messages to be sent: a 5ms message, a 10ms message, a 20ms message, a 50ms message, and a 100ms message. It should be noted that 5ms, 10ms, 20ms, 50ms, and 100ms are the nominal transmission periods for each message. Based on the nominal transmission period of each message and the time offset tolerance, the actual transmission time slot for each message is calculated. For instance, if the calculation determines that the 10ms message is in time slots 0-5ms and 5-10ms, then the 10ms message to be sent is split into two segments: message a and message b. Message a is scheduled to the 0-5ms timestamp task, and message b is scheduled to the 5-10ms time slot task. After scheduling, the corresponding message is sent according to its actual transmission time within each time slot task. Other time slot tasks are as follows... Figure 2 As shown, they will not be elaborated upon here.
[0064] Among them, multiple time slot tasks are pre-generated, and the generation method includes: obtaining the system minimum scheduling granularity (T_granularity); using the system minimum scheduling granularity as the time element, dividing a scheduling period into multiple time slot tasks, wherein the scheduling period is the least common multiple of the nominal sending periods of all messages.
[0065] In other words, using the smallest scheduling granularity of the system as the time unit, a complete scheduling cycle (such as the least common multiple period LCM) based on the nominal period of all messages is divided into multiple time slot tasks.
[0066] The minimum scheduling granularity (T_granularity) refers to the basic time unit (e.g., 1ms) for the system to perform scheduling calculations and allocations. The optimal actual transmission time (t_actual) for all packets is an integer multiple of the system's minimum scheduling granularity T_granularity. It determines the fineness of the scheduling; the smaller the granularity, the greater the optimization potential, but the greater the computational overhead.
[0067] The scheduling period typically refers to the least common multiple (LCM) of all nominal transmission periods (T_nominal). Within this scheduling period, the transmission pattern of all messages will repeat once; therefore, it is only necessary to calculate the scheduling table for one LCM period.
[0068] In step 104, the corresponding message is sent according to the actual sending time of each message in each time slot task.
[0069] This step controls message sending by counting the actual sending time of each message in the time slot task.
[0070] In this embodiment, the message sending requirements of the messages to be sent are obtained. These requirements include: the nominal message sending period and the time offset tolerance. Based on the nominal message sending period and time offset tolerance of each message, the time slot task containing the optimal actual sending time of the corresponding message within the message sending time window is determined. Each message is scheduled to the corresponding time slot task containing the optimal actual sending time. The corresponding message is sent according to the actual sending time of each message in each time slot task. In other words, in this embodiment, without changing the message scheduling period, the actual message sending period is dynamically scheduled and optimized based on the nominal message sending period and time offset tolerance, effectively smoothing the system load, avoiding lag caused by resource contention, and improving the system's real-time performance and stability.
[0071] Optionally, in another embodiment, based on the above embodiment, in triggering the transmission of corresponding messages according to the actual transmission time of each message in the time slot task, the method may further include: real-time monitoring of the system's load resources, the load resources including at least one of CPU utilization, communication bus load, running time of each time slot task, and remaining resources; when the monitoring result meets (e.g., greater than or equal to) a set time period of the corresponding load monitoring threshold, re-determining the time slot task in which the message that meets the corresponding load monitoring threshold is located; and adjusting the message that meets the corresponding load monitoring threshold to the time slot task in which the re-determined optimal actual transmission time is located.
[0072] In this embodiment, the system load is monitored and controlled. When the detection result meets the corresponding load monitoring threshold, dynamic rescheduling is triggered. For example, in this embodiment, the CPU load monitoring threshold can be 85% (of course, it can also be set to other values; this embodiment does not limit it, and others are similar). That is, when the CPU utilization (CPU_Usage) in the monitoring result is >85% and continues for a period of time, dynamic rescheduling is triggered; or when Bus_Load is >60% (60% is taken as an example, but it is not limited to this in actual applications) and continues for a period of time, dynamic rescheduling is triggered; or when the remaining resources (T_granularity - T_cost < 200us) are sufficient, dynamic rescheduling is triggered. This embodiment uses 200us as an example, but it is not limited to this in actual applications. It should be noted that the remaining resources are the load monitoring mechanism itself, but the specific threshold is preferred and can be adjusted according to different platforms and projects. This embodiment does not limit the specific threshold.
[0073] In this embodiment, dynamic rescheduling during runtime is an advanced and preferred feature that enables the system to adapt to unexpected runtime state changes, further enhancing the robustness and superiority of the solution.
[0074] For complex optimization objectives (such as minimizing peak load), the simplest scheduling algorithm might be to "find an idle time slot within the offset tolerance window." However, employing more complex optimization objectives is preferable because it yields better scheduling results and further improves system performance.
[0075] Priority-based conflict resolution strategy: Under extreme system load conditions, this strategy ensures that critical functions are not affected, making it the preferred strategy for improving the functional safety level of the solution. In this embodiment of the application, by monitoring and controlling the system load, the originally concentrated sending times are distributed into an allowed message sending time window, which effectively avoids the resource contention peak caused by multiple message sending tasks being triggered at the same time, thereby reducing the peak load of the CPU and bus and greatly reducing the risk of system lag.
[0076] Optionally, in another embodiment, based on the above embodiment, the method further includes: detecting at least one of driving mode, rescheduling period, and scheduling stability parameter when triggering corresponding message transmission according to the actual transmission time of each message in the time slot task; and rescheduling the optimal actual transmission time of the messages in the time slot task when a driving mode switch is detected, when the rescheduling period is optimized, or / and when the scheduling stability parameter transmission changes. Wherein, if a time slot task conflict occurs during rescheduling and cannot be completely avoided, the corresponding transmission time is occupied sequentially according to the message priority.
[0077] Message Priority: When scheduling conflicts cannot be completely avoided (i.e., no completely free time slots can be found within the offset tolerance window), higher-priority messages have the right to occupy their preferred transmission time. Priorities can be statically configured based on the message's functional safety level (ASIL) or importance.
[0078] In this embodiment of the application, the re-scheduling trigger condition can satisfy not only the load monitoring threshold, but also other trigger conditions, such as: Event triggering: When the BswM management module detects a driving mode switch (such as switching from Normal mode to Sport mode), it actively triggers rescheduling to adapt to the new load profile.
[0079] Periodic triggering: Perform a lightweight rescheduling optimization periodically (e.g., every 10 seconds).
[0080] Stability parameter: A parameter introduced to prevent excessively frequent scheduling changes ("jitter"). For example, setting a minimum rescheduling interval ensures that there is at least a certain time interval between two global reschedulings to guarantee system stability.
[0081] In this embodiment of the application, the time slot task for message transmission can be dynamically adjusted during system operation, which can respond to changes in system state and increase the flexibility and robustness of message transmission.
[0082] In this embodiment, adjustments are made while satisfying all message time offset tolerances, ensuring that the real-time requirements of message transmission are not compromised, guaranteeing functional safety and real-time performance, and meeting the timing determinism requirements of automotive functional safety standards.
[0083] Please also see Figure 3 This is a schematic diagram illustrating an application of a message sending method provided in an embodiment of this application. If Figure 3As shown, this embodiment uses four steps—initial configuration, dynamic scheduling table generation, message sending, and performance set resource monitoring—as an example for illustration.
[0084] 1) Initialization configuration: 11) Statistically analyze the nominal message sending period and time offset tolerance of the messages that need to be sent, and calculate the message sending time window for each message based on the statistical results. The specific calculation process is detailed above and will not be repeated here.
[0085] 12) System minimum scheduling granularity confirmation, i.e., defining a minimum scheduling granularity (T_granularity) for the system, such as setting it to 1ms or 5ms. The sending scheduling period of all packets will be planned based on this minimum granularity. Using the system's minimum scheduling granularity as the time unit, the system will divide the packets into multiple time slot tasks according to the least common multiple (LCM) of the nominal periods of all packets.
[0086] 13) Periodic task load estimation. The estimation method is a well-known technology to those skilled in the art, and will not be described in detail here.
[0087] 2) Dynamic scheduling table generation 21) Dynamic allocation of message sending time slot tasks.
[0088] 22) Nominal transmission time calculation: Based on the nominal transmission period of each message to be transmitted, calculate all nominal transmission times t_nominal of the corresponding message within one LCM period, where t_nominal = k * nominal transmission period T_nominal, k=0,1,2,... 23) Calculation of Actual Transmission Time: For each nominal transmission time, within the packet transmission time window of [each nominal transmission time t_nominal - time offset tolerance T_tolerance, t_nominal + T_tolerance], find an optimal actual transmission time (t_actual). The goal is to avoid time slots already occupied by high-priority packets or a large number of packets, and select the time slot with the lowest estimated current system load. The specific process is detailed above and will not be repeated here.
[0089] 24) Periodic message triggering: According to the optimal actual sending time (t_actual) of each message, the sending periodic main function (Com_Mainfunction_Tx) of the corresponding message is adjusted to be deployed on all time slot tasks according to the deployment method of different periodic message triggering.
[0090] 3) Message sending: The corresponding message sending is triggered according to the actual sending time of each message in each time slot task. That is, the message sending in each time slot task is uniformly controlled by counting the number of nominal sending times.
[0091] 4) Monitor performance and resources, and make dynamic adjustments during runtime.
[0092] In this embodiment, the operating system (OS) scheduler no longer triggers message sending tasks directly at fixed intervals, but instead triggers them based on a dynamically adjusted scheduling table.
[0093] In this embodiment, a load detection module can be pre-created to monitor CPU utilization, communication bus load, runtime (T_cost) of each time slot task resource, message cycle, and remaining resources (T_granularity - T_cost) in real time or periodically. In practical applications, it is not limited to this.
[0094] When the monitoring module detects that the system load is consistently high at a certain frequency, or that the runtime has overflowed, or that the remaining resources are insufficient, it re-executes step two to dynamically reallocate the actual sending time (t_actual) of the packets and migrates the sending time of some packets from the high-load time slot task (insufficient remaining resources) to the low-load time slot task (sufficient remaining resources).
[0095] The message sending task is triggered and executed when its optimal actual sending time t_actual is reached, thus completing the message transmission. In this embodiment, since the optimal actual sending time t_actual of the message is always within the range of t_nominal ± T_tolerance, the scheduling periodicity of the message is maintained for the receiver, and it will not affect the periodic communication protocol and functional logic.
[0096] In this embodiment, a centralized and intelligent scheduler is implemented. This scheduler has a global view and proactively and systematically arranges the optimal departure time for each task within the legal boundaries (time offset tolerance T_tolerance) defined by functional safety, thereby avoiding them from "traffic jams" on the road.
[0097] This application proposes a key parameter, time offset tolerance, providing a legitimate and safe operational space for dynamic scheduling. This application transforms offline manual optimization into online automatic optimization, using algorithms to globally and systematically address peak load issues. This application endows the AUTOSAR communication system with the ability to dynamically schedule during runtime, making it a self-optimizing intelligent system.
[0098] In this embodiment, by optimizing the underlying scheduling mechanism under the AUTOSAR architecture, it is easy to integrate and deploy in existing projects without affecting the upper-layer application software components (SW-C) and RTE interface, thus improving the practicality of message sending.
[0099] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to this application.
[0100] Please also see Figure 4 This is a block diagram of a message sending device provided in an embodiment of this application. The device includes: an acquisition module 401, a determination module 402, a deployment module 403, and a triggering module 404, wherein... The acquisition module 401 is used to acquire the message sending requirements of the message to be sent, wherein the message sending requirements include: the nominal message sending period and the time offset tolerance; The determination module 402 is used to determine the time slot task where the best actual sending time of the corresponding message is located within the message sending time window, based on the message nominal sending period of each message and the time offset tolerance. The scheduling module 403 is used to schedule each message to the time slot task where the optimal actual sending time is determined by the determining module; Trigger module 404 is used to trigger the sending of the corresponding message according to the actual sending time of each message in each time slot task.
[0101] Optionally, in another embodiment, based on the above embodiments, the device further includes: a generation module 501, the structural block diagram of which is shown below. Figure 5 As shown, the generation module 501 is used to pre-generate multiple time slot tasks.
[0102] The generation module 501 includes a scheduling granularity acquisition module 601 and a time slot task generation module 602, the structural block diagram of which is shown below. Figure 6 As shown, where, The scheduling granularity acquisition module 601 is used to obtain the minimum scheduling granularity of the system. The time slot task generation module 602 is used to divide a scheduling period into multiple time slot tasks using the minimum scheduling granularity of the system as the time unit. The scheduling period is the least common multiple of the nominal sending periods of all messages.
[0103] Optionally, in another embodiment, based on the above embodiment, the determining module 402 includes: a first determining module 701, a second determining module 702, and a third determining module 703, the structural block diagram of which is shown below. Figure 7 As shown, The first determining module 701 is used to determine the nominal transmission time of each message to be sent within a scheduling period based on the nominal transmission period of each message. The second determining module 702 is used to determine the message transmission time window of the corresponding message based on the nominal transmission time of each message and the time offset tolerance. The third determining module 703 is used to determine the time slot task where the best actual sending time of the corresponding message is located within the corresponding message sending time window, with the nominal sending time of each message as the center.
[0104] Optionally, in another embodiment, based on the above embodiment, the third determining module is specifically used to select the time slot task where the best actual sending time of the corresponding message is located within the corresponding message sending time window, taking the nominal sending time of each message as the center, according to the scheduling optimization strategy. The time slot task is the time slot task with the lowest load. The scheduling optimization strategy includes at least one of minimizing peak load, minimizing scheduling deviation, and / or scheduling period.
[0105] Optionally, in another embodiment, based on the above embodiments, the apparatus further includes: The monitoring module is used to monitor the system load resources in real time when the triggering module triggers the corresponding message to be sent according to the actual sending time of each message in the time slot task. The load resources include at least one of CPU utilization, communication bus load, running time of each time slot task and remaining resources. The time slot re-determination module is used to re-determine the time slot task where the best actual sending time of the message that meets the corresponding load monitoring threshold is located when the monitoring result meets the corresponding load monitoring threshold. The adjustment module is used to adjust messages that meet the corresponding load monitoring threshold to the time slot task where the optimal actual sending time is determined again.
[0106] Optionally, in another embodiment, based on the above embodiments, the apparatus further includes: The detection module is used to detect at least one of the driving mode, rescheduling cycle, and scheduling stability parameters when the triggering module triggers the corresponding message transmission according to the actual transmission time of each message in the time slot task. The rescheduling module is used to reschedule the optimal actual transmission time of the message in the time slot task when the detection module detects a driving mode switch, when the rescheduling cycle is optimized, or / and when the scheduling stability parameter is changed.
[0107] Optionally, in another embodiment, based on the above embodiments, the apparatus further includes: The priority scheduling module is used to occupy the corresponding time slot tasks in order of message priority when time slot task conflicts occur during the rescheduling process of the rescheduling module and cannot be completely avoided.
[0108] Optionally, embodiments of this application also provide an electronic device, including: It includes a processor, a memory; and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the message sending method as described above.
[0109] Optionally, embodiments of this application also provide a readable storage medium storing a program or instructions, which, when executed by a processor of an electronic device, implement the steps of the message transmission method described above.
[0110] Optionally, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor of an electronic device, implement the steps of the message transmission method described above.
[0111] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0112] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0113] Please also see Figure 8 This is a block diagram of an electronic device 800 provided in an embodiment of this application. For example, the electronic device 800 can be a vehicle-mounted terminal or a server; in this embodiment, a vehicle-mounted terminal is used as an example for explanation. For example, the electronic device 800 can be a vehicle-mounted system, an in-vehicle terminal, a message transceiver device, etc.
[0114] Reference Figure 8 The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0115] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0116] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0117] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.
[0118] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0119] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0120] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0121] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0122] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0123] In the embodiments, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the various processes of the message transmission method embodiments shown above and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0124] In this embodiment, a readable storage medium is also provided, on which a program or instruction is stored. When executed by a processor of a processing electronic device, the program or instruction implements the steps of the message transmission method described above. The readable storage medium includes a computer-readable storage medium, such as a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.
[0125] In this embodiment, a computer program product is also provided, including a computer program or instructions. When the computer program or instructions are executed by the processor 820 of the electronic device 800, the electronic device 800 performs the various processes of the above-described message sending method embodiment and achieves the same technical effect. To avoid repetition, these will not be described again here.
[0126] In one embodiment, a vehicle is also provided, the vehicle including electronic devices as shown above, which will not be described again here.
[0127] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0128] Figure 9 This is a block diagram of an apparatus 900 for message transmission provided in an embodiment of this application. For example, apparatus 900 can be provided as a server. (See also...) Figure 9 The apparatus 900 includes a processing component 922, which further includes one or more processors, and memory resources represented by memory 932 for storing instructions, such as application programs, that can be executed by the processing component 922. The application programs stored in memory 932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 922 is configured to execute instructions to perform the methods described above.
[0129] Device 900 may also include a power supply component 926 configured to perform power management of device 900, a wired or wireless network interface 950 configured to connect device 900 to a network, and an input / output (I / O) interface 958. Device 900 may operate on an operating system stored in memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0131] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A message sending method, characterized in that, include: Obtain the message sending requirements of the message to be sent, wherein the message sending requirements include: message nominal sending period and time offset tolerance; Based on the nominal transmission period of each message and the time offset tolerance, determine the time slot task where the best actual transmission time of the corresponding message is located within the message transmission time window; Each message is scheduled to the time slot task corresponding to the optimal actual sending time; The corresponding message is sent according to the actual sending time of each message in each time slot task.
2. The message sending method according to claim 1, characterized in that, The method further includes: pre-generating multiple time-slot tasks in the following manner: Obtain the minimum scheduling granularity of the system; Using the minimum scheduling granularity of the system as the time unit, a scheduling period is divided into multiple time slot tasks, and the scheduling period is the least common multiple of the nominal sending periods of all messages.
3. The message sending method according to claim 1, characterized in that, The task of determining the optimal actual transmission time of a corresponding message within the message transmission time window, based on the message's nominal transmission period and time offset tolerance, includes: Based on the nominal transmission period of each message, determine the nominal transmission time of each message to be sent within a scheduling period; Based on the nominal transmission time of each message and the time offset tolerance, determine the message transmission time window for the corresponding message; Centered on the nominal transmission time of each message, within the corresponding message transmission time window, determine the time slot task where the best actual transmission time of the corresponding message is located.
4. The message sending method according to claim 3, characterized in that, The task of determining the optimal actual transmission time of a corresponding message within its corresponding transmission time window, centered on the nominal transmission time of each message, includes: Centered on the nominal transmission time of each message, within the corresponding message transmission time window, the time slot task containing the best actual transmission time of the corresponding message is selected according to the scheduling optimization strategy. The time slot task is the time slot task with the lowest load. The scheduling optimization strategy includes at least one of minimizing peak load, minimizing scheduling deviation, and / or scheduling period.
5. The message transmission method according to any one of claims 1 to 4, characterized in that, In triggering the transmission of corresponding messages according to the actual transmission time of each message in the time slot task, the method further includes: The system load resources are monitored in real time, including at least one of the following: CPU utilization, communication bus load, running time of each time slot task, and remaining resources. When the monitoring results meet the corresponding load monitoring threshold, the time slot task where the best actual sending time is located is re-determined for the message that meets the corresponding load monitoring threshold. Messages that meet the corresponding load monitoring threshold will be reassigned to the time slot task where the optimal actual sending time is determined again.
6. The message transmission method according to any one of claims 1 to 4, characterized in that, In triggering the transmission of corresponding messages according to the actual transmission time of each message in the time slot task, the method further includes: At least one of the following parameters is detected: driving mode, rescheduling cycle, and scheduling stability parameter; When a driving mode switch is detected, when the rescheduling cycle is optimized, or / and when the scheduling stability parameter is changed, the optimal actual transmission time of the message in the time slot task is rescheduled.
7. The message sending method according to claim 6, characterized in that, The method further includes: When time slot task conflicts occur during rescheduling and cannot be completely avoided, the corresponding time slot tasks are occupied in order of message priority.
8. An electronic device, characterized in that, include: Including processor and memory; And a program or instructions stored on the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the message transmission method as described in any one of claims 1 to 7.
9. A vehicle, characterized in that, Including the electronic device as described in claim 8.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor of an electronic device, implement the steps of the message transmission method as described in any one of claims 1 to 7.