CN113407214B - Reconfigurable multithreading parallel upper computer system based on can communication - Google Patents

Reconfigurable multithreading parallel upper computer system based on can communication Download PDF

Info

Publication number
CN113407214B
CN113407214B CN202110705246.9A CN202110705246A CN113407214B CN 113407214 B CN113407214 B CN 113407214B CN 202110705246 A CN202110705246 A CN 202110705246A CN 113407214 B CN113407214 B CN 113407214B
Authority
CN
China
Prior art keywords
thread
event
main thread
data
running state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110705246.9A
Other languages
Chinese (zh)
Other versions
CN113407214A (en
Inventor
陈健斌
杨程喻
邹建俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Titan Intelligent Power Co ltd
Original Assignee
Guangdong Titan Intelligent Power Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Titan Intelligent Power Co ltd filed Critical Guangdong Titan Intelligent Power Co ltd
Priority to CN202110705246.9A priority Critical patent/CN113407214B/en
Publication of CN113407214A publication Critical patent/CN113407214A/en
Priority to PCT/CN2022/082174 priority patent/WO2022267578A1/en
Application granted granted Critical
Publication of CN113407214B publication Critical patent/CN113407214B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to a reconfigurable multi-thread parallel upper computer system based on CAN communication, which comprises a main thread and a secondary thread connected with the main thread, wherein the main thread comprises CAN equipment opening, CAN equipment initialization, CAN message transmission and reception, CAN equipment restarting and CAN equipment setting change, the running state of the main thread is determined by running state enumeration in an enumeration variable, the data type of the running state enumeration is a set of integer constants which CAN be named to express different running states of the main thread, and the running state enumeration has four values: and the Init, the Run, the Wait and the Exit are enumerated in different running states and Run in different states, and the running state enumeration is updated according to conditions so as to enter a specified running state in the next main thread cycle. The invention has the advantages that: the running efficiency of the upper computer program is effectively improved, and the fault probability is reduced.

Description

Reconfigurable multithreading parallel upper computer system based on can communication
Technical Field
The invention relates to the technical field of circuit systems, in particular to a reconfigurable multi-thread parallel upper computer system based on can communication.
Background
The upper computer is mainly used for monitoring various characterization parameters, running states, working modes and the like of the digital power supply in real time on line and can also control a digital power supply system. In the past, when no upper computer software based on virtual instrument technology is available, a traditional instrument is used for monitoring and controlling a circuit system.
The software of the upper computer can transmit data, and parameter setting, online calibration and logic test of the digital power supply are realized. In the past, when people debug the power supply system, people often need to be assisted with a plurality of test instruments to perform hardware debugging work so as to know information such as the running state of a circuit in real time. Such meters are numerous and inconvenient to read and store, and direct external coupling into the power system introduces unknown interference, which can greatly hinder research and development efforts.
In addition, some parameters related to the control model are required to be modified and verified during software debugging. For example, in the conventional PID control, control parameters such as a proportional coefficient, an integral coefficient, a differential coefficient and the like need to be adjusted and the working state of the control parameters is observed, and software debugging is performed based on the adjustment. Because the control strategy and parameters cannot be modified online and in real time, the program needs to be re-burned for the digital power supply module every time the control parameters are modified. For conventional power modules, changing the control loop parameters means that the component parameters of the hardware circuit may be modified.
In the use process, the real-time operation state of the circuit also needs to be monitored, and output parameters need to be adjusted and modified. In the past, people monitoring the real-time operating conditions of circuits required multiple instruments embedded in the circuitry. When the parameters to be monitored are more, the instruments often appear to have unsmooth human-computer interaction experience, beautiful appearance and simple/portable/free system operation.
Disclosure of Invention
The invention aims to solve the problems and provides a reconfigurable multi-thread parallel upper computer system based on can communication, which effectively improves the operating efficiency of an upper computer program and reduces the failure probability.
In order to solve the technical problems, the technical scheme provided by the invention is as follows: a reconfigurable multithreading parallel upper computer system based on can communication is characterized in that: the CAN communication method comprises a main thread and an auxiliary thread connected with the main thread, wherein the main thread comprises CAN equipment opening, CAN equipment initialization, CAN message transmission and reception, CAN equipment restarting and CAN equipment setting change, the main thread is a state machine mode of a parallel program for orderly and elegantly carrying out CAN communication, the running state is determined by running state enumeration in an enumeration variable, the data type of the running state enumeration is a set of integer constants which CAN be named to express different running states of the main thread, and the running state enumeration has four values: init, run, wait and Exit, enumerate in different running states and enter different states to Run, will upgrade the running state to enumerate according to the situation at the same time, then enter the appointed running state in the next main thread circulation, the said main thread includes the following steps:
s1, judging a running state enumeration value, judging whether the running state enumeration is Exit, ending the program if the running state enumeration is judged to be Exit, and entering the running state enumeration value if the running state enumeration is not judged to be Exit;
s2, the running state enumerated values in the step S1 comprise Init, run, wait and Exit,
s3, the Init comprises the following steps:
a1, binding CAN configuration information into a CAN communication standard cluster according to names,
a2, creating a user event CANOpen,
a3, reinserting the new CAN communication standard cluster into the main thread data stream,
a4, inserting an event into an event data stream of a main thread, and enumerating and assigning a Wait value by a running state;
the Wait comprises an update of an event structure generated from a user event, the update of the event structure generated from the user event comprises a parallel Open value change event and a change event of other values, the step of opening the CAN by the parallel Open value change event comprises sequentially executing three sub-VI programs, namely an Open sub-VI program, an Init sub-VI program and a Start sub-VI program, the change event of the other values comprises a specific information value which is bound into a CAN communication standard cluster according to the name of the changed other values, and the parallel Open value change event comprises judging an event data stream, enumerating a running state and endowing a Run value and a Wait value;
the Run comprises the following steps:
b1, an event structure, wherein the event structure comprises a button control generated from the front panel and a user event data stream UpdateUIEvent,
b2, when calling CAN transmitting subprogram for corresponding control event to convert the packaged CAN communication standard cluster into CAN message,
b3, sending the CAN message,
b4, assigning a value of Disablie corresponding to an Event attribute node when the UpdateUIEvent is a user data user Event data stream, judging the Event data stream, finally assigning a Run numerical value to Run state enumeration,
b5, when running state enumeration at the last of the steps b3 and b4 is endowed with Run and Wait values, the main thread enters the next round of circulation;
the Exit comprises the following steps:
c1, canceling the registration event, canceling the user event and unbinding the corresponding data from the CAN communication standard cluster according to the name,
c2, closing the CAN equipment, and ending the program if the running state enumeration is endowed with the Exit numerical value;
the secondary threads comprise a receiving thread, a thread for circularly sending inquiry messages, a thread for modifying output parameters and a thread for modifying calibration high-low order parameters,
the receiving thread running process comprises the following steps:
f1, firstly judging whether the state of the main thread is open or not, if so, calling a sub VI,
f2, converting the format of the received CAN message into a CAN communication standard cluster by calling a CAN secondary library, otherwise, judging that the CAN is opened, delaying for 50ms,
f3, after the CAN communication standard cluster is obtained, judging whether the CAN communication standard cluster is empty information or not, if not, continuing to operate, and analyzing and translating the message;
the thread of the circular sending inquiry message has the function of timely acquiring and updating various operation parameters and mode state data of the digital power supply module, and the operation process comprises the following steps:
t1, entering a thread of circularly sending inquiry messages, judging the state of a main thread, then automatically generating a parallel program block diagram of polling parameters according to protocol regulations to obtain data frames and combining the data frames into a character string of the data frame for inquiry,
t2, then, judging the state of the main thread, entering a sending program diagram independent of the main thread,
t3, finally, judging the state of the main thread, updating the data of the multi-column list box,
t4, updating the data of the multi-column list frame needs to judge that the queuing number of the data frames does not exceed 500, then judging whether the multi-column list frame needs to be emptied, finally updating the received data to a multi-column list frame control,
the output parameter modification thread modifies various operation parameters and mode state data of the digital power supply module, and the operation process comprises the following steps:
w1, after entering an output parameter modification thread, judging parameter setting enumeration, adding a corresponding program branch to synthesize a character string used for outputting a message, transmitting the data to a main thread, triggering a key event of the main thread,
w2, at the same time, a parallel program with a dialog box is executed in the sub-thread,
w3, except for message synthesis, judging an enumeration variable generated by a pull-down selection control, and generating corresponding prompt information to prompt a user of an input range of a corresponding parameter;
the function of the calibration high-low parameter modification thread is to calibrate the digital power supply module, and the operation process comprises the following steps:
x1, respectively judging the enumeration of a calibration high-low setting numerical value input control and a calibration setting numerical value input control, respectively recording corresponding program branches,
x2, reading the data of the data control in the corresponding program branch, synthesizing a data frame, outputting a character string of the calibration parameter,
and X3, pressing a sending key by the current panel, and enabling the main thread to enter a corresponding event branch to receive the character string and send the CAN message.
After adopting the structure, the invention has the following advantages: the system of the invention is CAN upper computer software for a digital power supply module, which is compiled by a graphical high-level programming language labview, and the invention is characterized in that:
1. the multiple threads are formed in a serial-parallel series-parallel connection mode, meanwhile, the phenomenon of data competition hazard is avoided,
2. the reconfigurable design can be carried out according to the required functions, the number and the composition mode of the threads can be increased and decreased according to the actual requirements,
3. can be adapted and reconfigurable according to the protocol content and the actual hardware, can be adapted to different digital power supply systems by replacing a protocol interpretation mode and a secondary library,
4. a main software framework and a plurality of auxiliary software frameworks to improve the stability of the upper computer system,
5. the main thread is a state machine mode of a parallel program that CAN perform CAN communication orderly and elegantly.
The main thread of the invention is the only one program thread which can always operate in the whole using process of the whole program, other program threads can determine whether to operate according to information such as running state enumeration, intermediate quantity state and the like, and the multithreading mode of 'one main thread always operates and a plurality of auxiliary threads operate intermittently' can effectively improve the operating efficiency of the upper computer program and reduce the failure probability.
The method comprises the following steps that as an improvement, a main thread is in an Init state, the main function of the main thread is to open CAN equipment and initialize the CAN equipment, specific operations comprise decomposing and rebinding a CAN communication standard cluster, a UI updating event UpdateUIEvent is generated by calling an attribute node and a dynamic registration event, the CAN communication standard cluster is updated in time, the state of UI data is adjusted, meanwhile, a Wait is enumerated and assigned for a running state, and the main thread enters a Wait mode.
As an improvement, when the main thread is in the Wait state, the main thread has a main function of waiting for the preparation of the CAN device, and determining the operating state of the CAN device to determine what main thread state to enter next and update the information in the CAN communication standard cluster, the main thread in the Wait state is a program with an event structure, and the event type of the event structure mainly includes a specific information value change in the CAN communication standard cluster and a front panel closing event.
As an improvement, when the main thread is in a Run state, the main function of the main thread is to judge and receive data from each secondary thread, package the data into a CAN communication standard cluster, and call a CAN sending subprogram to convert the packaged CAN communication standard cluster into a CAN message to be sent out.
As an improvement, the secondary thread also comprises a calibration reset thread, an identifier synthesis thread, a module serial number setting parameter modification thread, a module state information separation and display thread, a logic variable output thread and a power module startup and shutdown thread.
Drawings
Fig. 1 is a program function diagram of a main thread of a reconfigurable multi-thread parallel upper computer system based on can communication.
Fig. 2 is a program block diagram of a main thread of the reconfigurable multi-thread parallel upper computer system based on can communication.
Fig. 3 is a receiving thread program block diagram of the reconfigurable multi-thread parallel upper computer system based on can communication.
Fig. 4 is a program block diagram of a cycle query message sending thread of the reconfigurable multi-thread parallel upper computer system based on can communication.
FIG. 5 is a program diagram of an output parameter modification thread of the reconfigurable multi-thread parallel upper computer system based on can communication.
Fig. 6 is a program block diagram of a calibration high-low order parameter modification thread of the reconfigurable multi-thread parallel upper computer system based on can communication.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings.
With reference to all the accompanying drawings, a reconfigurable multithreading parallel upper computer system based on CAN communication comprises a main thread and a plurality of secondary threads connected with the main thread, wherein the main thread comprises CAN equipment opening, CAN equipment initialization, CAN message transmission and reception, CAN equipment restart and CAN equipment setting change, the running state of the main thread is determined by running state enumeration in an enumeration variable, the data type of the running state enumeration is a set of integer constants which CAN be named to express different running states of the main thread, and the running state enumeration has four values: init, run, wait and Exit, enumerating in different running states, entering different states to Run, updating running state enumeration according to conditions, and entering a specified running state in the next main thread cycle, wherein the main thread comprises the following steps:
s1, judging a running state enumeration value, judging whether the running state enumeration is an Exit, ending the program if the running state enumeration is judged to be the Exit, and entering the running state enumeration value if the running state enumeration is not judged to be the Exit;
s2, the running state enumerated values in the step S1 comprise Init, run, wait and Exit,
s3, the Init comprises the following steps:
a1, binding CAN configuration information into a CAN communication standard cluster according to names,
a2, creating a user event CANOpen,
a3, reinserting the new CAN communication standard cluster into the main thread data stream,
a4, inserting an event into an event data stream of a main thread, and enumerating and assigning a Wait value by a running state;
the Wait comprises an update of an event structure generated from a user event, the update of the event structure generated from the user event comprises a parallel Open value change event and change events of other values, the step of opening the CAN by the parallel Open value change event is to sequentially execute three sub-VI programs, namely an Open sub-VI program, an Init sub-VI program and a Start sub-VI program, the change events of the other values comprise specific information values of the changed other values bound into a CAN communication standard cluster according to names, and the parallel Open value change event comprises judging an event data stream, enumerating running states and endowing Run and Wait values;
the Run comprises the following steps:
b1, an event structure, wherein the event structure comprises a button control generated from the front panel and a user event data stream UpdateUIEvent,
b2, when calling a CAN transmitting subprogram for the corresponding control event to convert the packaged CAN communication standard cluster into a CAN message,
b3, sending the CAN message,
b4, assigning a value of Disablie corresponding to an Event attribute node when the UpdateUIEvent is a user data user Event data stream, judging the Event data stream, finally assigning a Run numerical value to Run state enumeration,
b5, when running state enumeration at the last of the steps b3 and b4 is endowed with Run and Wait values, the main thread enters the next round of circulation;
the Exit comprises the following steps:
c1, canceling the registration event, canceling the user event and unbinding the corresponding data from the CAN communication standard cluster according to the name,
c2, closing the CAN equipment, and ending the program if the running state enumeration is endowed with the Exit numerical value;
the secondary threads comprise a receiving thread, a thread for circularly sending inquiry messages, a thread for modifying output parameters and a thread for modifying calibration high-low order parameters,
the receiving thread running process comprises the following steps:
f1, judging whether the state of the main thread is open or not, if so, calling the sub VI,
f2, converting the format of the received CAN message into a CAN communication standard cluster by calling a CAN secondary library, if not, judging that the CAN is opened, delaying for 50ms,
f3, after the CAN communication standard cluster is obtained, judging whether the CAN communication standard cluster is empty information or not, if not, continuing to operate, and analyzing and translating the message;
the function of the thread of the circular sending inquiry message is to timely acquire and update various operation parameters and mode state data of the digital power supply module, and the operation process comprises the following steps:
t1, after entering a thread of circularly sending inquiry messages, judging the state of a main thread, then obtaining data frames and combining the data frames into a character string of the data frame for inquiry through a parallel program diagram automatically generating polling parameters according to protocol regulations,
t2, then, judging the state of the main thread, entering a sending program diagram independent of the main thread,
t3, finally, judging the state of the main thread, updating the data of the multi-column list box,
t4, updating the data of the multi-column list frame needs to judge that the queuing number of the data frames does not exceed 500, then judging whether the multi-column list frame needs to be emptied, finally updating the received data to a multi-column list frame control,
the output parameter modification thread modifies various operation parameters and mode state data of the digital power supply module, and the operation process comprises the following steps:
w1, after entering the output parameter modification thread, firstly judging parameter setting enumeration, then adding corresponding program branches to synthesize character strings used for outputting messages, transmitting the data to the main thread, triggering key events of the main thread,
w2, at the same time, a parallel program with a dialog box is executed in the sub-thread,
w3, except for message synthesis, judging an enumeration variable generated by a pull-down selection control, and generating corresponding prompt information to prompt a user of an input range of a corresponding parameter;
the function of the calibration high-low parameter modification thread is to calibrate the digital power supply module, and the operation process comprises the following steps:
x1, respectively judging the enumeration of a calibration high-low setting numerical value input control and a calibration setting numerical value input control, respectively recording corresponding program branches,
x2, reading the data of the data control in the corresponding program branch, synthesizing a data frame, outputting a character string of the calibration parameter,
and X3, pressing a sending key by the current panel, and enabling the main thread to enter a corresponding event branch to receive the character string and send the CAN message.
The main thread is in an Init state, the main function of the main thread is to open CAN equipment and initialize the CAN equipment, the specific operation comprises the steps of decomposing and rebinding a CAN communication standard cluster, generating a UI updating event UpdateUIEvent by calling an attribute node and a dynamic registration event, updating the CAN communication standard cluster in time and adjusting the state of UI data, meanwhile, assigning Wait for running state enumeration, and enabling the main thread to enter a Wait mode.
And the main thread in the Wait state is a program with an event structure, and the event type of the event structure mainly comprises the change of a specific information value in the CAN communication standard cluster and a front panel closing event.
And under the Run state of the main thread, the main function of the main thread is to judge and receive data from each auxiliary thread, package the data into a CAN communication standard cluster, and call a CAN sending subprogram to convert the packaged CAN communication standard cluster into a CAN message to be sent out.
The secondary thread also comprises calibration reset, identifier synthesis, module serial number setting parameter modification, module state information separation and display, logic variable output and power module startup and shutdown threads.
When the method is specifically implemented, in the Init state, the main function of the main thread is to open the CAN equipment and initialize the CAN equipment. The specific operation comprises the steps of decomposing and rebinding the CAN communication standard cluster, for example, overwriting CAN configuration information decomposed from the CAN communication standard cluster, binding the CAN configuration information back into the CAN communication standard cluster according to names, and generating a UI (user interface) update event (English name UpdateUIEvent) by calling attribute nodes and dynamic registration events so as to update the CAN communication standard cluster and adjust the state of UI data in time. Meanwhile, assigning 'Wait' for 'running state enumeration', and enabling the main thread to enter a Wait mode.
In the Wait state, the main function of the main thread is to Wait for the preparation of the CAN device to be completed, and judge the operation state of the CAN device to determine which main thread state to enter next step and update the information in the CAN communication standard cluster. The main thread in the Wait state is a program of an event structure, which is similar to an interrupt event and is a programming structure which is characterized by real-time performance, the corresponding program CAN be executed only when the corresponding event occurs, and the event types of the event structure mainly comprise ten event types including specific information value change in a CAN communication standard cluster and a front panel closing event. Except for an open value change event in the CAN communication standard cluster, a specific information value in other CAN communication standard clusters is changed by only replacing a corresponding parameter in the CAN communication standard cluster, and then a corresponding UI update event (english name updateevent) is generated.
Among them, the open event of Wait state of the main thread needs to be described with emphasis. The program part is used for carrying out operation of specific steps on the CAN equipment to successfully open the CAN equipment after the CAN equipment is initialized. The general procedure is to execute three sub VI programs in sequence, which are 1.open, 2.init, and 3.start respectively, and determine whether the execution is successful. In addition, the part also needs to generate corresponding user events to regulate and control the whole multithreading system so as to improve the reliability of the system. And judging the assignment of the running state enumeration according to the execution effect. If the CAN equipment is not successfully opened, the CAN equipment stays in the Wait state, and if the CAN equipment is successfully opened, run is assigned to the running state enumeration.
In the Run state, the main function of the main thread is to judge and receive data from each secondary thread, package the data into the CAN communication standard cluster defined by the invention, and call a CAN sending subprogram to convert the packaged CAN communication standard cluster into a CAN message to be sent out. The program is a programmed structure of an event structure, and the operation of the program can be triggered by an event of pressing a certain key. For example, when an event of "key press of output parameter" occurs, a corresponding program flow is entered, and a data frame (a data frame that has been converted into a character string) from the output parameter sub-thread is packaged into a CAN communication standard cluster, and then converted into a CAN message to be sent out. In addition, the occurrence of a "timeout event" allows the main thread to continue running in Run state. Finally, if a CAN close command is received (the command may be from a close button on the front panel or from the closing of the CAN device), a "CAN close event" is entered, specifically, the operations are to call a CAN close sub-function, update a corresponding user event and generate a UI update event (english name UpdateUIEvent).
In addition to the above operations, the main thread updates some corresponding user events and generates a UI update event (english name UpdateUIEvent). These events (events, which are a description of the data flow of a parallel program and are generally used to coordinate the parallel operation of multiple threads) control the operating states of other sub-threads and transfer data with other sub-threads. Therefore, the purpose of coordinated operation of a plurality of threads is achieved, and the parallel operation of the program is realized.
Next, the sub-threads are introduced, and the threads enter the corresponding operating states according to the "running state enumeration" operated by the main thread, and execute the corresponding programs.
Receiving a thread: with reference to fig. 3, in order to receive and analyze the message from the digital power module in time, a thread for receiving and translating the CAN message is required. The sub-thread used by the present invention to implement this function is the "receiving thread".
The operation process of the secondary thread receiving thread comprises the following steps: firstly, judging whether the state of the main thread is open, if so, calling a sub VI (VCI _ Recieve), and converting the format of the received CAN message into a CAN communication standard cluster by calling a CAN secondary library. Otherwise, the CAN is judged to be opened, and the time is delayed by 50ms. And after the CAN communication standard cluster is obtained, judging whether the CAN communication standard cluster is empty information or not. If the message is not empty information, continuing to perform the operation shown in the program diagram, and analyzing and translating the message.
And circularly sending an inquiry message thread: referring to fig. 4, in order to obtain and update various operation parameters and mode status data of the digital power supply module in time, a thread for polling and sending an inquiry CAN message is required. The sub thread for realizing the function is a 'round robin query message sending thread', and the program structure of the 'round robin query message sending thread' is a tiled sequence structure (English name) which is a program structure for executing corresponding program frames (English name frames) according to a specified sequence. The thread of the loop sending inquiry message uses three program frames, which are respectively: synthesizing the string of data frames of the query (order 0), sending a query message (order 1), and updating multi-column listbox data (order 2).
After entering the 'thread for circularly sending inquiry messages', the state of a main thread is judged, and then data frames are obtained and combined into a character string of the data frame for inquiry through a parallel program diagram for automatically generating polling parameters according to protocol regulations. Then, the state of the main thread is judged, and a sending program diagram independent of the main thread is entered. And finally, judging the state of the main thread, and updating the data of the multiple columns of list boxes. Updating data of the multi-column list box needs to judge that the queuing number (frame number) of data frames does not exceed 500, then judges whether the multi-column list box needs to be emptied, and finally updates the received data to a multi-column list box control.
The program for updating the data of the multi-column list box is added into the thread of the circular sending inquiry message, so that the competition-risk effect (similar to the competition-risk effect of a digital circuit, and the phenomenon can also occur in parallel programs) of the data stream can be avoided, and after the same data is transmitted by the data streams of different threads, the time of reaching a certain meeting point is prior, and then some data error phenomena can occur, so that the reliability of the system is improved.
The program structure of the output parameter modification thread is a conditional structure (english name case structure). With reference to fig. 5, the enumeration variable generated by the pull-down selection control of the front panel control is determined, then a corresponding program branch (english name case) is added, a corresponding output character string is synthesized according to the communication protocol, and the character string is transferred to the sending program of the main flow. And finally, the CAN sending process is completed by the main process, so that the problems of hardware conflict and the like of CAN equipment CAN be avoided.
After entering the "output parameter modification thread", it is first judged to enumerate "parameter setting", then add the corresponding program branch (case) to synthesize the character string used for outputting the message, and transmit this data to the main thread, and trigger the key Event of the main thread (Event, this key control that needs the front panel is pressed to start). At the same time, a parallel program with a dialog box is executed in this sub-thread. Besides, message synthesis is carried out, enumeration changes generated by the pull-down selection control are judged, and corresponding prompt information is generated to prompt a user of the input range of the corresponding parameters.
The program structure for calibrating the high and low parameter modification threads "is a conditional structure (called case structure). Referring to fig. 6, the enumeration of the "calibration high/low setting" and the "calibration setting" is determined, and then the corresponding program branches (english name case) are respectively added. And then reading the data control in the corresponding program branch, synthesizing a data frame, and outputting a character string of the calibration parameter. When the sending key is pressed down on the current panel, the main thread enters the corresponding event branch to receive the character string and send the CAN message.
So far, the main threads of the present invention have been introduced, and the threads can satisfy some conventional monitoring and control of the digital power module. In addition, in order to increase the usability of the upper computer system, other secondary threads, such as 'calibration reset', 'identifier synthesis', 'module serial number setting parameter modification', 'module state information separation and display', 'logic variable output' and 'power module on-off' can be added according to the functional requirements of the digital power module, and the functions of the upper computer can be increased by the method.
In summary, the present invention has the following advantages:
reconfigurability: the parallel software structure of the invention can increase and decrease all the secondary threads at will according to specific needs, and construct proper upper computer software according to needs. And the effect of coordinated operation of all threads is achieved by configuring and transmitting information such as running state enumeration and intermediate quantity state.
Downward compatibility: the invention CAN realize the connection with different CAN devices by accessing different secondary libraries, and has wide inclusiveness to hardware downwards.
Serial-parallel coordination: some threads are combined, collectively referred to as a tiled sequential structure (the english name flat sequence), to eliminate adventure competition. In the actual design process, a plurality of single-function threads can be combined in a proper serial-parallel mode, some threads are in a serial relation, and some threads are in a parallel relation. This serial-parallel coordination helps to improve the robustness and reliability of the system.
A reconfigurable mode of multithreading in serial-parallel series-parallel connection is as follows: according to the actual power module requirements, different types of secondary threads can be arranged to be reconstructed in a serial or parallel mode. The program construction method is to reconstruct the sub threads with data conflict in a tiled sequence structure (English name of flat sequence) and make them proceed in sequence to eliminate the competition risk phenomenon of data flow, while the sub threads without data conflict can be constructed in parallel. All threads are then mixed with each other in a connection that is provided in both serial and parallel. In the actual design process, a plurality of single-function threads can be combined in a proper serial-parallel mode, some threads are in a serial relation, and some threads are in a parallel relation. This serial-parallel coordination helps to improve the robustness and reliability of the system.
Since different CAN hardware devices may require different modes of operation (the on device level timing, the off device level timing, and the reflected matching impedance may all be different), different handling modes are required for different CAN devices. The invention CAN realize the connection with different CAN devices by accessing different secondary libraries, and has wide inclusiveness to hardware downwards.
Reconfigurability of the type and number of secondary threads: the parallel software structure of the invention can increase and decrease all the secondary threads at will according to specific needs, and construct proper upper computer software according to needs. And the effect of coordinated operation of all threads is achieved by configuring and transmitting information such as running state enumeration, intermediate quantity state and the like. The reconfigurability has the characteristic of one main thread and multiple auxiliary threads, namely, one main thread works continuously, the multiple auxiliary threads work intermittently, and all the threads work in the series-parallel hybrid mode.
The working principle of the invention is as follows: the CAN communication standard cluster defined by the invention is defined according to the existing CAN communication protocol of the vehicle-mounted conductive charger standard of the electric vehicle, and comprises the system type of an identifier, a source address, a target address, a command type, data, a standard frame/remote frame mark, a data length frame, a channel type and other data, and the data of the plurality of types are bundled again to form a cluster, wherein the cluster is a data structure and is similar to a structure body variable in C language.
The present invention and its embodiments have been described above, but the description is not limitative, and the actual structure is not limited thereto. It should be understood that those skilled in the art should, without departing from the spirit of the present invention, devise the same structural modes and embodiments as the above-mentioned embodiments without inventing, and all such modifications and embodiments are within the scope of the present invention.

Claims (5)

1. A reconfigurable multithreading parallel upper computer system based on can communication is characterized in that: the CAN communication method comprises a main thread and an auxiliary thread connected with the main thread, wherein the main thread comprises CAN equipment opening, CAN equipment initialization, CAN message transmission and reception, CAN equipment restarting and CAN equipment setting change, the main thread is a state machine mode of a parallel program for orderly and elegantly carrying out CAN communication, the running state is determined by running state enumeration in an enumeration variable, the enumerated data type of the running state is a set of integer constants which CAN be named to express different running states of the main thread, and the enumerated running state has four values: init, run, wait and Exit, enumerating in different running states, entering different states to Run, updating running state enumeration according to conditions, and entering a specified running state in the next main thread cycle, wherein the main thread comprises the following steps:
s1, judging a running state enumeration value, judging whether the running state enumeration is Exit, ending the program if the running state enumeration is judged to be Exit, and entering the running state enumeration value if the running state enumeration is not judged to be Exit;
s2, the enumerated values of the running state in the step S1 comprise Init, run, wait and Exit,
s3, the Init comprises the following steps:
a1, binding CAN configuration information into a CAN communication standard cluster according to names,
a2, creating a user event CANOpen,
a3, reinserting the new CAN communication standard cluster into the main thread data stream,
a4, inserting an event into an event data stream of a main thread, and enumerating and assigning a Wait value by a running state;
the Wait comprises an update of an event structure generated from a user event, the update of the event structure generated from the user event comprises a parallel Open value change event and change events of other values, the step of opening the CAN by the parallel Open value change event is to sequentially execute three sub-VI programs, namely an Open sub-VI program, an Init sub-VI program and a Start sub-VI program, the change events of the other values comprise specific information values of the changed other values bound into a CAN communication standard cluster according to names, and the parallel Open value change event comprises judging an event data stream, enumerating running states and endowing Run and Wait values;
the Run comprises the following steps:
b1, an event structure, wherein the event structure comprises a button control generated from the front panel and a user event data stream UpdateUIEvent,
b2, when calling a CAN transmitting subprogram for the corresponding control event to convert the packaged CAN communication standard cluster into a CAN message,
b3, sending the CAN message,
b4, when the user Event data stream UpdateUIEvent is user data, the Disablie value of the corresponding Event attribute node is assigned, then the Event data stream is judged, finally Run state enumeration is given Run value,
b5, when running state enumeration at the last of the steps b3 and b4 is endowed with Run and Wait values, the main thread enters the next round of circulation;
the Exit comprises the following steps:
c1, canceling the registration event, canceling the user event and unbinding the corresponding data from the CAN communication standard cluster according to the name,
c2, closing the CAN equipment, giving Exit numerical values to the running state enumeration, and ending the program;
the secondary threads comprise a receiving thread, a thread for circularly sending inquiry messages, a thread for modifying output parameters and a thread for modifying calibration high-low order parameters,
the receiving thread running process comprises the following steps:
f1, firstly judging whether the state of the main thread is open or not, if so, calling a sub VI,
f2, converting the format of the received CAN message into a CAN communication standard cluster by calling a CAN secondary library, otherwise, judging that the CAN is opened, delaying for 50ms,
f3, after the CAN communication standard cluster is obtained, judging whether the CAN communication standard cluster is empty information or not, if not, continuing to operate, and analyzing and translating the message;
the function of the thread of the circular sending inquiry message is to timely acquire and update various operation parameters and mode state data of the digital power supply module, and the operation process comprises the following steps:
t1, after entering a thread of circularly sending inquiry messages, judging the state of a main thread, then obtaining data frames and combining the data frames into a character string of the data frame for inquiry through a parallel program diagram automatically generating polling parameters according to protocol regulations,
t2, then, judging the state of the main thread, entering a sending program diagram independent of the main thread,
t3, finally, judging the state of the main thread, updating the data of the multi-column list box,
t4, updating the data of the multi-column list frame needs to judge that the queuing number of the data frames does not exceed 500, then judging whether the multi-column list frame needs to be emptied, finally updating the received data to a multi-column list frame control,
the output parameter modification thread modifies various operation parameters and mode state data of the digital power supply module, and the operation process comprises the following steps:
w1, after entering the output parameter modification thread, firstly judging parameter setting enumeration, then adding corresponding program branches to synthesize character strings used for outputting messages, transmitting the data to the main thread, triggering key events of the main thread,
w2, at the same time, a parallel program with a dialog box is executed in the sub-thread,
w3, except for message synthesis, judging an enumeration variable generated by a pull-down selection control, and generating corresponding prompt information to prompt a user of an input range of a corresponding parameter;
the function of the calibration high-low parameter modification thread is to calibrate the digital power supply module, and the operation process comprises the following steps:
x1, respectively judging the enumeration of a calibration high-low setting numerical value input control and a calibration setting numerical value input control, respectively recording corresponding program branches,
x2, reading the data of the data control in the corresponding program branch, synthesizing a data frame, outputting a character string of the calibration parameter,
and X3, pressing a sending key by the current panel, and enabling the main thread to enter a corresponding event branch to receive the character string and send the CAN message.
2. The reconfigurable multithreaded parallel host computer system based on can communication as claimed in claim 1, wherein: the main thread is in an Init state, the main function of the main thread is to open CAN equipment and initialize the CAN equipment, the specific operation comprises the steps of decomposing and rebinding a CAN communication standard cluster, generating a UI updating event UpdateUIEvent by calling an attribute node and a dynamic registration event, updating the CAN communication standard cluster in time and adjusting the state of UI data, meanwhile, assigning Wait for running state enumeration, and enabling the main thread to enter a Wait mode.
3. The reconfigurable multithreaded parallel host computer system based on can communication as claimed in claim 1, wherein: and the main thread in the Wait state is a program with an event structure, and the event type of the event structure mainly comprises the change of a specific information value in the CAN communication standard cluster and a front panel closing event.
4. The reconfigurable multithreaded parallel host computer system based on can communication as claimed in claim 1, wherein: and under the Run state of the main thread, the main function of the main thread is to judge and receive data from each auxiliary thread, package the data into a CAN communication standard cluster, and call a CAN sending subprogram to convert the packaged CAN communication standard cluster into a CAN message to be sent out.
5. The reconfigurable multithreaded parallel host computer system based on can communication as claimed in claim 1, wherein: the secondary thread also comprises calibration reset, identifier synthesis, module serial number setting parameter modification, module state information separation and display, logic variable output and power module startup and shutdown threads.
CN202110705246.9A 2021-06-24 2021-06-24 Reconfigurable multithreading parallel upper computer system based on can communication Active CN113407214B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110705246.9A CN113407214B (en) 2021-06-24 2021-06-24 Reconfigurable multithreading parallel upper computer system based on can communication
PCT/CN2022/082174 WO2022267578A1 (en) 2021-06-24 2022-03-22 Reconfigurable multi-thread-parallelism upper computer system based on can communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110705246.9A CN113407214B (en) 2021-06-24 2021-06-24 Reconfigurable multithreading parallel upper computer system based on can communication

Publications (2)

Publication Number Publication Date
CN113407214A CN113407214A (en) 2021-09-17
CN113407214B true CN113407214B (en) 2023-04-07

Family

ID=77683001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110705246.9A Active CN113407214B (en) 2021-06-24 2021-06-24 Reconfigurable multithreading parallel upper computer system based on can communication

Country Status (2)

Country Link
CN (1) CN113407214B (en)
WO (1) WO2022267578A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407214B (en) * 2021-06-24 2023-04-07 广东泰坦智能动力有限公司 Reconfigurable multithreading parallel upper computer system based on can communication

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854300A (en) * 2010-06-02 2010-10-06 北京工业大学 Method for realizing CANopen slave station
US8683444B1 (en) * 2006-12-11 2014-03-25 Synopsys, Inc. System and method of debugging multi-threaded processes
CN103984665A (en) * 2014-06-05 2014-08-13 哈尔滨工业大学 Serial port communication device and method based on LabVIEW
CN111309353A (en) * 2020-01-20 2020-06-19 山东超越数控电子股份有限公司 Method and device for updating FPGA (field programmable Gate array) firmware of operation board based on server control board
CN111628197A (en) * 2020-05-29 2020-09-04 湖北工业大学 CAN bus-based fuel cell power system platform upper computer monitoring method

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040015940A1 (en) * 2001-05-29 2004-01-22 3Com Corporation Intelligent device upgrade engine
DE102006047218B9 (en) * 2006-10-05 2008-07-10 Hippokratec Gesellschaft für Medizintechnik mbH Apparatus and method for centrally controlling interconnected medical devices
CA2643878A1 (en) * 2008-11-14 2010-05-14 Pierre Caouette An electronic method of controlling propulsion & regeneration for electric, hybrid-electric and diesel-electric marine crafts
US8566841B2 (en) * 2010-11-10 2013-10-22 International Business Machines Corporation Processing communications events in parallel active messaging interface by awakening thread from wait state
CN102722150A (en) * 2012-06-07 2012-10-10 中国东方电气集团有限公司 Multi-way waveform acquiring and displaying and data analyzing and processing system based on universal serial
US9804846B2 (en) * 2014-03-27 2017-10-31 International Business Machines Corporation Thread context preservation in a multithreading computer system
US20160055029A1 (en) * 2014-08-21 2016-02-25 Qualcomm Incorporated Programmatic Decoupling of Task Execution from Task Finish in Parallel Programs
CN106445640B (en) * 2016-10-20 2019-06-18 南京南瑞继保电气有限公司 A kind of embedded type virtual device operation method and system
CN109254834B (en) * 2017-07-13 2021-05-14 普天信息技术有限公司 Multithreading starting synchronization method
CN111640970B (en) * 2020-05-29 2021-07-06 湖北工业大学 CAN bus-based fuel cell engine upper computer monitoring method
CN112014733B (en) * 2020-08-28 2023-07-21 东风电子科技股份有限公司 Method, system and storage medium for realizing fault monitoring of motor driver of pure electric vehicle based on Labview
CN113407214B (en) * 2021-06-24 2023-04-07 广东泰坦智能动力有限公司 Reconfigurable multithreading parallel upper computer system based on can communication

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8683444B1 (en) * 2006-12-11 2014-03-25 Synopsys, Inc. System and method of debugging multi-threaded processes
CN101854300A (en) * 2010-06-02 2010-10-06 北京工业大学 Method for realizing CANopen slave station
CN103984665A (en) * 2014-06-05 2014-08-13 哈尔滨工业大学 Serial port communication device and method based on LabVIEW
CN111309353A (en) * 2020-01-20 2020-06-19 山东超越数控电子股份有限公司 Method and device for updating FPGA (field programmable Gate array) firmware of operation board based on server control board
CN111628197A (en) * 2020-05-29 2020-09-04 湖北工业大学 CAN bus-based fuel cell power system platform upper computer monitoring method

Also Published As

Publication number Publication date
CN113407214A (en) 2021-09-17
WO2022267578A1 (en) 2022-12-29

Similar Documents

Publication Publication Date Title
CN103198009B (en) A kind of universal testing method, system and related device
US7844908B2 (en) Diagram that visually indicates targeted execution
US6173438B1 (en) Embedded graphical programming system
US8612870B2 (en) Graphically specifying and indicating targeted execution in a graphical program
CN109324787A (en) A kind of business software development approach, device and terminal device
US8458667B2 (en) Debugging a statechart for a real time target
CN103677835B (en) Software integration method and system
CN113407214B (en) Reconfigurable multithreading parallel upper computer system based on can communication
CN109040752A (en) Automatic debugging system for smart television
CN109783340A (en) Test code programming method, IP test method and the device of SoC
US20040015816A1 (en) Coordination synthesis for software systems
CN108833005B (en) Optical network communication equipment and automatic test kit and method for networking service thereof
CN108959094A (en) A kind of definition and methods for using them of the test program based on data structure
CN116756067A (en) AI-EC embedded system based on hong Mongolian distributed SoftBus and construction and deployment methods thereof
CN112559264B (en) Simulation test method for realizing FPGA (field programmable Gate array) universal serial port by verification platform based on UVM (Universal verification Module)
CN114629830B (en) Method and system for automatically controlling test center instrument test
CN110008042A (en) A kind of algorithm Cascading Methods and system based on container
CN111443963A (en) Numerical control system of reconfigurable formula
Clément et al. Integrated software components: A paradigm for control integration
CN100456710C (en) Method and system for realizing Tclsh instruction long-distance call
CN111037057A (en) Welder human-computer interaction system and welder
KR20020095723A (en) Method and apparatus for integrated testing of software
CN113572652B (en) Wired Mesh network testing method
Dai et al. Automatic test data generation for TTCN-3 using CTE
Thramboulidis et al. Field device specification for the development of function block oriented engineering support systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant