CAN bus-based fuel cell engine upper computer monitoring method
Technical Field
The invention belongs to the technical field of fuel cell engine monitoring, and particularly relates to a CAN bus-based fuel cell engine upper computer monitoring method.
Background
The fuel cell engine is a novel engine taking hydrogen as fuel, is considered as a new energy source in the future, and has more components, and the running state of each component can influence the performance of the fuel cell engine, so that a good monitoring method can greatly reduce initial development and debugging of the fuel cell engine before loading to a certain extent.
Disclosure of Invention
The invention aims to provide a method for realizing real-time monitoring of a fuel cell engine, displaying the running state of each part of the fuel cell engine on an upper computer in real time, controlling the fuel cell engine, providing self-protection, and analyzing the performance of the fuel cell and diagnosing faults.
In order to achieve the purpose, the invention adopts the technical scheme that: a fuel cell engine upper computer monitoring method based on CAN bus comprises the upper computer is connected with a fuel cell controller through the CAN bus, and adopts a multi-thread structure of parallel processing to receive and transmit CAN messages of the fuel cell controller; the upper computer receives and analyzes the CAN message sent by the fuel cell controller in real time by using the receiving thread, sends the analyzed data to the main thread for displaying real-time data, a real-time curve and a historical curve, and stores the received data in a database by using the data storage thread; the main thread of the upper computer also comprises a function button and a digital input frame, and the sending thread sends a control command of the function button in the main thread and a target control value of a fuel cell engine component to the fuel cell controller through the CAN bus, so that manual control, automatic control, manual forced control in an automatic control mode, fault alarm and self-protection of the fuel cell engine are realized.
In the above monitoring method for a fuel cell engine upper computer based on a CAN bus, the thread working method includes: the receiving thread receives and analyzes the message sent by the fuel cell controller in real time and sends the analyzed data to the main thread and the data storage thread; the data storage thread receives the data analyzed by the thread, binds each numerical value by using an SQL statement and stores the numerical value into a corresponding position of a database; the main thread displays the working state and parameter information of each component of the fuel cell engine at the moment, and refreshes a display interface at a set timing time according to the data analyzed by the receiving thread; the main thread receives the target control value, the real-time curve display command and the historical curve display command, the data storage thread extracts the stored data and sends the data to the main thread, and the real-time curve and the historical curve of the received parameters of all parts of the fuel cell engine are drawn and displayed according to the time sequence.
In the above CAN bus-based fuel cell engine upper computer monitoring method, the manual control method includes: the main thread receives a CAN opening command, the upper computer is connected with a CAN bus to communicate with the fuel cell controller, the receiving thread receives a CAN message of the fuel cell controller and analyzes the message according to a CAN protocol of the communication between the CAN message and the fuel cell controller, and parameters and states of sensors and actuators of a hydrogen supply system, an air supply system, a cooling system and an electrical system of the current fuel cell engine are obtained and sent to the main thread for display; and receiving a manual control command, and sending a message to the fuel cell controller by the upper computer according to a CAN protocol according to the on-off command button states of the hydrogen electromagnetic valve, the hydrogen proportional valve, the hydrogen circulating pump, the hydrogen heating exhaust electromagnetic valve, the inlet water pump, the outlet water pump, the main heat exchanger, the DC water pump, the air compressor cold water pump, the air compressor inlet throttle valve, the air compressor and the air outlet throttle valve, and the setting values of the hydrogen proportional valve opening, the air compressor inlet throttle valve opening, the air outlet throttle valve opening, the air compressor rotating speed, the hydrogen circulating pump rotating speed, the heat exchanger and the water pump rotating speed digital.
In the above CAN bus-based fuel cell engine upper computer monitoring method, the automatic control method comprises: the upper computer is connected with the CAN bus to communicate with the fuel cell controller, the receiving thread receives the CAN message of the fuel cell controller, analyzes and acquires the parameters and states of each sensor and actuator of the hydrogen supply system, the air supply system, the cooling system and the electrical system of the current fuel cell engine according to the CAN protocol of the communication between the upper computer and the fuel cell controller, and sends the parameters and states to the main thread for displaying; the upper computer sends the CAN message in the automatic control mode to the fuel cell controller through a sending thread, receives the self-checking success state sent by the fuel cell controller through a CAN bus and displays the self-checking success state or receives the self-checking failure state sent by the fuel cell controller through the CAN bus; the upper computer receives a starting command after receiving the self-checking success feedback state of the fuel cell controller, sends the starting command to the fuel cell controller through the CAN bus, and receives a starting completion state sent by the fuel cell controller through the CAN bus for displaying; when receiving a shutdown command, the upper computer sends the shutdown command to the fuel cell controller through the CAN bus, and receives the shutdown completion state sent by the fuel cell controller through the CAN bus to display; and the receiving fuel cell controller sends a fault self-shutdown completion state through the CAN bus to display.
In the above method for monitoring the upper computer of the fuel cell engine based on the CAN bus, the manual forced control method in the automatic control mode includes: in the automatic control mode, the upper computer sends forced manual button signals and target control values of a hydrogen supply system, an air supply system, a cooling system and an electric system to the fuel cell controller through the CAN bus.
In the above CAN bus-based fuel cell engine upper computer monitoring method, the fault alarm method includes: the upper computer receives and analyzes the message on the CAN bus of the fuel cell controller in real time through the receiving thread, matches the fault code sent by the fuel cell controller with the fault library established in the main thread for ID and fault numerical value, simultaneously reads the current time of the upper computer, counts the times and interval time of the occurred fault, and sends the matched fault meaning to the interface for displaying the fault meaning, the fault code, the fault time, the fault grade, the fault occurrence times and the fault occurrence interval time.
In the above monitoring method for the upper computer of the fuel cell engine based on the CAN bus, the self-protection method includes: under the automatic control and manual forced control modes, the upper computer receives and analyzes the message of the CAN bus of the fuel cell controller in real time through the receiving thread, and when the outlet pressure of a hydrogen cylinder, the reactor-entering hydrogen pressure, the reactor-entering air pressure, the circulating water inlet and outlet temperature, the water tank liquid level, the total voltage of the electric reactor, the total current of the electric reactor and the difference between the reactor-entering hydrogen and the air pressure of the fuel cell engine, which exceed the preset threshold value of the upper computer and continue for the set time, the sending thread actively sends a self-shutdown request command to the fuel cell controller through the CAN bus.
The invention has the beneficial effects that: the method of the invention utilizes a manual control mode to independently control and adjust the working state and the operating parameters of each executing component of the fuel cell engine, displays each parameter of the fuel cell engine and the operating state of each component in real time, monitors and alarms faults of the fuel cell engine, is convenient for optimally controlling the work of the fuel cell engine under different working conditions, provides control strategy reference and guidance for automatic control and loading debugging, is convenient for initial development and monitoring debugging of the fuel cell engine before loading, and is also suitable for independent control and integral maintenance of the fuel cell engine during vehicle application. The data are stored in the database, so that the data and fault analysis after debugging are convenient, the development period is greatly shortened, and the development cost is favorably reduced. The monitoring data and state information are rich, the anti-interference capability is strong, the control performance is stable, and the method can be widely applied to the development of fuel cell control engines.
Drawings
FIG. 1 is a schematic diagram of the overall structure of one embodiment of the present invention;
FIG. 2 is a schematic diagram of a fuel cell engine according to an embodiment of the present invention;
FIG. 3 is a flow chart of manual control according to one embodiment of the present invention;
FIG. 4 is a flow chart of automatic control and forced manual control according to one embodiment of the present invention;
FIG. 5 is a flow diagram of the failure processing of one embodiment of the present invention;
FIG. 6 is a flow chart of self-protection according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
The upper computer is connected with a fuel cell controller through a CAN bus, receives and transmits CAN messages of the fuel cell controller by adopting a multi-thread structure processed in parallel, displays real-time data and curves and stores information of parameters and states of various components of the fuel cell engine, sends CAN control commands to the fuel cell controller by operating function buttons on an upper computer interface and setting control target values of related components, and performs manual control, automatic control of the fuel cell engine, manual control of partial components under an automatic control mode, fault diagnosis and self-protection.
The embodiment is realized by the following technical scheme that the upper computer monitoring method of the fuel cell engine based on the CAN bus is characterized in that the upper computer is connected with a fuel cell controller through the CAN bus and is in CAN communication with the fuel cell controller by adopting a parallel processing multithreading structure. The upper computer receives and analyzes the CAN message sent by the fuel cell controller in real time by using the receiving thread, sends the analyzed data to the main thread to perform real-time data, fault alarm, real-time curve and historical curve display, and stores the received data in the database by using the data storage thread. The upper computer main thread also comprises a function button and a digital input frame, the sending thread sends a control command of the function button in the main thread and a target control value of relevant components of the fuel cell engine to the fuel cell controller through a CAN bus, and the fuel cell controller controls and detects the state of each component of the fuel cell engine according to the received upper computer control command, thereby realizing manual control, automatic control and manual forced control and self-protection under an automatic control mode of the fuel cell engine.
The thread working method comprises the following steps: after the communication connection with the fuel cell controller is successful, all threads are started, the receiving thread receives and analyzes the message sent by the fuel cell controller in real time, and the analyzed data is sent to the main thread and the data storage thread; the data storage thread receives the data analyzed by the thread, binds each numerical value by using an SQL statement and stores the numerical value into a corresponding position of a database; and displaying the working state and parameter information of each component of the fuel cell engine at the moment on an interface control of the main thread, refreshing a display interface at set timing according to the analyzed data, clicking the corresponding real-time curve display selection button and history curve display selection button, extracting the stored data by the data storage thread and sending the extracted data to the main thread, and drawing the received parameters of each component of the fuel cell engine by the data storage thread according to the time sequence.
The manual control method includes: after the upper computer is opened, clicking a CAN button on a main thread interface, connecting the upper computer with a CAN bus to communicate with a fuel cell controller, after CAN communication is successful, displaying green through the communication connection button, receiving a CAN message of the fuel cell controller through a receiving thread, analyzing according to a CAN protocol of the communication between the CAN message and the fuel cell controller to obtain parameters and states of sensors and actuators of a hydrogen supply system, an air supply system, a cooling system and an electrical system of the current fuel cell engine, and sending the parameters and the states to the main thread to display on the interface. The upper computer of the manual control button is clicked, and then the states of the buttons, the opening degree of the hydrogen proportional valve, the opening degree of the air compressor inlet throttle valve, the opening degree of the air outlet throttle valve, the rotating speed of the air compressor, the rotating speed of the hydrogen circulating pump, the messages of the control variables are sent to the fuel cell controller according to the protocol according to the set values of the data input boxes of the hydrogen electromagnetic valve, the hydrogen proportional valve, the hydrogen circulating pump, the hydrogen heating exhaust electromagnetic valve, the hydrogen outlet water pump, the air compressor inlet throttle valve, the air compressor and the air outlet throttle valve of the hydrogen heating exhaust electromagnetic valve, the opening degree of the hydrogen proportional valve, the main heat exchanger, the DC water pump, the air compressor cold water pump, the air compressor inlet, The method comprises the steps of heating by a hydrogen heating exhaust electromagnetic valve, controlling the opening and closing of a hydrogen circulating pump, an air compressor inlet throttle valve, an air outlet throttle valve, an inlet water pump, an outlet water pump, a DC heat exchanger and a main heat exchanger component, controlling the opening of a hydrogen proportional valve, the air compressor inlet throttle valve and the air outlet throttle valve by outputting PWM signals with certain frequency and duty ratio, and sending a target rotating speed command to the air compressor, the hydrogen circulating pump, a cooling fan and a circulating water pump to control the rotating speed of the air compressor, the hydrogen circulating pump.
The automatic control method includes: after the upper computer is opened, clicking a CAN button on a main thread interface, connecting the upper computer with a CAN bus to communicate with a fuel cell controller, after CAN communication is successful, displaying green through the communication connection button, receiving a CAN message of the fuel cell controller through a receiving thread, analyzing according to a CAN protocol of the communication between the CAN message and the fuel cell controller to obtain parameters and states of sensors and actuators of a hydrogen supply system, an air supply system, a cooling system and an electrical system of the current fuel cell engine, and sending the parameters and the states to the main thread to display on the interface. By clicking an automatic control mode, an upper computer sends a CAN message of the automatic control mode to a fuel cell controller through a sending thread, the fuel cell controller carries out parameter and state self-check on a hydrogen supply system, an air supply system, a cooling system and an electrical system of a fuel cell engine, if the self-check is successful, a self-check success state is sent to the upper computer through a CAN bus for display, otherwise, a self-check failure state is sent to the upper computer through the CAN bus, after the upper computer receives a self-check success feedback state of the fuel cell controller, an operator clicks a start button on an interface of the upper computer, the upper computer sends a start command to the fuel cell controller through the CAN bus, the fuel cell controller automatically adjusts the working states of all components in the hydrogen supply system, the air supply system, the cooling system and the electrical system according to a preset control strategy and flow to enter a running state for power generation, meanwhile, the starting completion state is sent to an upper computer through a CAN bus to be displayed; in the running state, an operator clicks a shutdown button of an interface of the upper computer, the upper computer sends a shutdown command to the fuel cell controller through the CAN bus, the fuel cell controller automatically shuts down the working states of all components in the hydrogen supply system, the air supply system, the cooling system and the electrical system according to a preset control strategy and flow to realize shutdown, and sends a shutdown completion state to the upper computer through the CAN bus to display when the last component is shut down; in the running state, when the fuel cell controller detects that parameters of the hydrogen supply system, the air supply system, the cooling system and the electrical system exceed set thresholds and maintain for a certain time, the fuel cell controller does not need to judge a shutdown button command, automatically shuts down working states of all components in the hydrogen supply system, the air supply system, the cooling system and the electrical system according to a preset control strategy and a preset flow to realize shutdown, and sends a fault self-shutdown completion state to an upper computer for displaying through a CAN bus when the last component is shut down.
The manual forced control method includes: in the automatic control mode, the upper computer sends the command of the forced manual buttons of the relevant components to the fuel cell controller through the CAN bus by operating the forced manual buttons and the target control values of the relevant components of the hydrogen supply system, the air supply system, the cooling system and the electrical system on the main thread interface, and the fuel cell controller replaces the working states of the components in the automatic control program according to the received command of the forced manual buttons and the target control values of the relevant components, and simultaneously keeps the working states of other components which do not receive the forced manual buttons and the target control values of the forced manual buttons unchanged.
The fault alarm method comprises the following steps: the upper computer receives and analyzes the message on the CAN bus of the fuel cell controller in real time through the receiving thread, matches the fault code sent by the fuel cell controller with the fault library established in the main thread for ID and fault numerical value, simultaneously reads the current time of the computer, counts the times and interval time of the occurred fault, and sends the matched fault meaning to the interface for displaying the fault meaning, the fault code, the fault time, the fault grade, the fault occurrence times and the fault occurrence interval time.
The self-protection method comprises the following steps: under the automatic control and manual forced control modes, the upper computer receives and analyzes messages on a CAN bus of the fuel cell controller in real time through a receiving thread, and when the outlet pressure of a hydrogen cylinder of a hydrogen supply system, an air supply system, a cooling system and an electrical system of a fuel cell engine, the pressure of stack-entering hydrogen, the pressure of stack-entering air, the pressure of circulating water, the temperature of circulating water in and out of a stack, the liquid level of a water tank, the total voltage of the stack, the total current of the stack and the difference between the stack-entering hydrogen and the air pressure exceed a preset threshold value of the upper computer and are continuously set for time, the upper computer actively sends a shutdown request command to the fuel cell controller through the CAN bus through a sending thread to prompt the fuel cell controller to carry out self-shutdown.
In specific implementation, as shown in fig. 1, the upper computer is connected to the fuel cell controller via a CAN bus, and CAN communicates with the fuel cell controller via a parallel-processing multithread structure. The upper computer receives and analyzes the CAN message sent by the fuel cell controller in real time by using the receiving thread, sends the analyzed data to the main thread for displaying real-time data, a real-time curve and a historical curve, and stores the received data in the database by using the data storage thread. The upper computer main thread also comprises a function button and a digital input frame, the sending thread sends a control command of the function button in the main thread and a target control value of relevant components of the fuel cell engine to the fuel cell controller through a CAN bus, and the fuel cell controller controls and detects the state of each component of the fuel cell engine according to the received upper computer control command, thereby realizing manual control, automatic control and manual forced control under an automatic control mode of the fuel cell engine.
After the communication connection with the fuel cell controller is successful, all threads are started, the receiving thread receives and analyzes the message sent by the fuel cell controller in real time, and the analyzed data is sent to the main thread and the data storage thread; the data storage thread receives the data analyzed by the thread, binds each numerical value by using an SQL statement and stores the numerical value into a corresponding position of a database; and displaying the working state and parameter information of each component of the fuel cell engine at the moment on an interface control of the main thread, refreshing a display interface at set timing according to the analyzed data, clicking the corresponding real-time curve display selection button and history curve display selection button, extracting the stored data by the data storage thread and sending the extracted data to the main thread, and drawing the received parameters of each component of the fuel cell engine by the data storage thread according to the time sequence.
As shown in fig. 2, after the upper computer is opened, the CAN button is opened on the main thread interface by clicking, at this time, the upper computer is connected with the CAN bus to communicate with the fuel cell controller, after the CAN communication is successful, the communication connection button displays green, at this time, the receiving thread receives the CAN message of the fuel cell controller, analyzes the CAN message according to the CAN protocols of the communication between the CAN message and the fuel cell controller to obtain the parameters and the states of the sensors and the actuators of the hydrogen supply system, the air supply system, the cooling system and the electrical system of the current fuel cell engine, and sends the parameters and the states to the main thread to display on the. Sending messages of the control variables to a fuel cell controller according to a protocol by clicking a manual control button upper computer and then according to the on-off command button states of a hydrogen electromagnetic valve, a hydrogen proportional valve, a hydrogen circulating pump, a hydrogen heating exhaust electromagnetic valve, an inlet water pump, an outlet water pump, a main heat exchanger, a DC water pump, an air compressor cold water pump, an air compressor inlet throttle valve, an air compressor and an air outlet throttle valve component and the setting values of a hydrogen proportional valve opening, an air compressor inlet throttle valve opening, an air outlet throttle valve opening, an air compressor rotating speed, a hydrogen circulating pump rotating speed, a cooling fan and a circulating water pump rotating speed digital input frame, analyzing the operating commands of the upper computer by the fuel cell controller according to the protocol, and controlling the hydrogen electromagnetic valve, the proportional control valve, the hydrogen heating exhaust, The method comprises the steps of heating by a hydrogen heating exhaust electromagnetic valve, controlling the opening and closing of a hydrogen circulating pump, an air compressor inlet throttle valve, an air outlet throttle valve, an inlet water pump, an outlet water pump, a DC heat exchanger and a main heat exchanger component, controlling the opening of a hydrogen proportional valve, the air compressor inlet throttle valve and the air outlet throttle valve by outputting PWM signals with certain frequency and duty ratio, and sending a target rotating speed command to the air compressor, the hydrogen circulating pump, a cooling fan and a circulating water pump to control the rotating speed of the air compressor, the hydrogen circulating pump.
As shown in fig. 3, after the upper computer is opened, the CAN button is opened on the main thread interface by clicking, at this time, the upper computer is connected with the CAN bus to communicate with the fuel cell controller, after the CAN communication is successful, the communication connection button displays green, at this time, the receiving thread receives the CAN message of the fuel cell controller, analyzes the CAN message according to the CAN protocols of the communication between the CAN message and the fuel cell controller to obtain the parameters and the states of the sensors and the actuators of the hydrogen supply system, the air supply system, the cooling system and the electrical system of the current fuel cell engine, and sends the parameters and the states to the main thread to display on the interface. By clicking an automatic control mode, an upper computer sends a CAN message of the automatic control mode to a fuel cell controller through a sending thread, the fuel cell controller carries out parameter and state self-check on a hydrogen supply system, an air supply system, a cooling system and an electrical system of a fuel cell engine, if the self-check is successful, a self-check success state is sent to the upper computer through a CAN bus for display, otherwise, a self-check failure state is sent to the upper computer through the CAN bus, after the upper computer receives a self-check success feedback state of the fuel cell controller, an operator clicks a start button on an interface of the upper computer, the upper computer sends a start command to the fuel cell controller through the CAN bus, the fuel cell controller automatically adjusts the working states of all components in the hydrogen supply system, the air supply system, the cooling system and the electrical system according to a preset control strategy and flow to enter a running state for power generation, meanwhile, the starting completion state is sent to an upper computer through a CAN bus to be displayed; in the running state, an operator clicks a shutdown button of an interface of the upper computer, the upper computer sends a shutdown command to the fuel cell controller through the CAN bus, the fuel cell controller automatically shuts down the working states of all components in the hydrogen supply system, the air supply system, the cooling system and the electrical system according to a preset control strategy and flow to realize shutdown, and sends a shutdown completion state to the upper computer through the CAN bus to display when the last component is shut down; in the running state, when the fuel cell controller detects that parameters of the hydrogen supply system, the air supply system, the cooling system and the electrical system exceed set thresholds and maintain for a certain time, the fuel cell controller does not need to judge a shutdown button command, automatically shuts down working states of all components in the hydrogen supply system, the air supply system, the cooling system and the electrical system according to a preset control strategy and a preset flow to realize shutdown, and sends a fault self-shutdown completion state to an upper computer for displaying through a CAN bus when the last component is shut down.
In the automatic control mode, the upper computer sends the command of the forced manual buttons of the relevant components to the fuel cell controller through the CAN bus by operating the forced manual buttons and the target control values of the relevant components of the hydrogen supply system, the air supply system, the cooling system and the electrical system on the main thread interface, and the fuel cell controller replaces the working states of the components in the automatic control program according to the received command of the forced manual buttons and the target control values of the relevant components, and simultaneously keeps the working states of other components which do not receive the forced manual buttons and the target control values of the forced manual buttons unchanged.
As shown in fig. 4, the upper computer receives and analyzes the message on the CAN bus of the fuel cell controller in real time through the receiving thread, matches the fault code sent by the fuel cell controller with the fault library established in the main thread for ID and fault value matching, reads the current time of the computer, counts the number of times and interval time of the fault, and sends the matched fault meaning to the interface for displaying the fault meaning, the fault code, the fault time, the fault level, the number of times of fault occurrence and the interval time of fault occurrence.
As shown in fig. 5 and 6, in the automatic control mode and the manual forced control mode, the upper computer receives and analyzes the message on the CAN bus of the fuel cell controller in real time through the receiving thread, and when it is detected that the outlet pressure of the hydrogen cylinder of the hydrogen supply system, the air supply system, the cooling system and the electrical system of the fuel cell engine, the pressure of the hydrogen entering the reactor, the pressure of the air entering the reactor, the pressure of the circulating water, the temperature of the circulating water entering and exiting the reactor, the liquid level of the water tank, the total voltage of the reactor, the total current of the reactor, and the difference between the hydrogen entering the reactor and the air pressure exceed the preset threshold value of the upper computer and last set time, the upper computer actively sends a shutdown request command to the fuel cell controller through the CAN bus through the sending thread to prompt.
It should be understood that parts of the specification not set forth in detail are well within the prior art.
Although specific embodiments of the present invention have been described above with reference to the accompanying drawings, it will be appreciated by those skilled in the art that these are merely illustrative and that various changes or modifications may be made to these embodiments without departing from the principles and spirit of the invention. The scope of the invention is only limited by the appended claims.