An automated testing system and method for the CAN communication protocol of a ship mobile energy storage system.
By building a protocol parsing model and generating test configuration files through an automated testing system, test case sequences covering normal, boundary, and abnormal scenarios are automatically generated. This solves the problem of verifying the consistency of equipment communication protocols in ship mobile energy storage systems and achieves efficient protocol testing and accurate energy interaction.
Patent Information
- Application Number
- CN202511549145.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-10-28
AI Technical Summary
Existing technologies struggle to efficiently verify the consistency of communication protocols in shipboard mobile energy storage systems, leading to issues such as data transmission packet loss and control command delays.
An automated testing system is adopted to automatically generate test case sequences covering normal, boundary, and abnormal scenarios by constructing a protocol parsing model and generating test configuration files. Combined with communication timing requirements, a time-series simulated message stream is generated, and the system interacts with the device under test through a CAN communication card to collect power feedback data in real time and construct a protocol compliance evaluation matrix.
It achieves protocol testing covering all scenarios, discovers timing-related vulnerabilities that are difficult to detect in traditional modes, ensures the stability of communication links and the accuracy of energy interaction, and improves testing efficiency and accuracy.
Smart Images

Figure CN121037276B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication testing technology, and more specifically, to an automated testing system and method for the CAN communication protocol of a ship mobile energy storage system. Background Technology
[0002] In recent years, with the accelerated electrification of ships and the widespread application of mobile energy storage systems in emergency power supply and load peak shaving on ships, core components (such as BMS, energy storage inverters, EMS, and DC-DC converters) in energy storage systems on mobile platforms such as ships, RVs, and trucks mainly rely on the Controller Area Network (CAN) bus for real-time information exchange and coordinated control. The system operation depends on strict communication protocol consistency. Furthermore, the CAN communication protocol, as the core data link connecting various nodes of the energy storage system (such as BMS, energy storage inverters, EMS, and DC-DC converters), directly affects the operational safety and energy dispatch efficiency of the energy storage system due to its communication stability and command response accuracy. Currently, the standard practice for verifying the communication protocol consistency between a device (such as a newly developed energy storage inverter or BMS) and other devices is to build a complete energy storage system platform using all real physical components. However, traditional methods relying on manually written test cases and manual message sending are insufficient to cover protocol boundary scenarios and abnormal operating conditions, and cannot efficiently verify the coordination of communication timing and power interaction. This can easily lead to undiscovered protocol vulnerabilities, resulting in data transmission packet loss and control command delays. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides an automated testing system for the CAN communication protocol of a ship mobile energy storage system, comprising the following modules:
[0004] The protocol modeling and test configuration module is used to obtain the CAN communication protocol specification and the parameters of the device under test for the ship mobile energy storage system; it constructs a protocol parsing model based on the CAN communication protocol specification, generates a test configuration file according to the parameters of the device under test, and performs format verification and logical consistency verification on the protocol parsing model and the test configuration file to obtain a standardized protocol model and an executable test configuration set.
[0005] The simulation node behavior module is used to construct the corresponding node behavior logic model based on the executable test configuration set; automatically generate a test case sequence covering the normal range, boundary values and abnormal values of the signal based on the node behavior logic model and the executable test configuration set, and dynamically calculate the real-time value of each signal according to the test case sequence; encapsulate the real-time value into a simulated CAN message according to the standardized protocol model, and control the message sending timing according to the communication timing requirements to generate a time-sequential simulated message stream;
[0006] The CAN bus interaction and power closed-loop module is used to send a timed analog message stream to the device under test (DUT) via the CAN communication card and receive the response messages returned by the DUT in real time; it parses the response messages to extract the status signals and control commands of the DUT; it adjusts the working mode and output parameters of the programmable power source based on the status signals and control commands, so that the programmable power source simulates the energy interaction behavior of a ship's mobile energy storage system; and it collects the actual output data of the programmable power source to form a power feedback dataset.
[0007] The test analysis and result evaluation module compares the status signals and control commands extracted from the response messages with the expected values in the test case sequence to obtain the signal consistency deviation; calculates the power execution error based on the power feedback dataset and the power parameters in the control commands; constructs a protocol compliance evaluation matrix by combining the signal consistency deviation and the power execution error, including the pass status, deviation value, and error level of each test case; and generates a visual test report based on the protocol compliance evaluation matrix, including test coverage statistics, key indicator trend charts, and detailed analysis of anomalies.
[0008] Furthermore, the present invention also provides an automated testing method for the CAN communication protocol of a ship mobile energy storage system. This method is implemented based on the automated testing system for the CAN communication protocol of a ship mobile energy storage system described above. The automated testing method for the CAN communication protocol of a ship mobile energy storage system includes the following steps:
[0009] S01: Obtain the CAN communication protocol specification of the ship mobile energy storage system and the parameters of the device under test, construct the protocol parsing model and generate the test configuration file, and obtain the standardized protocol model and executable test configuration set after verification;
[0010] S02: Based on the executable test configuration set, build a node behavior logic model, generate a test case sequence covering various signal values, calculate real-time signal values and encapsulate them into a time-series simulated message stream;
[0011] S03: Send the time-series analog message stream to the device under test, receive and parse the response message to extract status signals and control commands, adjust the programmable power source to simulate energy interaction, and collect actual output data to form a power feedback dataset.
[0012] S04: Compare the response message with the expected value to obtain the signal consistency deviation, calculate the power execution error, construct the protocol compliance evaluation matrix, and generate a visual test report containing test results and analysis.
[0013] The beneficial effects of this application are as follows: By constructing a standardized protocol parsing model based on the CAN communication protocol specification, the consistency of protocol interpretation is ensured, avoiding subjective errors caused by manual interpretation; after generating test configuration files based on the parameters of the device under test, executable test configuration sets are selected through format verification and logical consistency verification. This standardization and verification mechanism not only unifies the standards for protocol parsing and test configuration, but also eliminates configuration logic errors in advance, avoiding the failure of subsequent test cases or abnormal message simulation due to non-standard basic data, thus ensuring the accuracy of testing from the source and solving the core problem of non-standard protocol parsing and configuration in the traditional mode. Secondly, by constructing a node behavior logic model based on an executable test configuration set, test case sequences covering normal, boundary, and abnormal scenarios are automatically generated to ensure no test blind spots. At the same time, real-time signal values are dynamically calculated and simulated CAN messages are encapsulated according to standardized protocol models. The timing of transmission is controlled in combination with communication timing requirements to generate a time-series simulated message stream (such as the message transmission interval in high-concurrency scenarios and the insertion timing of sudden abnormal signals). This automated, full-scenario-coverage message generation method avoids the tediousness and omissions of manually writing test cases and can accurately simulate complex communication timing scenarios in ship mobile energy storage systems. It effectively discovers timing-related protocol vulnerabilities that are difficult to detect in traditional modes, and solves the problems of incomplete test coverage and missing timing simulation. Then, a CAN communication card is used to achieve real-time interaction between the simulated message stream and the device under test, ensuring the true simulation of the communication link. At the same time, based on the status signals and control commands returned by the device under test, the working mode and output parameters of the programmable power source are dynamically adjusted to simulate the energy interaction behavior in the ship's mobile energy storage system. The actual output data of the power source is collected to form a power feedback dataset, and the correlation between "communication protocol and power control" is established. This design of communication and power collaborative testing breaks the limitations of the traditional "communication and power separation testing" mode, can accurately discover the vulnerabilities of the protocol in the energy interaction scenario, and ensure that the protocol can meet the data transmission requirements and support the actual energy interaction needs. Finally, by comparing the response message signal with the expected value of the test case, the signal consistency deviation is calculated. Combined with the power feedback dataset and the power parameters of the control command, the power execution error is calculated. A protocol compliance evaluation matrix is constructed from two dimensions to quantitatively evaluate the pass status, deviation value, and error level of each test case. At the same time, a visual test report is generated that includes test coverage, key indicator trend charts, and detailed analysis of anomalies. This multi-dimensional quantitative analysis and visualization method avoids the subjectivity and one-sidedness of manual analysis and allows testers to quickly grasp the core issues of protocol consistency problems, thereby significantly improving testing efficiency. Attached Figure Description
[0014] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0015] Figure 1 This is a schematic diagram of the automated testing system for the CAN communication protocol of the ship mobile energy storage system in this embodiment;
[0016] Figure 2 This is a schematic diagram of the process framework in this embodiment, showing the inverter as a communication node.
[0017] Figure 3 This is a schematic diagram of the process framework for the battery system BMS as a communication node in this embodiment. Detailed Implementation
[0018] The following drawings disclose several embodiments of the present invention. For clarity, many practical details will be described in the following description. However, it should be understood that these practical details are not intended to limit the invention. That is, in some embodiments of the invention, these practical details are not essential. Furthermore, for the sake of simplicity, some conventional structures and components will be shown in the drawings in a simple schematic manner.
[0019] To further understand the invention's content, features, and effects, the following embodiments are provided, and detailed descriptions are given below in conjunction with the accompanying drawings:
[0020] Reference Figure 1 , Figure 1 This is a schematic diagram of the automated testing system for the CAN communication protocol of the ship's mobile energy storage system in this embodiment. The automated testing system for the CAN communication protocol of the ship's mobile energy storage system in this embodiment includes the following modules:
[0021] The protocol modeling and test configuration module is used to obtain the CAN communication protocol specification and the parameters of the device under test for the ship mobile energy storage system; it constructs a protocol parsing model based on the CAN communication protocol specification, generates a test configuration file according to the parameters of the device under test, and performs format verification and logical consistency verification on the protocol parsing model and the test configuration file to obtain a standardized protocol model and an executable test configuration set.
[0022] In this embodiment of the invention, the CAN communication protocol specification of the ship's mobile energy storage system (including frame ID definition, signal bit allocation, etc.) and the parameters of the device under test (inverter) (such as rated voltage 600V, rated current 200A, etc.) are obtained. In MATLAB or Simulink, a protocol parsing model is constructed based on the CAN communication protocol specification to parse the data fields of each frame ID (such as BMS message frame ID 0x100 containing voltage, current, SOC, etc.). A test configuration file is generated according to the inverter parameters, setting the signal value range (voltage 500-600V, current -200-200A, etc.). The protocol parsing model and test configuration file are then subjected to format verification (checking frame ID uniqueness and non-overlapping signal bits) and logical consistency verification (such as the maximum voltage signal value not exceeding the inverter's rated voltage) to obtain a standardized protocol model and an executable test configuration set.
[0023] The simulation node behavior module is used to construct the corresponding node behavior logic model based on the executable test configuration set; automatically generate a test case sequence covering the normal range, boundary values and abnormal values of the signal based on the node behavior logic model and the executable test configuration set, and dynamically calculate the real-time value of each signal according to the test case sequence; encapsulate the real-time value into a simulated CAN message according to the standardized protocol model, and control the message sending timing according to the communication timing requirements to generate a time-sequential simulated message stream;
[0024] In this embodiment of the invention, a node behavior logic model of the battery system (BMS) is constructed in MATLAB or Simulink based on an executable test configuration set. This model includes initialization (SOC 50%, voltage 550V), operation (SOC changes with charging and discharging), and fault (overvoltage and overcurrent triggering) states. Based on this model and the executable test configuration set, a sequence of test cases is automatically generated, covering normal voltage range (550V), boundary values (500V, 600V), and abnormal values (610V); normal current range (100A), boundary values (-200A, 200A), and abnormal values (210A). Real-time values of each signal are dynamically calculated, such as a voltage of 550V and a current of 100A during charging, with the SOC increasing from 50% to 51%. Following a standardized protocol model, the real-time values are encapsulated into simulated CAN messages (frame ID 0x100, data field encoding voltage 550V, current 100A, etc.). Message transmission is controlled according to communication timing requirements (period 100ms), forming a time-sequential simulated message stream.
[0025] The CAN bus interaction and power closed-loop module is used to send a timed analog message stream to the device under test (DUT) via the CAN communication card and receive the response messages returned by the DUT in real time; it parses the response messages to extract the status signals and control commands of the DUT; it adjusts the working mode and output parameters of the programmable power source based on the status signals and control commands, so that the programmable power source simulates the energy interaction behavior of a ship's mobile energy storage system; and it collects the actual output data of the programmable power source to form a power feedback dataset.
[0026] In this embodiment of the invention, a time-series analog message stream (BMS message) is sent to the device under test (inverter) via a CAN communication card (USB-CAN), and the response message returned by the inverter (such as frame ID 0x200 containing charging enable, actual current, etc.) is received in real time. The response message is parsed to extract the status signal (charging enable is 1) and control command (actual current 100A). Based on this, the programmable bidirectional power supply is controlled in MATLAB or Simulink to switch to load mode (receiving current), and the output voltage is adjusted to 550V and the current to 100A to simulate the energy interaction during battery charging. The actual output voltage of the programmable power supply (549.8V, current 99.9A) and the timestamp are collected to form a power feedback dataset.
[0027] The test analysis and result evaluation module compares the status signals and control commands extracted from the response messages with the expected values in the test case sequence to obtain the signal consistency deviation; calculates the power execution error based on the power feedback dataset and the power parameters in the control commands; constructs a protocol compliance evaluation matrix by combining the signal consistency deviation and the power execution error, including the pass status, deviation value, and error level of each test case; and generates a visual test report based on the protocol compliance evaluation matrix, including test coverage statistics, key indicator trend charts, and detailed analysis of anomalies.
[0028] In this embodiment of the invention, by comparing the status signal (charging enable 1) and control command (actual current 100A) extracted from the response message with the expected values (charging enable 1, current 100A) in the test case sequence, the signal consistency deviation is 0. Based on the power feedback dataset (voltage 549.8V, current 99.9A) and the power parameters in the control command (voltage 550V, current 100A), the power execution error is calculated: voltage error 0.2V, current error 0.1A. Combining the deviation and error, a protocol compliance evaluation matrix is constructed. The test case passes, with a deviation value of 0 and an error level of "small". A visual test report is generated based on the matrix: test coverage statistics (covering normal, boundary, and abnormal intervals of voltage, current, and other signals, with a coverage rate of 90%), key indicator trend charts (voltage and current change curves over time, consistent with the expected trend), and detailed analysis of anomalies (no anomalies).
[0029] Furthermore, the protocol modeling and test configuration module includes the following functions:
[0030] The CAN communication protocol specification text of the ship mobile energy storage system is imported through the protocol parsing interface, and natural language processing technology is used to extract the message frame ID, data length, signal bit definition, transmission period and signal physical meaning to form a structured protocol element set.
[0031] In this embodiment of the invention, the CAN communication protocol specification text (PDF format) of the ship mobile energy storage system is read through the protocol parsing module of the MATLAB or Simulink host computer software via the protocol parsing interface. Natural language processing technology (keyword extraction accuracy ≥95%) is used to scan the text, extracting the message frame ID (e.g., 0x180 corresponds to BMS status, 0x190 corresponds to inverter command), data length (8 bytes for 0x180, 6 bytes for 0x190), signal bit definitions (bits 0-7 of 0x180 represent SOC, bits 8-15 represent voltage), transmission period (every 100ms for 0x180, every 200ms for 0x190), and signal physical meaning (SOC represents the remaining battery capacity, voltage represents the battery terminal voltage). The extracted information is stored in a structure of "frame ID - data length - signal bit - period - physical meaning" to form a structured protocol element set.
[0032] Furthermore, the hardware specifications and function manuals of the device under test are collected and analyzed to obtain the communication node types supported by the device, maximum transmission rate, power interface parameters and fault handling mechanisms, which are used as parameters of the device under test.
[0033] In this embodiment of the invention, the hardware specifications and functional manuals of the device under test (inverter or battery system BMS) are collected, and parameters are extracted using a document parsing tool (supporting PDF or Word format): communication node type supports BMS and EMS interaction nodes, maximum transmission rate is 1Mbps, power interface parameters (voltage range 500-600V, current range -500-500A), and fault handling mechanism (output is cut off and a fault message is sent within 100ms in case of overcurrent). These parameters are categorized and stored according to "node type - transmission rate - power parameters - fault mechanism" to form a parameter set for the device under test, ensuring that the parameters are consistent with the actual hardware performance.
[0034] Furthermore, a protocol parsing model is constructed based on a structured protocol element set. This model includes the mapping relationship between frame IDs and signals, signal encoding or decoding algorithms, and verification rules.
[0035] In this embodiment of the invention, a protocol parsing model is constructed in MATLAB or Simulink based on a structured protocol element set: establishing a mapping relationship between frame IDs and signals (0x180 maps to SOC or voltage signals), writing signal encoding or decoding algorithms (SOC is calculated using "physical value = (encoded value × resolution) + offset", with a resolution of 0.5% and an offset of 0), and setting verification rules (CRC check of frame data, discarding messages when errors occur). The model is stored in a modular form, supporting dynamic association between frame IDs and signals, ensuring that the parsing logic conforms to the protocol specification.
[0036] Furthermore, based on the communication node type and functional parameters in the parameters of the device under test, a test configuration file is generated, which includes the simulated node type, CAN bus baud rate, minimum or maximum signal value or resolution, test scenario type and communication cycle.
[0037] In this embodiment of the invention, a test configuration file is generated based on the communication node type and power parameters of the device under test (DUT) specified as "supporting EMS and BMS interaction nodes". The simulated node type is set to EMS-BMS interaction node, the maximum transmission rate for CAN bus baud rate matching is set to 2Mbps, the minimum or maximum signal value (output power -600-600kW, temperature -40-85℃), the resolution (output power 0.1kW, temperature 0.5℃), the test scenario type is set to "power follow test", and the communication cycle is set to 100ms. The configuration file is stored in XML format to ensure that the parameters are compatible with the hardware specifications of the DUT.
[0038] Furthermore, based on the signal bit definitions in the structured protocol element set, specific signal constraint information is filled into the test configuration file, including the signal data type, bit width, offset, and physical unit.
[0039] In this embodiment of the invention, signal constraint information is filled into the test configuration file according to the signal bit definitions in the structured protocol element set: the SOC data type is set to an unsigned 8-bit integer, a bit width of 8 bits (0-7 bits), an offset of 0, and a physical unit; the current data type is set to a signed 16-bit integer, a bit width of 16 bits (8-23 bits), an offset of -500A, and a physical unit of A. The constraint information of each signal strictly corresponds to the protocol bit definition to avoid bit conflicts or unit mismatches.
[0040] Furthermore, the protocol parsing model and test configuration file are subjected to format verification and logical consistency verification to ensure that there are no conflicts between the frame structure and signal bit definitions. At the same time, it is verified whether the parameters in the test configuration file conform to the hardware specifications of the device under test. This includes verifying the simulated node type, verifying the CAN bus baud rate, verifying the minimum or maximum signal value or resolution, verifying the test scenario type, and verifying the communication cycle. Specifically, the communication cycle is based on the maximum transmission rate in the parameters of the device under test. It is verified whether the communication cycle in the test configuration file is within the allowable range. If there are any conflicts or mismatches, correction suggestions are generated until a standardized protocol model and an executable test configuration set are obtained.
[0041] In this embodiment of the invention, the protocol parsing model and test configuration file are verified as follows: The simulated node type is verified to be within the range of "EMS / BMS interaction nodes" supported by the device under test; if unsupported nodes exist, a compatible node list is displayed. The CAN bus baud rate is verified to not exceed the maximum transmission rate of 2Mbps, the rate percentage is calculated, and its reasonableness is judged. The minimum signal value is verified to be less than or equal to the maximum value, and the resolution matches the data type (16-bit integer adapts to 0.1kW resolution); if the temperature resolution of 0.5℃ does not match the 8-bit data type, an adaptation range of 0.25℃-1℃ is recommended. The test scenario type "power follower test" is verified to cover the device under test. Prepare core functions; if not covered, supplement with "overload protection test" suggestions; verify communication cycle: based on a maximum transmission rate of 2Mbps, calculate the minimum allowable communication cycle as 1ms. The 100ms in the test configuration file is within the allowable range, with a cycle deviation rate of 0; verify the frame structure and signal bit definitions in the protocol parsing model to ensure that the sum of the 0x200 signal bit widths (16+8=24 bits) does not exceed 8 bytes (64 bits), with no bit conflicts; associate and verify the protocol parsing model with the test configuration file to ensure that the signal bit definitions in the test configuration completely match the model frame structure, generating a correction suggestion: "Temperature resolution adjusted to 0.5℃ conforms to the range of 8-bit data types, no modification required." Repeat the verification until there are no conflicts, obtaining the standardized protocol model and executable test configuration set.
[0042] Furthermore, the verification of whether the communication cycle in the test configuration file is within the allowable range based on the maximum transmission rate in the parameters of the device under test includes:
[0043] Extract the maximum transmission rate from the parameters of the device under test and convert it into the maximum number of data frames allowed to be transmitted per unit time.
[0044] In this embodiment of the invention, the maximum transmission rate of 1 Mbps (1 × 10^6 bits or seconds) is extracted from the parameters of the device under test (inverter). Following the standard CAN message structure (13 bytes per frame, 104 bits), the formula "maximum number of data frames allowed per unit time = maximum transmission rate ÷ number of bits per frame" is used to calculate: 1 × 10^6 ÷ 104 ≈ 9615 frames or seconds. If the device under test is a BMS with a maximum transmission rate of 500 kbps (5 × 10^5 bits or seconds), then 5 × 10^5 ÷ 104 ≈ 4808 frames or seconds are calculated and stored as the rate limits for the two types of devices respectively.
[0045] Furthermore, the theoretical data transmission frequency of each simulated node is calculated based on the communication cycle in the test configuration file, thereby obtaining the total data frame transmission rate.
[0046] In this embodiment of the invention, when the device under test is an inverter (simulating a BMS node), the BMS node in the test configuration file contains three messages: frame ID 0x180 (period 100ms, 0.1 seconds), 0x181 (period 100ms), and 0x200 (period 500ms, 0.5 seconds). The transmission frequency is calculated as follows: 0x180 or 0x181 each is 1 ÷ 0.1 = 10 frames or seconds, and 0x200 is 1 ÷ 0.5 = 2 frames or seconds, for a total rate of 10 + 10 + 2 = 22 frames or seconds. When the device under test is a BMS (simulating an inverter node), the inverter node contains two messages: frame ID 0x280 (period 200ms, 0.2 seconds) and 0x281 (period 200ms), each with a frequency of 5 frames or seconds, for a total rate of 5 + 5 = 10 frames or seconds.
[0047] Furthermore, the total data frame transmission rate is compared with the maximum transmission rate to calculate the rate occupancy rate. If the rate occupancy rate exceeds a preset threshold, the contribution of each simulated node's communication cycle to the total rate is analyzed, and the node with the highest contribution rate is identified. The analysis of the contribution of each simulated node's communication cycle to the total rate includes:
[0048] In this embodiment of the invention, when the device under test is an inverter, the total rate is 22 frames or seconds, and the rate utilization rate is (22 ÷ 9615) × 100% ≈ 0.23%, which is lower than the preset threshold of 80%, and no adjustment is required. When the device under test is a BMS, if 10 new messages with a period of 20ms (0.02 seconds) are added to the simulated inverter node, each with a frequency of 50 frames or seconds, the total rate is 10 × 50 + 10 = 510 frames or seconds, and the utilization rate is (510 ÷ 4808) × 100% ≈ 10.61%, which is still lower than the threshold. If 80 new messages with the same period are added, the total rate is 80 × 50 + 10 = 4010 frames or seconds, and the utilization rate is ≈ 83.4% > 80%. Analyzing the contribution: the contribution of the 80 new messages is (4000 ÷ 4010) × 100% ≈ 99.75%, making it the node with the highest contribution.
[0049] Furthermore, based on the contribution analysis results, the recommended communication cycle value of high-proportion nodes is automatically adjusted to reduce the total data frame transmission rate to within the allowable range of the maximum transmission rate.
[0050] In this embodiment of the invention, for the newly added nodes that account for 99.75% of the BMS equipment, the target total rate is 4808 × 80% ≈ 3846 frames or seconds, requiring a reduction of 4010 - 3846 = 164 frames or seconds. Using the formula "Suggested period = (Original period × Original rate) ÷ (Original rate - Rate to be reduced)", with an original period of 20ms and an original rate of 4000 frames or seconds, the suggested period is calculated to be (20 × 4000) ÷ (4000 - 164) ≈ 21.1ms, rounded down to 21ms. After adjustment, the node rate is 80 × (1 ÷ 0.021) ≈ 3810 frames or seconds, and the total rate is 3810 + 10 = 3820 frames or seconds.
[0051] Furthermore, the adjusted rate utilization is recalculated. If it still does not meet the requirements, the adjustment process is repeated until a revised test configuration file that meets the transmission rate constraints is generated.
[0052] In this embodiment of the invention, after recalculating the BMS device's adjusted occupancy rate = (3820 ÷ 4808) × 100% ≈ 79.45% < 80%, which meets the requirements, a revised test configuration file is generated, changing the period of the newly added node to 21ms. If the total rate after adjustment still exceeds the threshold (e.g., 3846 frames or seconds), step S134 is repeated to further adjust the period to 22ms, calculating the rate = 80 × (1 ÷ 0.022) ≈ 3636 frames or seconds, the total rate 3636 + 10 = 3646 frames or seconds, and the occupancy rate ≈ 75.8%, until the constraints are met.
[0053] Furthermore, the simulation node behavior simulation module includes the following functions:
[0054] The corresponding node behavior library is called according to the simulated node type in the executable test configuration set, and a node behavior logic model containing initialization state, running state, fault state and shutdown state is built based on the node behavior library.
[0055] In this embodiment of the invention, in order to meet the testing requirements of the simulated battery system (BMS) in the ship mobile energy storage system, in the MATLAB or Simulink environment running on the PC, according to the parameter "simulation node type = BMS" in the executable test configuration set, the node behavior library (including preset modules such as charge and discharge control, fault diagnosis, state switching, etc.) storing the typical behavior logic of BMS is called. Based on this behavior library, a node behavior logic model is constructed through Simulink module drag-and-drop and parameter configuration: the initialization state is set to "SOC=50%, battery voltage=550V, no fault code, charge / discharge enable=0"; the running state is set to "SOC changes with charge / discharge (+1% every 100ms during charging, -1% every 100ms during discharging), voltage is maintained in the 540V-560V range, fault code=0"; the fault state is set to "triggered when overvoltage (voltage>560V) or overcurrent (current>200A), fault codes are set to 0x01 and 0x02 respectively, and charge / discharge enable is forcibly set to 0"; the shutdown state is set to "after receiving a shutdown command, SOC freezes, voltage drops to 500V, and all enable is set to 0", and data interaction between each state is achieved through signal links between modules.
[0056] Furthermore, the triggering conditions between each state are defined in the node behavior logic model, including time triggering, signal value triggering and external instruction triggering, and corresponding state transition logic is set for each triggering condition;
[0057] In this embodiment of the invention, by defining the triggering conditions and transition logic of each state in the constructed BMS node behavior logic model using the Simulink state flow graph tool: time triggering is set to "maintain the running state if the running state lasts for 5000ms and the SOC is not 100% or 10%; if it lasts for 5000ms and the SOC is 100%, trigger the transition to 'fully charged standby state'"; signal value triggering is set to "when the voltage is >560V, jump from the running state to the fault state (fault code 0x01); when the current is >200A, jump from the running state to the fault state (fault code 0x02)". In the fault state, the voltage drops below 550V and the current is <180A, and after maintaining this state for 1000ms, it jumps back to the running state. The external command trigger is set to "when receiving the 'stop command (frame ID=0x201, data bit 8=1)' sent by the inverter on the CAN bus, it jumps from any state to the stop state; when receiving the 'forced charging command (frame ID=0x201, data bit 7=1)', it jumps from the running state to the 'forced charging state' (the current increases to 200A when SOC<30%)". Each conversion logic sets the parameter threshold and delay time through the state transition condition dialog box.
[0058] Furthermore, based on the signal value range constraints in the executable test configuration set, the equivalence class partitioning method is used to divide the value range of each signal into normal intervals, boundary points, and abnormal intervals, and representative test values are generated for each interval.
[0059] In this embodiment of the invention, based on the value range constraints of key BMS signals in the executable test configuration set (e.g., current: -200A~200A, voltage: 540V~560V, SOC: 10%~100%), the partitioning rules are set in the test case generation module of MATLAB or Simulink using the equivalence class partitioning method: the normal range of the current signal is set to -199A~199A, with representative test values of 100A (charging) and -100A (discharging); boundary points are set to -200A and 200A; the abnormal range is set to -210A (underlimit) and 210A (overlimit), with one representative test value for each. The normal range of the voltage signal is set to 541V~559V, with a representative test value of 550V; boundary points are set to 540V and 560V; the abnormal range is set to 539V (underlimit) and 561V (overlimit). The normal range of the SOC signal is set to 11%~99%, and the representative test value is 50%; the boundary points are set to 10% and 100%; the abnormal range is set to 9% (under the limit) and 101% (over the limit), and the representative test value of each range is assigned a fixed value through the parameter input box.
[0060] Furthermore, by combining the corresponding state transition logic and representative test values, a sequence of test cases is generated. Each test case includes initial state settings, input signal values, expected state transitions, and expected output signals.
[0061] In this embodiment of the invention, a test case sequence is generated by calling a test case generation tool in MATLAB or Simulink, combining the defined state transition logic with the generated representative test values. The first test case: the initial state is set to "running state (SOC=50%, voltage=550V)", the input signal value is "charging current=100A (normal range)", the expected state transition is "maintaining running state (SOC every 100ms+1%)", and the expected output signal is "frame ID=0x100 (BMS status message), data field contains SOC=50%, voltage=550V, current=100A, fault code=0, charging enable=1". The second test case: The initial state is set to "running state (SOC=50%, voltage=550V)", the input signal value is "charging current=210A (abnormal range)", the expected state is "jump to fault state (fault code 0x02)", and the expected output signal is "frame ID=0x100, data field contains SOC=50%, voltage=550V, current=210A, fault code=0x02, charging enable=0". Each test case stores the initial state, input, expected transition and output parameters in a table format.
[0062] Furthermore, based on the execution order of the test case sequence, the current state and signal values in the node behavior logic model are dynamically updated, and the real-time values of each signal are calculated.
[0063] In this embodiment of the invention, test case sequences are executed by starting the test case sequence in MATLAB or Simulink, following the order of "normal charging test → overcurrent charging fault test → normal discharging test". Trigger signals are generated sequentially through the model's built-in timing control module. When the first test case is executed, the timing module sends a "start charging" signal, updating the model's current state from initialization to running state. The current calculation module is then invoked to calculate the real-time SOC value every 100ms (e.g., SOC=51% at 100ms, SOC=52% at 200ms) based on the input "100A" and the initial value of SOC=50%, using the formula "SOC=50%+(100A or rated capacity)×time" (rated capacity is preset to 100Ah). Simultaneously, the voltage module dynamically adjusts the real-time voltage according to the current load (549.8V at 100ms, 549.7V at 200ms). All real-time signals are transmitted to the message generation module via the model data bus.
[0064] Furthermore, according to the frame structure and signal bit definition in the standardized protocol model, the real-time value is encoded to generate a simulated CAN message that conforms to the CAN protocol format; based on the communication timing requirements in the executable test configuration set and the triggering conditions in the node behavior logic model, the sending time and frequency of the simulated CAN message are controlled to form a timed simulated message stream that interacts with the device under test.
[0065] In this embodiment of the invention, based on the frame structure definition of "BMS Status Message (Frame ID=0x100)" in the standardized protocol model (standard ID=0x100, data length=8 bytes, signal bit allocation: SOC occupies bits 0-7, voltage occupies bits 8-15, current occupies bits 16-23, fault code occupies bits 24-31, charging enable occupies bit 32), in the CAN message encoding module of MATLAB or Simulink, the calculated real-time values (such as SOC=51%, voltage=549.8V, current=100A, fault code=0, charging enable=1) are converted into integers according to the rule of "SOC×2 (resolution 0.5%), voltage×10 (resolution 0.1V), current×1 (resolution 1A)", and then mapped to the corresponding bit positions to complete the encoding, generating a simulated CAN message conforming to the CAN2.0A protocol. Based on the timing requirement of "BMS status message sending period = 100ms" in the executable test configuration set, and combined with the triggering conditions of "periodic sending when there is no fault and immediate sending when there is a fault" in the node behavior logic model, the CAN card driver controls the message to be sent at every 100ms integer time (such as 100ms, 200ms, 300ms). When a fault is triggered (such as current = 210A), a sending command is immediately inserted to form a timed simulated message stream, which is transmitted to the CAN bus through the USB-CAN card to interact with the inverter under test.
[0066] Furthermore, the CAN bus interaction and power closed-loop module includes the following functions:
[0067] A physical connection with the device under test is established through the CAN communication card, and the communication parameters in the executable test configuration set, including baud rate, sampling points and synchronization jump width, are loaded to complete the communication initialization.
[0068] In this embodiment of the invention, a CAN communication card (USB-CAN) is physically connected to the CAN bus of the device under test (BMS). Communication parameters of an executable test configuration set are loaded into the MATLAB or Simulink host computer: baud rate 1 Mbps, sampling points 80%, and synchronization jump width 1. Communication initialization is completed through the CAN card driver, establishing a stable CAN communication link between the PC and the BMS, providing a foundation for subsequent message transmission and reception.
[0069] Furthermore, the time-series simulated message stream generated by the simulation node behavior simulation module is sent to the CAN bus of the device under test through the CAN communication card, and the sending timestamp of each message is recorded.
[0070] In this embodiment of the invention, a time-series simulated message stream (frame ID 0x100 - voltage 550V, 0x101 - current 100A, 0x102 - charging enable 1, period 100ms) is generated by the simulation node behavior simulation module in MATLAB or Simulink. The message stream is sent to the CAN bus of the BMS via a CAN communication card, and the transmission timestamp of each message is recorded using a timestamp recording tool, such as "0x100 transmission time 100ms, 0x101 transmission time 100ms, 0x102 transmission time 100ms", to facilitate subsequent message synchronization analysis.
[0071] Furthermore, the system monitors the CAN bus in real time, receives response messages sent by the device under test, parses the frame ID and data field of the response messages, and extracts the status signals and control commands by combining them with a standardized protocol model.
[0072] In this embodiment of the invention, the CAN bus is monitored in real time via a CAN card in MATLAB or Simulink to receive response messages returned by the BMS (frame ID 0x200 - actual voltage 549.8V, 0x201 - actual current 99.9A, 0x202 - fault code 0x00). The messages are parsed using a standardized protocol model: 0x200 is decoded to 549.8V, 0x201 to 99.9A, and 0x202 to indicate no fault. The status signal "normal operation" and the control command "charging enable effective" are extracted to provide a basis for subsequent power control.
[0073] Furthermore, the status signals are classified and processed to store the discrete signals corresponding to the operating mode and fault code as a status sequence, and the continuous signals corresponding to the voltage, current and power values as time data.
[0074] In this embodiment of the invention, the extracted status signals are classified and processed in MATLAB or Simulink: the operating mode "normal" and the fault code "none" are treated as discrete signals and stored as a status sequence (timestamps correspond to status, such as "100ms - normal or no fault"); the voltage 549.8V and the current 99.9A are treated as continuous signals and stored as time-series data (timestamps correspond to values, such as "100ms - 549.8V or 99.9A"), which facilitates signal comparison during subsequent qualification judgment.
[0075] Furthermore, based on the enable status of each response message in the control command and the corresponding current request value under charge / discharge enable, a power source control command is generated, including control commands corresponding to the inverter and battery system BMS as communication nodes.
[0076] In this embodiment of the invention, by generating control instructions (charging enable 1) and current request value 100A for the inverter as the communication node in MATLAB or Simulink, control instructions (frame ID0x300 - charging enable 1, current request 100A) are generated simultaneously for the battery system BMS as the communication node, ensuring the integrity and accuracy of control instructions for different devices.
[0077] Furthermore, power source control commands are sent to the programmable power source to control its switching between different modes and adjust the output parameters to simulate the operation control process of different devices under test in the ship's mobile energy storage system.
[0078] In this embodiment of the invention, the generated power source control command (frame ID 0x500 - load mode, voltage 550V, current 100A) is sent to the programmable bidirectional power supply in MATLAB or Simulink. After receiving the command, the power supply switches to load mode (receiving current) and adjusts the output parameters to 550V voltage and 100A current to simulate the power interaction behavior during BMS charging in a ship's mobile energy storage system, thereby realizing the power control simulation of the device under test.
[0079] Furthermore, the actual output voltage, current, and power values are acquired in real time through the data acquisition interface of the programmable power source, and the acquisition timestamp is recorded to form a power feedback dataset synchronized with the response message time.
[0080] In this embodiment of the invention, the actual output voltage of 549.9V and current of 99.9A are acquired in real time through the data acquisition interface of the programmable power source (which supports real-time data reading) in MATLAB or Simulink, and the acquisition timestamp "200ms" is recorded using a timestamp recording tool. The voltage, current, and timestamp information are stored to form a power feedback dataset synchronized with the response message time, which is used for subsequent power execution error analysis.
[0081] Furthermore, the generation of power source control commands based on the enable status of each response message in the control command and the corresponding current request value under charge / discharge enable includes control commands corresponding to the inverter and battery system BMS as communication nodes, including:
[0082] If the control command is for the inverter as the communication node, then the response message corresponding to the Energy Management System (EMS) is parsed and received. This includes battery fault messages, charge / discharge limit messages, battery parameter messages, and charge / discharge enable messages. If the battery fault message indicates a fault, charging / discharging is prohibited. Otherwise, a qualified EMS flag is generated and a corresponding response message is sent. Based on the response message, the corresponding charge / discharge limit message and battery parameter message are received. At the same time, it is determined whether the SOC in the battery parameter message has reached 100%. If so, the target current value is generated and charging is stopped when the full charge flag corresponding to the charge / discharge enable message is true. Otherwise, the parsing is iterated again.
[0083] In this embodiment of the invention, if the control command corresponding to the inverter as a communication node is (e.g.) Figure 2 As shown in the diagram, in the MATLAB or Simulink host computer, the response messages from the Energy Management System (EMS) are received via a CAN card (frame ID 0x100 - fault code 0x00, 0x101 - charging limit 200A, 0x102 - discharging limit 150A, 0x103 - SOC 80%, 0x104 - charging enable 1 or discharging enable 0 or full charge flag 0). The fault message is parsed: fault code 0x00 indicates no fault, a qualified EMS flag is generated, and a response message is sent (frame ID 0x305 - qualified flag). The charge / discharge limit messages (charging 200A, discharging 150A) and battery parameter messages (SOC 80%) are received. If the SOC is less than 100%, subsequent messages are iterated and parsed again, waiting for the charge / discharge enable message to be updated. If the subsequent received message 0x104 shows SOC 100% and full charge flag 1, a qualified target current value of 0A is generated, and charging is stopped.
[0084] Furthermore, if the charging enable message corresponding to the charging enable message is true, the power supply is controlled to charge, and the current request value in the control command is extracted. At the same time, by obtaining the corresponding actual current value, it is determined whether the actual current value is within ±0.5 of the current request value. If the actual current value is within the allowable range, it is used as the target current value; if it exceeds the allowable range, the charging enable is re-evaluated. Otherwise, if the discharging enable is true, the power supply is controlled to discharge, and the corresponding actual current value is determined whether it is within ±0.5 of the current request value. If the actual current value is within the allowable range, it is used as the target current value; if it exceeds the allowable range, a corrected target current value is generated according to the preset limiting strategy, and the limiting event is recorded.
[0085] In this embodiment of the invention, if the charging enable is 1 in the charge / discharge enable message (frame ID 0x104), the programmable power supply is controlled to switch to load mode (receive current) in MATLAB or Simulink, and the target current is set to 200A. The actual current of 199.8A is obtained through the power data acquisition interface. It is determined that 199.8A is within the range of 200A ± 0.5A, and 199.8A is taken as the qualified target current value. If the actual current of 201A exceeds the range, the process returns to re-evaluate the charging enable (if it is still 1, the power supply is controlled to adjust to 200A again until the actual current is within the allowable range). If the discharge enable is 1, the control power supply switches to source mode (output current), the target current is set to 150A, the actual current is 149.7A, and it is determined to be within 150A±0.5A, which is taken as the qualified target current value; if the actual current exceeds 155A, the excess is calculated as 155-150=5A, the preset tolerance threshold is 3A, 5A≥3A, the target current value is set to 150A×0.9=135A according to the limiting strategy, marked as "severe over-limit", and the limiting event is recorded as "Request 150A→Target 135A, 5A over-limit, severe over-limit".
[0086] Furthermore, if the control command corresponds to the battery system BMS as the communication node, the corresponding response message of the inverter is sent sequentially, including fault message, voltage or current limit message, parameter message, and charge / discharge flag message. If the charging enable corresponding to the charge / discharge flag message is true, the power supply is set to load mode to wait for charging. Simultaneously, the corresponding current request value in the parameter message is automatically updated (specifically, the minimum, maximum, or intermediate value), and the corresponding actual current value is obtained. It is then determined whether the actual current value is within ±0.5 of the current request value. If the actual current value is within the allowable range, it is used as the target current value; if it exceeds the allowable range, the automatic update is repeated. Otherwise, if the discharge enable is true, the power supply is set to source mode to wait for discharging. Simultaneously, the corresponding current request value in the parameter message is automatically updated, and the corresponding actual current value is determined to be within ±0.5 of the current request value. If the actual current value is within ±0.5 and within the allowable range, it is used as the target current value. Furthermore, when the simulated parameter message rises from 0 to 100% after 0-1 minutes of charging, the corresponding full charge flag is sent as true. The system then checks whether the inverter has stopped charging and whether the actual current value is 0. If so, the target current value is generated; otherwise, the current request value corresponding to SOC≤10% is set to 0.3 times the inverter capacitor value. Simultaneously, the system checks whether the strong charge flag in the charge / discharge flag message is false. If so, the inverter does not charge; otherwise, the strong charge flag is set as true. The system then checks whether the inverter is charging normally. If so, the target current value is generated; otherwise, the system checks again. Upon passing the test, a fault message is simulated to determine whether the inverter has stopped charging / discharging. If so, a pass flag is generated. If the current exceeds the allowable range, a corrected target current value is generated according to the preset limiting strategy, and the limiting event is recorded.
[0087] In this embodiment of the invention, if the control command corresponding to the battery system BMS as the communication node is (e.g.) Figure 3 As shown in the image, in MATLAB or Simulink, send the inverter's response messages sequentially (frame ID 0x200 - fault code 0x00, 0x201 - charging voltage limit 600V, 0x202 - charging current limit 200A, 0x203 - discharging current limit 150A, 0x204 - SOC 80%, 0x205 - charging enable 1 or discharging enable 0 or strong charge flag 0). If charging enable is 1, set the power supply to load mode and wait for charging, automatically updating the current request value in the parameter message (frame ID 0x203): cyclically setting the minimum value to 50A, the maximum value to 200A, and the intermediate value to 125A, holding each value for 30 seconds. Obtain the actual current: 49.9A at 50A (qualified), 199.8A at 200A (qualified), and 124.9A at 125A (qualified), all of which are taken as qualified target current values. If the actual current exceeds 205A, calculate the excess amount as 205-200=5A. With a tolerance threshold of 3A, 5A ≥ 3A, the target current is set to 200A × 0.9 = 180A, marked as "Severely Exceeds Limit," and the system returns to automatically update the requested value. If the discharge enable is 1, the power supply is set to source mode and waits for discharge. The current request value in the parameter message is automatically updated (e.g., 50A, 150A, etc.). If the actual current is within ±0.5A of the requested value, it is considered qualified. After charging for 30 seconds (simulating 0-1 minutes), the SOC in the control parameter message rises from 80% to 100%, a full charge flag of 1 is sent, the actual inverter current is determined to be 0A, and a qualified target current value of 0A is generated. Set SOC to 5%, current request value to 0.3 × inverter capacitor value (assuming capacitor corresponds to a current of 60A, i.e., 18A), and strong charge flag to 0; the inverter will not charge. Change the strong charge flag to 1; the actual inverter current is 17.9A, generating a qualified target current value of 17.9A. Simulate sending a fault message (frame ID 0x200 - over-temperature fault); the actual inverter current is 0A, generating a qualified flag. If the actual current exceeds the limit, such as a discharge request of 160A and an actual current of 165A, the excess is 165-150=15A. With a tolerance threshold of 3A, the target current is set to 150A × 0.9=135A, marked "Severe Over-Limit," and the limiting event is recorded.
[0088] Furthermore, the actual voltage value of the previous moment is obtained from the power feedback dataset, and the target voltage value is determined by combining it with the voltage range in the parameters of the device under test, ensuring that it is within the safe operating range;
[0089] In this embodiment of the invention, the actual voltage of 599.9V at the previous moment (e.g., 200ms) is obtained from the power feedback dataset (which stores timestamps and voltage values, such as "100ms-599.8V, 200ms-599.9V"). Combined with the voltage range of 500-600V in the parameters of the device under test, it is determined that 599.9V is within the safe range, and the target voltage value of 599.9V is determined and stored in the power control configuration area.
[0090] Furthermore, based on the charging / discharging mode, target voltage value, and target current value, a power source control command is generated that includes mode switching instructions, voltage settings, and current settings.
[0091] In this embodiment of the invention, based on the charging / discharging mode (e.g., charging-load mode), the target voltage value of 599.9V, and the target current value of 199.8A, a power source control instruction containing a mode switching instruction (load mode), a voltage setting of 599.9V, and a current setting of 199.8A is generated in the power source control instruction generation module of MATLAB or Simulink. The instruction is then sent to the programmable bidirectional power supply via a serial port, controlling the power supply to output according to the parameters. Simultaneously, the instruction transmission timestamp "300ms" and the parameters are recorded for subsequent power execution error analysis.
[0092] Furthermore, generating the corrected target current value according to the preset limiting strategy includes:
[0093] When the requested current value is greater than the maximum value, the excess amount is calculated, specifically the difference between the requested current value and the maximum value.
[0094] In this embodiment of the invention, the maximum value of the inverter current request (400A) within the executable test configuration set is obtained through the current limiting module of the MATLAB or Simulink host computer software. When a current request value of 400.8A is received from the device under test (BMS), the excess is calculated using a difference calculation tool: 400.8A - 400A = 0.8A, precisely rounded to one decimal place to ensure that the excess calculation accurately reflects the deviation between the requested value and the upper limit. The result is stored in the over-limit record cache.
[0095] Furthermore, if the excess is less than the preset tolerance threshold, the target current value is set to the maximum value and marked as a slight over-limit.
[0096] In this embodiment of the invention, by calling the previously generated grace threshold of 0.78A, the excess amount of 0.8A is compared with the grace threshold. 0.8A > 0.78A, which does not meet the "less than grace threshold" condition. If the current request value is 400.7A, and the excess amount of 0.7A < 0.78A, then the condition is met. At this time, the target current value is set to the maximum value of 400A, and the status marking tool marks "slight over-limit" in the limiting event log. The record content includes "request value 400.7A, target value 400A, over-limit type slight over-limit, excess amount 0.7A", ensuring that the marking corresponds one-to-one with the data.
[0097] Furthermore, if the excess is greater than or equal to the grace threshold, the target current value is set to a preset percentage of the maximum value and marked as severely exceeded.
[0098] In this embodiment of the invention, for a current request value of 401.5A, the excess amount of 1.5A is calculated, and 1.5A ≥ 0.78A satisfies the condition. The maximum value ratio preset in the executable test configuration set (80%) is obtained, and the target current value is calculated through multiplication: 400A × 80% = 320A. The event log is marked as "Severe Exceedance," recording "Request value 401.5A, Target value 320A, Exceedance type: Severe Exceedance, Exceedance amount 1.5A, Preset ratio 80%." Simultaneously, an alarm prompt is triggered on the host computer interface to remind testers to pay attention to the severe exceedance situation.
[0099] Furthermore, when the requested current value is less than the minimum value, the shortfall is calculated, specifically the difference between the minimum value and the requested current value.
[0100] In this embodiment of the invention, by obtaining the minimum value of the inverter current request value (50A) within the executable test configuration set, when a current request value of 49.8A is received, the insufficient amount is calculated using a difference calculation tool: 50A - 49.8A = 0.2A; if the current request value is 49.7A, the insufficient amount is 0.3A. The calculation process retains one decimal place, and the insufficient amount is stored in the under-limit record cache area, which is managed separately from the over-limit data to avoid data confusion.
[0101] Furthermore, if the insufficient amount is less than the preset tolerance threshold, the target current value is set to the minimum value and marked as slightly under-limited.
[0102] In this embodiment of the invention, by calling the previously generated tolerance threshold of 0.24A, the insufficient amount of 0.2A is compared. If 0.2A < 0.24A, the condition is met, and the target current value is set to the minimum value of 50A. The limiting event log is marked as "slight underlimit," and "requested value 49.8A, target value 50A, underlimit type: slight underlimit, insufficient amount 0.2A" is recorded. If the insufficient amount of 0.3A > 0.24A, the condition for this step is not met, and the process proceeds to the next step.
[0103] Furthermore, if the shortfall is greater than or equal to the tolerance threshold, the target current value is set to a preset percentage of the minimum value and marked as severely under-limited.
[0104] In this embodiment of the invention, for a current request value of 49.5A, the condition of 0.5A deficiency ≥ 0.24A is met. The minimum value ratio of 90% preset in the executable test configuration set is obtained, and the target current value is calculated through multiplication: 50A × 90% = 45A. The event log is marked as "Severe Underlimit" and records "Request value 49.5A, Target value 45A, Underlimit type: Severe underlimit, 0.5A deficiency, Preset ratio 90%". The current status display on the host computer interface is updated synchronously to ensure that testers are aware of the underlimit situation in real time.
[0105] Furthermore, the current values before and after the correction, as well as the over-limit type, are recorded to generate the corresponding limiting event.
[0106] In this embodiment of the invention, a log integration tool is used to uniformly record the current values before and after correction and the over-limit type of all limiting events, forming a structured limiting event report. The report includes fields such as "timestamp, requested current value, target current value, threshold type (leniency or tolerance), threshold size, deviation (exceeding or falling short), and over-limit type", such as "1500ms, 400.7A, 400A, leniency threshold, 0.78A, exceeding 0.7A, slight over-limit" and "1600ms, 49.8A, 50A, tolerance threshold, 0.24A, insufficient 0.2A, slight under-limit". The report is automatically stored in the test data server for subsequent analysis and retrieval.
[0107] Furthermore, the grace threshold is calculated and generated in the following manner:
[0108] Extract the signal dynamic response parameters of the device under test from the executable test configuration set, including signal conditioning delay, current fluctuation coefficient under rated power and signal sampling frequency within the communication cycle.
[0109] In this embodiment of the invention, the following signal dynamic response parameters are extracted from the executable test configuration set (for the inverter under test) using the parameter extraction module of the MATLAB or Simulink host computer software: signal conditioning delay of 50ms, current fluctuation coefficient of 0.02 at rated power (300kW), and signal sampling frequency of 10 times within a communication cycle (200ms) (sampling once every 20ms). These parameters are stored categorized as "conditioning delay - fluctuation coefficient - sampling frequency" to ensure they match the dynamic characteristics of the inverter.
[0110] Furthermore, based on the signal conditioning delay duration and the signal sampling frequency within the communication cycle, the theoretical number of times the signal is conditioned within one communication cycle is calculated, and then multiplied with the signal sampling frequency to generate the signal dynamic conditioning frequency parameter.
[0111] In this embodiment of the invention, based on a signal conditioning delay of 50ms and a sampling frequency of 10 times within a communication cycle of 200ms, the theoretical number of conditioning cycles is calculated: 200ms ÷ 50ms = 4 times. The dynamic signal conditioning frequency parameter is generated through multiplication: 4 times × 10 times = 40 times or the cycle. Integer multiplication is used in the calculation process to ensure that the result accurately reflects the coupling frequency of signal conditioning and sampling within a unit cycle, and is stored in the dynamic parameter library.
[0112] Furthermore, the steady-state deviation data of the current of the device under test during the historical test process is extracted from the power feedback dataset, including the steady-state fluctuation range of the current under different power levels, the deviation trend coefficient within the continuous test cycle, and the maximum deviation peak under extreme conditions.
[0113] In this embodiment of the invention, current steady-state deviation data is extracted from the power feedback dataset (which stores historical test data of the inverter): the current steady-state fluctuation ranges for different power levels (100kW, 200kW, or 300kW) are ±0.3A, ±0.2A, or ±0.1A, respectively; the deviation trend coefficient over 10 consecutive test cycles is 0.9 (the deviation decreases with each cycle); and the maximum deviation peak value under extreme conditions (overtemperature) is 0.8A. Data extraction employs a time-series filtering tool to ensure coverage of both typical and extreme conditions.
[0114] Furthermore, a weighted average calculation is performed on the steady-state fluctuation range of the current under different power levels. The weight values are determined based on the proportion of each power level in the actual operation of the ship mobile energy storage system, and the steady-state average deviation value of the current is obtained.
[0115] In this embodiment of the invention, the weight values are determined based on the proportion of the actual operating power levels of the ship mobile energy storage system (20% for 100kW, 50% for 200kW, and 30% for 300kW). The weighted average of the current steady-state fluctuation range is calculated as follows: (0.3×20%) + (0.2×50%) + (0.1×30%) = 0.06 + 0.1 + 0.03 = 0.19A, yielding the current steady-state average deviation value of 0.19A. The calculation process is rounded to two decimal places.
[0116] Furthermore, the signal dynamic adjustment frequency parameter is coupled with the current steady-state average deviation value for calculation. First, the current steady-state average deviation value is corrected by the signal dynamic adjustment frequency parameter. The correction coefficient is the product of the reciprocal of the signal dynamic adjustment frequency parameter and the preset basic correction factor, so as to obtain the dynamically corrected current deviation reference value.
[0117] In this embodiment of the invention, the first step of the coupling operation involves setting a preset basic correction factor of 0.5 and calculating the correction coefficient: (1 ÷ 40) × 0.5 = 0.0125. The steady-state average deviation of the current is corrected using this correction coefficient: 0.19A × 0.0125 = 0.002375A, resulting in a dynamically corrected current deviation reference value of 0.002375A. Floating-point multiplication is used in the calculation to ensure that the correction accuracy meets the testing requirements.
[0118] Furthermore, by combining the maximum deviation peak value and the deviation trend coefficient under extreme operating conditions, the deviation risk compensation value is calculated. Specifically, the product of the maximum deviation peak value and the square of the deviation trend coefficient is summed with the dynamically corrected current deviation benchmark value.
[0119] In this embodiment of the invention, the second step of the coupling operation is to calculate the deviation risk compensation value: First, the maximum deviation peak value of 0.8A under extreme operating conditions is multiplied by the deviation trend coefficient of 0.9 squared (0.8×0.9²=0.8×0.81=0.648A), and then summed with the dynamically corrected current deviation reference value of 0.002375A: 0.648+0.002375=0.650375A, to obtain the deviation risk compensation value of 0.650375A.
[0120] Furthermore, the coupling calculation results are normalized with the power reserve coefficient of the device under test. The power reserve coefficient is obtained from the ratio of the rated power to the maximum allowable overload power in the parameters of the device under test. The normalization process uses the ratio of the deviation risk compensation value to the power reserve coefficient to generate the grace threshold.
[0121] In this embodiment of the invention, the rated power of 300kW and the maximum allowable overload power of 360kW are extracted from the parameters of the device under test (inverter), and the power reserve coefficient is calculated as: 300÷360≈0.8333. The coupling calculation result (deviation risk compensation value of 0.650375A) and the power reserve coefficient are normalized: 0.650375÷0.8333≈0.78A, and a grace threshold of 0.78A is generated for subsequent current deviation compliance judgment.
[0122] Furthermore, the tolerance threshold is calculated and generated in the following manner:
[0123] The signal transmission characteristic parameters of the CAN communication protocol are extracted from the standardized protocol model, including message transmission delay range, signal bit error rate, and message retransmission probability. Based on the message transmission delay range, the transmission delay fluctuation interval is determined, and the median value and interquartile range of this interval are calculated. The ratio of the median value to the interquartile range is used as the transmission stability coefficient. The communication reliability parameters are generated by combining the signal bit error rate and the message retransmission probability through product operation.
[0124] In this embodiment of the invention, signal transmission characteristic parameters are extracted from the standardized protocol model (for CAN communication) through the protocol parameter extraction module of MATLAB or Simulink host computer software: message transmission delay range 10-30ms, signal bit error rate 1×10⁻⁶. -6 The message retransmission probability is 0.001. The transmission delay fluctuation range is determined to be 10-30ms. Using statistical analysis tools, the median value is calculated to be 20ms, and the interquartile range (Q3-Q1=25-15=10ms). The transmission stability coefficient is calculated as 20÷10=2. Combining the signal bit error rate and the message retransmission probability, a communication reliability parameter is generated through multiplication: 1×10⁻⁶. -6 ×0.001=1×10 -9 The parameters are stored in the communication characteristics database.
[0125] Furthermore, current control accuracy data of similar equipment is retrieved from the historical test database of the equipment under test, including current control deviation under different load rates, control accuracy attenuation coefficient after long-term operation, and deviation correction amount after temperature compensation; polynomial fitting is performed on the current control deviation under different load rates to obtain the load rate-control deviation fitting curve, and the theoretical control deviation value of the equipment under rated load rate is calculated based on the curve.
[0126] In this embodiment of the invention, current control accuracy data of similar equipment is retrieved from the historical test database of the device under test (inverter): current control deviation of ±0.4A, ±0.3A, or ±0.2A under different load rates (50%, 80%, or 100%), control accuracy attenuation coefficient of 0.95 after long-term operation (1000h), and deviation correction of -0.05A after temperature compensation. A polynomial fitting tool is used to fit the load rate-control deviation data to obtain the fitting curve y = -0.00005x² + 0.001x + 0.45 (where x is the load rate). Based on the curve, the theoretical control deviation value at the rated load rate (100%) is calculated: y = -0.00005 × 100² + 0.001 × 100 + 0.45 = 0.2A, with the result rounded to one decimal place.
[0127] Furthermore, the transmission stability coefficient and communication reliability parameters are integrated and calculated. First, the two are normalized, and then the communication influence factor is obtained by weighted summation. The weight is determined according to the ratio of CAN communication priority to power control priority in the ship mobile energy storage system. The theoretical control deviation value is summed with the deviation correction amount after temperature compensation to obtain the environmentally corrected control deviation benchmark value.
[0128] In this embodiment of the invention, by adjusting the transmission stability coefficient (2) and the communication reliability parameter (1×10⁻⁶), -9Normalization: Normalized value of transmission stability coefficient = 2 ÷ (2 + 1 × 10) -9 )≈1, normalized value of communication reliability parameter = 1×10 -9 ÷(2+1×10 -9 )≈5×10 -10 Based on the ratio of CAN communication priority to power control priority (1:2) of the ship's mobile energy storage system, the weights are determined to be 0.33 and 0.67, respectively. The weighted summation yields the communication impact factor: 1 × 0.33 + 5 × 10⁻⁶. -10 ×0.67≈0.33. Summing the theoretical control deviation value (0.2A) with the temperature-compensated deviation correction (-0.05A), we obtain the environmentally corrected control deviation baseline value: 0.2-0.05=0.15A.
[0129] Furthermore, the control deviation benchmark value after environmental correction is dynamically adjusted based on the communication impact factor. The adjustment formula is: control deviation benchmark value after environmental correction × (1 + communication impact factor × control accuracy attenuation coefficient) to obtain the deviation adjustment benchmark value. The deviation adjustment benchmark value is then multiplied by the preset safety redundancy coefficient, which is determined according to the fault level classification standard of the ship mobile energy storage system to generate the tolerance threshold.
[0130] In this embodiment of the invention, the control deviation baseline value (0.15A) after environmental correction is dynamically adjusted based on the communication impact factor (0.33). Substituting this into the adjustment formula: 0.15×(1+0.33×0.95)=0.15×(1+0.3135)=0.15×1.3135≈0.197A, the deviation adjustment baseline value of 0.197A is obtained. According to the fault level classification standard of ship mobile energy storage system (general faults allow for larger deviations), the safety redundancy coefficient is determined to be 1.2. The tolerance threshold is generated by multiplication: 0.197×1.2≈0.24A, which is used for subsequent current control accuracy qualification judgment. The result is rounded to two decimal places.
[0131] Furthermore, the present invention also provides an automated testing method for the CAN communication protocol of a ship mobile energy storage system. This method is implemented based on the automated testing system for the CAN communication protocol of a ship mobile energy storage system described above. The automated testing method for the CAN communication protocol of a ship mobile energy storage system includes the following steps:
[0132] S01: Obtain the CAN communication protocol specification of the ship mobile energy storage system and the parameters of the device under test, construct the protocol parsing model and generate the test configuration file, and obtain the standardized protocol model and executable test configuration set after verification;
[0133] In this embodiment of the invention, the CAN communication protocol specification of the ship mobile energy storage system (including frame ID 0x100-SOC, 0x101-current, etc.) and the parameters of the device under test (inverter) (maximum current 400A, baud rate 500kbps) are obtained. In a MATLAB or Simulink host computer, the message frame ID, signal bit definitions, and other elements are extracted using a protocol parsing tool to construct a protocol parsing model (including the mapping between frame ID 0x100 and SOC, and the encoding algorithm "physical value = encoded value × 0.5"). A test configuration file is generated: the simulated node type is set to BMS, the CAN baud rate to 500kbps, and the current to 0-400A (resolution 0.1A). The frame ID is checked using a verification tool to ensure no duplicates and no signal bit width overflow. The "maximum current 450A" in the configuration file is corrected to 400A. Finally, a standardized protocol model and an executable test configuration set are obtained and stored in the system database.
[0134] S02: Based on the executable test configuration set, build a node behavior logic model, generate a test case sequence covering various signal values, calculate real-time signal values and encapsulate them into a time-series simulated message stream;
[0135] In this embodiment of the invention, a BMS node behavior logic model (including initialization, running, fault, or shutdown states) is constructed in MATLAB or Simulink based on an executable test configuration set. An equivalence class partitioning method is used to generate a test case sequence: normal current range 200A, boundary 400A, and abnormal 450A. Each test case includes an initial state "running," an input current value, an expected state "normal or fault," and an expected output "current value or fault code." The model state is dynamically updated according to the test case execution order: when the input is 200A, the real-time current is 200A; when the input is 450A, a fault state is triggered, and the current limit is 400A. The real-time value is encoded according to the protocol frame structure (0x101 represents 16-bit current), and control messages are sent every 200ms to form a time-sequential simulated message stream, waiting to be sent to the inverter.
[0136] S03: Send the time-series analog message stream to the device under test, receive and parse the response message to extract status signals and control commands, adjust the programmable power source to simulate energy interaction, and collect actual output data to form a power feedback dataset.
[0137] In this embodiment of the invention, a time-sequential analog message stream (frame ID 0x100 - SOC 60%, 0x101 - current 200A) is sent to the inverter's CAN bus via a CAN communication card, recording the transmission timestamps "200ms, 400ms...". The bus is monitored in real time, receiving the inverter's response message (frame ID 0x200 - actual current 199.8A, 0x201 - enable = 1), and the status signal "running" and control command "charging enable = 1" are extracted. Based on the command, the programmable bidirectional power supply is controlled to switch to load mode, setting the voltage to 600V and the target current to 200A. The actual output (199.8V or 199.8A) is obtained through the power data acquisition interface (100Hz sampling), and the timestamp is recorded to form a power feedback dataset, synchronized with the response message time.
[0138] S04: Compare the response message with the expected value to obtain the signal consistency deviation, calculate the power execution error, construct the protocol compliance evaluation matrix, and generate a visual test report containing test results and analysis.
[0139] In this embodiment of the invention, by comparing the response message with the expected value: the actual inverter current is 199.8A, the expected current is 200A, and the signal consistency deviation is 0.2A; the power execution error = |199.8-200| or 200×100%=0.1%. A protocol compliance evaluation matrix is constructed, with rows for "current accuracy, enable response, and fault handling" and columns for "qualified or unqualified," marked as "current accuracy qualified." The results of all test cases are summarized: 29 out of 30 test cases are qualified, and 1 case is seriously out of bounds and unqualified. A test report is generated using MATLAB visualization tools, including a deviation trend chart, an evaluation matrix table, and details of the unqualified items (time 1500ms, request 450A, response 320A). The report is automatically stored and displayed on the interface for testers to analyze.
[0140] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. A ship mobile energy storage system CAN communication protocol automatic test system, characterized in that, The method comprises the following modules: A protocol modeling and test configuration module is used to obtain a CAN communication protocol specification of a ship mobile energy storage system and device parameters to be tested; a protocol analysis model is constructed based on the CAN communication protocol specification, and a test configuration file is generated according to the device parameters to be tested, and the protocol analysis model and the test configuration file are subjected to format checking and logic consistency verification to obtain a standardized protocol model and an executable test configuration set; A simulation node behavior simulation module is used to construct a corresponding node behavior logic model according to the executable test configuration set; test case sequences covering normal ranges, boundary values and abnormal values of signals are automatically generated based on the node behavior logic model and the executable test configuration set, and real-time values of the signals are dynamically calculated according to the test case sequences; the real-time values are encapsulated into simulated CAN messages according to the standardized protocol model, and the message sending time is controlled according to the communication timing requirements to generate a timing simulation message stream; A CAN bus interaction and power closed loop module is used to send the timing simulation message stream to the device to be tested through a CAN communication card, and real-time response messages returned by the device to be tested are received; the response messages are analyzed to extract state signals and control instructions of the device to be tested; the working mode and output parameters of the programmable power source are adjusted based on the state signals and the control instructions, so that the programmable power source simulates the energy interaction behavior in the ship mobile energy storage system; Actual output data of the programmable power source are collected to form a power feedback data set; A test analysis and result evaluation module is used to compare the state signals and the control instructions extracted from the response messages with expected values in the test case sequences to obtain signal consistency deviations; power execution errors are calculated based on the power feedback data set and power parameters in the control instructions; a protocol compliance evaluation matrix is constructed by combining the signal consistency deviations and the power execution errors, including pass status, deviation values and error levels of each test case; A visual test report is generated according to the protocol compliance evaluation matrix, including test coverage statistics, key indicator trend charts and abnormal item detailed analysis.
2. The marine mobile energy storage system CAN communication protocol automated test system according to claim 1, wherein, The protocol modeling and test configuration module comprises the following functions: The CAN communication protocol specification text of the ship mobile energy storage system is imported through a protocol analysis interface, and natural language processing technology is used to extract message frame IDs, data lengths, signal bit definitions, transmission periods and signal physical meanings to form a structured protocol element set; The hardware specification and the function manual of the device to be tested are collected, and the supported communication node types, maximum transmission rates, power interface parameters and fault handling mechanisms of the device are analyzed to obtain the device parameters; A protocol analysis model is constructed based on the structured protocol element set, which includes the mapping relationship between frame IDs and signals, signal encoding / decoding algorithms and checking rules; The test configuration file is generated according to the communication node types and function parameters in the device parameters, which includes simulated node types, CAN bus baud rates, signal minimum values or maximum values or resolutions, test scene types and communication periods; According to the signal bit definition in the structured protocol element set, specific signal constraint information is filled in the test configuration file, including the data type, bit width, offset and physical unit of the signal; The protocol analysis model and the test configuration file are subjected to format checking and logical consistency verification to ensure that the frame structure and the signal bit definition are conflict-free, and to verify whether the parameters in the test configuration file meet the hardware specifications of the device under test, including verifying the simulation node type, verifying the CAN bus baud rate, verifying the minimum value or maximum value or resolution of the signal, verifying the test scenario type and verifying the communication period, the verification communication period being specifically verifying whether the communication period in the test configuration file is within the allowed range based on the maximum transmission rate in the device under test parameters, and if there is a conflict or mismatch, a correction suggestion is generated until a standardized protocol model and an executable test configuration set are obtained.
3. The marine mobile energy storage system CAN communication protocol automated test system of claim 2, wherein, The verification of whether the communication period in the test configuration file is within the allowed range based on the maximum transmission rate in the device under test parameters includes: Extracting the maximum transmission rate from the device under test parameters and converting it into the maximum number of data frames allowed to be transmitted per unit time; According to the communication period in the test configuration file, the theoretical data transmission frequency of each simulation node is calculated to obtain the total data frame transmission rate; The total data frame transmission rate is compared with the maximum transmission rate to calculate the rate occupancy ratio; if the rate occupancy ratio exceeds a preset threshold, the contribution of the communication period of each simulation node to the total rate is analyzed to identify the node with the highest proportion; Based on the contribution analysis result, the communication period suggestion value of the node with the highest proportion is automatically adjusted to reduce the total data frame transmission rate to within the allowed range of the maximum transmission rate; The adjusted rate occupancy ratio is recalculated, and if it still does not meet the requirements, the adjustment process is repeated until a revised version of the test configuration file that meets the transmission rate constraint is generated.
4. The marine mobile energy storage system CAN communication protocol automated test system of claim 1, wherein, The simulation node behavior simulation module includes the following functions: According to the simulation node type in the executable test configuration set, the corresponding node behavior library is called, and a node behavior logic model including initialization state, running state, fault state and shutdown state is constructed based on the node behavior library; Trigger conditions between states are defined in the node behavior logic model, including time trigger, signal value trigger and external instruction trigger, and corresponding state transition logic is set for each trigger condition; Based on the signal value domain constraint in the executable test configuration set, the equivalent class partitioning method is used to divide the value range of each signal into normal interval, boundary point and abnormal interval, and representative test values are generated for each interval; By combining the corresponding state transition logic and the representative test values, a test case sequence is generated, each test case including initial state setting, input signal value, expected state transition and expected output signal; According to the execution order of the test case sequence, the current state and signal value in the node behavior logic model are dynamically updated to calculate the real-time value of each signal; According to the frame structure and signal bit definition in the standardized protocol model, the real-time value is encoded to generate a simulated CAN message in CAN protocol format. According to the communication timing requirements in the executable test configuration set and the trigger conditions in the node behavior logic model, the sending time and frequency of the simulated CAN message are controlled to form a time-sequenced simulated message stream interacting with the device under test.
5. The marine mobile energy storage system CAN communication protocol automated test system of claim 1, wherein, The CAN bus interaction and power closed loop module includes the following functions: Through the CAN communication card, the physical connection with the device under test is established, and the communication parameters in the executable test configuration set are loaded, including the baud rate, sampling point and synchronization jump width, to complete the communication initialization; The time-sequenced simulated message stream generated by the simulation node behavior simulation module is sent to the CAN bus of the device under test through the CAN communication card, and the sending time stamp of each message is recorded; Real-time monitoring of the CAN bus, receiving the response message sent by the device under test, parsing the frame ID and data field of the response message, and extracting the state signal and control instruction from the standard protocol model; Classify and process the state signal to store the discrete signals corresponding to the running mode and fault code as state sequences, and store the continuous signals corresponding to the voltage, current and power values as time sequence data; According to the enable state of each response message in the control instruction and the corresponding current request value under the charge and discharge enable, the power source control instruction is generated, which includes the control instruction corresponding to the communication node of the inverter and the battery system BMS; Send the power source control instruction to the programmable power source to control its switching between different modes and adjust the output parameters to simulate the running control process of different devices under test in the ship mobile energy storage system; Through the data acquisition interface of the programmable power source, the actual output voltage, current and power values are obtained in real time, and the acquisition time stamp is recorded to form a power feedback data set synchronized with the response message time.
6. The marine mobile energy storage system CAN communication protocol automated test system of claim 5, wherein, The power source control instruction includes: If the control instruction corresponding to the communication node of the inverter, analyze and receive the response message corresponding to the energy management system EMS, which includes battery fault message, charge and discharge limit message, battery parameter message and charge and discharge enable message, if the battery fault message has a fault, the charge and discharge is prohibited, otherwise, a qualified EMS flag is generated and the corresponding response message is sent; based on the response message, the corresponding charge and discharge limit message and battery parameter message are received, and it is judged whether the SOC in the battery parameter message reaches 100%, if yes, the target current value is generated when the full charge flag corresponding to the charge and discharge enable message is true, and the charging is stopped, otherwise, the iteration analysis is restarted; If the charging enable corresponding to the charging and discharging enable message is true, the power supply is controlled to charge, the current request value in the control instruction is extracted, the actual current value is obtained, and it is judged whether the actual current value is within the current request value ± 0.5; if the actual current value is within the allowable range, it is taken as the target current value; if it exceeds the allowable range, the charging enable is re-judged; otherwise, if the discharging enable is true, the power supply is controlled to discharge, and it is judged whether the actual current value is within the current request value ± 0.5; if the actual current value is within the allowable range, it is taken as the target current value; if it exceeds the allowable range, a corrected target current value is generated according to a preset limiting strategy, and a limiting event is recorded; If the control instruction corresponds to the battery system BMS as a communication node, the response message corresponding to the inverter is sent in sequence, including fault messages, voltage or current limit messages, parameter messages, and charging and discharging flag messages. If the charging enable corresponding to the charging and discharging flag message is true, the power supply is set to load mode to wait for charging, and the corresponding current request value in the parameter message is automatically updated, specifically the minimum value or the maximum value or the intermediate value. The actual current value is obtained, and it is judged whether the actual current value is within the current request value ± 0.5; if the actual current value is within the allowable range, it is taken as the target current value; if it exceeds the allowable range, it is re-automatically updated; otherwise, if the discharging enable is true, the power supply is set to source mode to wait for discharging, and the corresponding current request value in the parameter message is automatically updated. It is judged whether the actual current value is within the current request value ± 0.5; if the actual current value is within the allowable range, it is taken as the target current value. After charging for 0-1 minutes, if the parameter message corresponding to 0 rises to 100%, the full charging flag is sent to be true. It is judged whether the inverter stops charging and the actual current value is 0; if so, the target current value is generated; otherwise, when the SOC is ≤10%, the current request value = 0.3 inverter capacitance value is set. It is judged whether the strong charging flag in the charging and discharging flag message is false; if so, the inverter does not charge; otherwise, the strong charging flag is set to true, and it is judged whether the inverter is normally charging; if so, the target current value is generated; otherwise, it is re-judged. After passing, the fault message is simulated to judge whether the inverter stops charging and discharging; if so, the qualified flag is generated; if it exceeds the allowable range, a corrected target current value is generated according to a preset limiting strategy, and a limiting event is recorded; The actual voltage value at the last time is obtained from the power feedback data set, and the target voltage value is determined by combining the voltage range in the measured device parameters, to ensure that it is within the safe working interval; According to the charging and discharging mode, the target voltage value and the target current value, a power source control instruction containing mode switching instruction, voltage set value and current set value is generated.
7. The marine mobile energy storage system CAN communication protocol automated test system of claim 6, wherein, The corrected target current value generated according to the preset limiting strategy includes: When the current request value is greater than the maximum value, the excess amount is calculated, specifically the difference between the current request value and the maximum value; If the excess is less than the preset allowance threshold, the target current value is set to the maximum value, and is marked as a slight overrun; If the excess is greater than or equal to the allowance threshold, the target current value is set to a preset proportion of the maximum value, and is marked as a serious overrun; When the current request value is less than the minimum value, the deficiency is calculated, which is the difference between the minimum value and the current request value; If the deficiency is less than the preset tolerance threshold, the target current value is set to the minimum value, and is marked as a slight under-run; If the deficiency is greater than or equal to the tolerance threshold, the target current value is set to a preset proportion of the minimum value, and is marked as a serious under-run; The current values before and after correction and the overrun types are recorded to generate corresponding clipping events.
8. The marine mobile energy storage system CAN communication protocol automated test system of claim 7, wherein, The allowance threshold is generated by the following method: Extract the signal dynamic response parameters of the device under test from the executable test configuration set, including the signal adjustment delay duration, the current fluctuation coefficient under the rated power, and the signal sampling frequency within the communication cycle; Based on the signal adjustment delay duration and the signal sampling frequency within the communication cycle, the theoretical adjustment frequency of the signal within one communication cycle is calculated, and the product operation is performed with the signal sampling frequency to generate the signal dynamic adjustment frequency parameter; Extract the current steady-state deviation data of the device under test in the historical test process from the power feedback data set, including the current steady-state fluctuation range under different power levels, the deviation trend coefficient within the continuous test cycle, and the maximum deviation peak value under extreme working conditions; Perform weighted average calculation on the current steady-state fluctuation range under different power levels, and the weight value is determined according to the proportion of each power level in the actual operation of the ship mobile energy storage system, to obtain the current steady-state average deviation value; Coupling operation is performed on the signal dynamic adjustment frequency parameter and the current steady-state average deviation value. First, the current steady-state average deviation value is corrected by the signal dynamic adjustment frequency parameter, and the correction coefficient is the product of the reciprocal of the signal dynamic adjustment frequency parameter and the preset basic correction factor, to obtain the dynamically corrected current deviation reference value; Then, combined with the maximum deviation peak value under extreme working conditions and the deviation trend coefficient, the deviation risk compensation value is calculated, which is the product of the square of the maximum deviation peak value and the deviation trend coefficient, and the sum operation is performed with the dynamically corrected current deviation reference value; The coupling operation result is normalized with the power reserve coefficient of the device under test, which is obtained from the ratio of the rated power to the maximum allowable overload power in the device under test parameters. The normalized processing adopts the ratio of the deviation risk compensation value to the power reserve coefficient to generate the allowance threshold.
9. The marine mobile energy storage system CAN communication protocol automated test system of claim 7, wherein, The tolerance threshold is generated by the following method: Extract the signal transmission characteristic parameters of the CAN communication protocol from the standardized protocol model, including the message transmission delay range, the signal bit error rate, and the message retransmission probability; determine the transmission delay fluctuation interval based on the message transmission delay range, calculate the median value and the interquartile range of the interval, and take the ratio of the median value to the interquartile range as the transmission stability coefficient; combine the signal bit error rate and the message retransmission probability to generate a communication reliability parameter through product operation; The current control accuracy data of the same type of equipment is called from the historical test database of the measured equipment, including current control deviation under different load rates, control accuracy attenuation coefficient after long-term operation, and deviation correction amount after temperature compensation; the current control deviation under different load rates is polynomial fitted to obtain a load rate-control deviation fitting curve, and the theoretical control deviation value of the equipment under the rated load rate is calculated based on the curve; The transmission stability coefficient and the communication reliability parameter are fused and calculated, the two are normalized, and then a communication influence factor is obtained by weighted summation, the weight is determined according to the ratio of the CAN communication priority to the power control priority in the ship mobile energy storage system; the theoretical control deviation value and the deviation correction amount after temperature compensation are summed to obtain an environment corrected control deviation reference value; The environment corrected control deviation reference value is dynamically adjusted based on the communication influence factor, and the adjustment formula is environment corrected control deviation reference value × (1+communication influence factor × control accuracy attenuation coefficient), to obtain a deviation adjustment reference value; The deviation adjustment reference value is multiplied by a preset safety redundancy coefficient to generate a tolerance threshold, the safety redundancy coefficient is determined according to the fault level division standard of the ship mobile energy storage system.
10. A method for testing a CAN communication protocol of a ship mobile energy storage system automatically, characterized in that, The method is executed based on the ship mobile energy storage system CAN communication protocol automatic test system according to any one of claims 1-9, and the ship mobile energy storage system CAN communication protocol automatic test method comprises the following steps: S01: Obtain the CAN communication protocol specification of the ship mobile energy storage system and the measured equipment parameters, construct a protocol analysis model and generate a test configuration file, and obtain a standardized protocol model and an executable test configuration set after verification; S02: Based on the executable test configuration set, a node behavior logic model is constructed, a test case sequence covering various signal values is generated, real-time signal values are calculated and encapsulated as a time-sequenced simulation message stream; S03: The time-sequenced simulation message stream is sent to the measured equipment, the response message is received and analyzed to extract state signals and control instructions, the programmable power source simulation energy interaction is adjusted, and the actual output data is collected to form a power feedback data set; S04: Compare the response message with the expected value to obtain the signal consistency deviation, calculate the power execution error, and construct a protocol compliance evaluation matrix to generate a visual test report containing test results and analysis.
Citation Information
Patent Citations
Battery cell life intelligent prediction system and method based on multi-physics field data fusion
CN120742132A
Systems and Methods for Detection of Vehicle Bus Protocol Using Signal Analysis
US20210266193A1