Reconfigurable multithreading parallel upper computer system based on can communication

文档序号:7216 发布日期:2021-09-17 浏览:23次 中文

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 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 the value of running state enumeration, judging whether the running state enumeration is Exit, ending the program if the running state enumeration is judged to be Exit, and entering the value for judging the running state enumeration if the running state enumeration is judged to be filled with the Exit;

s2, the running state enumerated values in the step S1 include Init, Run, Wait and Exit,

s3, the Init comprises the following steps:

a1, binding the CAN configuration information into a CAN communication standard cluster according to the name,

a2, create 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 including 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 the Event attribute node when the UpdateUIEvent is the user data user Event data stream, then judging the Event data stream, finally assigning Run numerical value to Run state enumeration,

b5, b3 and b4, when running state enumeration is given to Run and Wait values at the end, the main thread enters the next round of circulation;

the Exit comprises the following steps:

c1, canceling registration event, canceling user event and unbinding corresponding data from CAN communication standard cluster according to name,

c2, turning off the CAN equipment, and ending the program if running state enumeration is endowed with an 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, 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, 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 the loop to send inquiry message, judging the main thread state, then obtaining data frames and combining them into the character string of the data frame for inquiry through a parallel program diagram automatically generating polling parameters according to the protocol specification,

t2, then, the main thread status is judged, and a sending program diagram independent of the main thread is entered,

t3, finally, the main thread state is judged, the operation of updating the multi-column list box data is carried out,

t4, updating the multi-column list box data requires judging the queuing number of the data frame is not more than 500, then judging whether the multi-column list box needs to be emptied, finally updating the received data to the multi-column list box 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 for outputting messages, transmitting the data to the main thread, triggering key events of the main thread,

w2, and, at the same time, a parallel program with a dialog box is executed in this sub-thread,

w3, except for message synthesis, judging the enumeration variable generated by the pull-down selection control, and generating corresponding prompt information to prompt the user of the input range of the 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 the calibration high-low setting numerical value input control and the calibration setting numerical value input control, respectively recording the corresponding program branches,

x2, then reading the data of the data control in the corresponding program branch and synthesizing the data frame, outputting the character string of the calibration parameter,

x3, pressing the sending button on the current panel, the main thread entering the corresponding event branch to receive the character string and sending 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: the main thread in the Wait state is a program of an event structure, and the event type of the event structure mainly comprises the change of a specific information value in a CAN communication standard cluster and the closing event of a front panel.

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 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.

6. The reconfigurable multithreaded parallel host computer system based on can communication as claimed in claim 1, wherein: and when the main thread is in the Wait state, the main function of the main thread is to Wait for the CAN equipment to finish preparation, judge the operation state of the CAN equipment to determine which main thread state to enter next step and update the information in the CAN communication standard cluster.

7. 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.

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 need to be modified and verified when software debugging is performed. 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 module when the control parameters are modified each time. 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, 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 the value of running state enumeration, judging whether the running state enumeration is Exit, ending the program if the running state enumeration is judged to be Exit, and entering the value for judging the running state enumeration if the running state enumeration is judged to be filled with the Exit;

s2, the running state enumerated values in the step S1 include Init, Run, Wait and Exit,

s3, the Init comprises the following steps:

a1, binding the CAN configuration information into a CAN communication standard cluster according to the name,

a2, create 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 including 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 the Event attribute node when the UpdateUIEvent is the user data user Event data stream, then judging the Event data stream, finally assigning Run numerical value to Run state enumeration,

b5, b3 and b4, when running state enumeration is given to Run and Wait values at the end, the main thread enters the next round of circulation;

the Exit comprises the following steps:

c1, canceling registration event, canceling user event and unbinding corresponding data from CAN communication standard cluster according to name,

c2, turning off the CAN equipment, and ending the program if running state enumeration is endowed with an 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, 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, 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 the loop to send inquiry message, judging the main thread state, then obtaining data frames and combining them into the character string of the data frame for inquiry through a parallel program diagram automatically generating polling parameters according to the protocol specification,

t2, then, the main thread status is judged, and a sending program diagram independent of the main thread is entered,

t3, finally, the main thread state is judged, the operation of updating the multi-column list box data is carried out,

t4, updating the multi-column list box data requires judging the queuing number of the data frame is not more than 500, then judging whether the multi-column list box needs to be emptied, finally updating the received data to the multi-column list box 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 for outputting messages, transmitting the data to the main thread, triggering key events of the main thread,

w2, and, at the same time, a parallel program with a dialog box is executed in this sub-thread,

w3, except for message synthesis, judging the enumeration variable generated by the pull-down selection control, and generating corresponding prompt information to prompt the user of the input range of the 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 the calibration high-low setting numerical value input control and the calibration setting numerical value input control, respectively recording the corresponding program branches,

x2, then reading the data of the data control in the corresponding program branch and synthesizing the data frame, outputting the character string of the calibration parameter,

x3, pressing the sending button on the current panel, the main thread entering the corresponding event branch to receive the character string and sending 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 construction mode of the threads can be increased or 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 which 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.

As an improvement, the main thread is in the Init state, the main function of the main thread is to open the CAN device and initialize the CAN device, the specific operation includes decomposing and rebinding the CAN communication standard cluster, generating a UI update event UpdateUIEvent by calling an attribute node and a dynamic registration event, so as to update the CAN communication standard cluster and adjust the state of UI data in time, and meanwhile, assigning Wait for running state enumeration, and letting the main thread enter 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 main thread is in the Init state, the main function of the main thread is to open the CAN device and initialize the CAN device, the specific operation includes decomposing and rebinding the CAN communication standard cluster, generating a UI update event UpdateUIEvent by calling an attribute node and a dynamic registration event, so as to update the CAN communication standard cluster and adjust the state of UI data in time, and meanwhile, assigning Wait for running state enumeration, and letting the main thread enter a Wait mode.

As an improvement, when the main thread is 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.

As an improvement, the secondary thread further 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.

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 parameter modification thread of the reconfigurable multithreading 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 the value of running state enumeration, judging whether the running state enumeration is Exit, ending the program if the running state enumeration is judged to be Exit, and entering the value for judging the running state enumeration if the running state enumeration is judged to be filled with the Exit;

s2, the running state enumerated values in the step S1 include Init, Run, Wait and Exit,

s3, the Init comprises the following steps:

a1, binding the CAN configuration information into a CAN communication standard cluster according to the name,

a2, create 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 including 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 the Event attribute node when the UpdateUIEvent is the user data user Event data stream, then judging the Event data stream, finally assigning Run numerical value to Run state enumeration,

b5, b3 and b4, when running state enumeration is given to Run and Wait values at the end, the main thread enters the next round of circulation;

the Exit comprises the following steps:

c1, canceling registration event, canceling user event and unbinding corresponding data from CAN communication standard cluster according to name,

c2, turning off the CAN equipment, and ending the program if running state enumeration is endowed with an 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, 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, 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 the loop to send inquiry message, judging the main thread state, then obtaining data frames and combining them into the character string of the data frame for inquiry through a parallel program diagram automatically generating polling parameters according to the protocol specification,

t2, then, the main thread status is judged, and a sending program diagram independent of the main thread is entered,

t3, finally, the main thread state is judged, the operation of updating the multi-column list box data is carried out,

t4, updating the multi-column list box data requires judging the queuing number of the data frame is not more than 500, then judging whether the multi-column list box needs to be emptied, finally updating the received data to the multi-column list box 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 for outputting messages, transmitting the data to the main thread, triggering key events of the main thread,

w2, and, at the same time, a parallel program with a dialog box is executed in this sub-thread,

w3, except for message synthesis, judging the enumeration variable generated by the pull-down selection control, and generating corresponding prompt information to prompt the user of the input range of the 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 the calibration high-low setting numerical value input control and the calibration setting numerical value input control, respectively recording the corresponding program branches,

x2, then reading the data of the data control in the corresponding program branch and synthesizing the data frame, outputting the character string of the calibration parameter,

x3, pressing the sending button on the current panel, the main thread entering the corresponding event branch to receive the character string and sending 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.

The main thread in the Wait state is a program of an event structure, and the event type of the event structure mainly comprises the change of a specific information value in a CAN communication standard cluster and the closing event of a front panel.

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 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 when the main thread is in the Wait state, the main function of the main thread is to Wait for the CAN equipment to finish preparation, judge the operation state of the CAN equipment to determine which main thread state to enter next step and update the information in the CAN communication standard cluster.

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 implemented specifically, 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 UpdateUIEvent) 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, 1.Open, 2.Init, and 3.Start, in sequence, 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 50 ms. 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 character string of the data frame of the inquiry (sequence 0), sending the inquiry message (sequence 1) and updating the multi-column list box data (sequence 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 multi-column list box. Updating data of the multi-column list frame needs to judge that the queuing number (frame number) of data frames does not exceed 500, then judge whether the multi-column list frame needs to be emptied, and finally update the received data to a multi-column list frame 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 the corresponding program branch (english name case) is added, the 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 the data frame, and outputting the 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, intermediate quantity state and the like.

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 manner of multithreading in serial-parallel series-parallel connection: 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 understand that they can easily make various changes, substitutions and alterations herein without departing from the spirit and scope of the invention as defined by the appended claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种基于多节点服务器模式的自动运维方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!