A Chinese instruction reasoning programming method and system based on language large model reasoning

Through the Chinese instruction inference programming method based on language big model reasoning, the problem of frequent manual modification of existing equipment control programs is solved, automatic programming and rapid modification are realized, and workload and time are significantly reduced.

CN119739368APending Publication Date: 2025-04-01HUNAN JIANSI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411911441.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The existing equipment control program needs to be modified frequently, which is slow and has a large workload.

Method used

The Chinese instruction inference programming method based on language big model reasoning is adopted. The language model is pre-trained by obtaining the business data set, object data set, state data set and action data set corresponding to the device. The trained language model can object recognition and extraction of newly input business text, generate object programs and business programs, and thus automatically program and modify programs.

Benefits of technology

It greatly reduces the workload of manually modifying programs, speeds up the modification speed, and improves the automation of equipment control programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739368A_ABST
    Figure CN119739368A_ABST
Patent Text Reader

Abstract

The present invention discloses a Chinese instruction reasoning programming method based on language large model reasoning, including obtaining a business data set, an object data set, a state data set and an action data set corresponding to a device to pre-train a language model; the trained language model performs object recognition and extraction on a newly input business text, and generates an object program corresponding to the object action through object actions and object states; generates a business state flow chart and a business program through business text and object state reasoning, and generates a control program and instruction data through the business program for controlling a load. In the technical solution of the present invention, the language model is pre-trained through a data set; then, the trained language model performs object recognition and extraction on a newly input business text, so that the language large model based on Chinese can program and modify the program according to the Chinese description by itself, which can greatly reduce the workload of manually modifying the program and speed up the modification speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of programming technology, and in particular to a Chinese instruction reasoning programming method and system based on language large model reasoning. Background Art

[0002] Chinese programming refers to a programming method that uses Chinese (including Chinese characters, pinyin or other Chinese characters) to write program codes. Although traditional programming languages ​​such as C, C++, Java, Python, etc. use English keywords and syntax, Chinese programming aims to make programming more intuitive and easy to understand, especially for native Chinese speakers. The implementation of Chinese programming usually relies on specific compilers or interpreters, which are tools that can convert Chinese code into machine code or bytecode that computers can understand. However, for the corresponding equipment control program, changing part of the equipment or modifying the material requires changing the operation process and data, which has a strong timing relationship, and thus requires frequent manual modification of the program. Therefore, if a large language model based on Chinese can program and modify the program according to the Chinese description, it can greatly reduce the workload of manual program modification and speed up the modification. Summary of the invention

[0003] The main purpose of the present invention is to provide a Chinese instruction reasoning programming method and system based on language large model reasoning, aiming to solve the problem that the existing equipment control program needs frequent manual modification, slow speed and large workload.

[0004] To achieve the above purpose, the Chinese instruction reasoning programming method based on language large model reasoning proposed by the present invention includes: Obtain the business data set, object data set, state data set and action data set corresponding to the device to pre-train the language model; The trained language model performs object recognition and extraction on the newly input business text, and recognizes and extracts the object attributes, object states, object affiliations and object actions of the object; Generate an object program corresponding to the object action through the object action and the object state, wherein the object program is used to return the object action corresponding to the object state when the object state is obtained during execution; Generate a business state flow chart through the business text and the object state reasoning, generate a business program according to the business state flow chart, and the business program is used to implement the business state process at runtime; A control program is generated according to the object program and the business program, instruction data is generated by encoding the control program, and the instruction data is sent to a control device, which is used to control a load.

[0005] Preferably, before the step of obtaining the device corresponding object data set, state data set and action data set to pre-train the language model, the following steps are included: Acquire an original data set of a service text and a service code of a device, and convert the service text into a structured text format, wherein the original data set includes an initialization process, a detection process, a cycle process, and an alarm process; The object data set, the state data set, the action data set and the business data set are generated by the structured original data set.

[0006] Preferably, the trained language model performs object recognition and extraction on the newly input business text, and the steps of recognizing and extracting the object attributes, object states, object dependencies and object actions of the object include: The trained language model performs object recognition and extraction on the newly input business text; Mining is performed from objects connected to the control device to obtain object attributes, object states, object dependencies and object actions.

[0007] Preferably, the object program corresponding to the object action is generated through the object action and the object state, and the object program is used to return to the step of obtaining the object action corresponding to the object state when the object state is acquired during execution, including: According to the object action and the object state, the object action is inferred according to the object state, and the action instruction corresponding to the action object is inferred according to the object action; Verifying the action instruction through the object state; An object program is generated through the action instruction, and the object program is used to return the object action corresponding to the object state when the object state is obtained during execution.

[0008] Preferably, the steps of generating a business state flow chart by reasoning with the business text and the object state, generating a business program according to the business state flow chart, and the business program being used to implement the business state flow at runtime include: Generate a business state, a business signal and a business action by inferring the business text, the object action and the object state; the business state and the business signal each include at least one object state, and the business action includes at least one object action; A business state flow chart is generated through the business state and the business text, and a business program is generated according to the business state flow chart. The business program is used to implement the business state process at runtime, and the business program includes multiple object programs and object sequences.

[0009] Preferably, the instruction data includes header data, instruction function data, condition value data and jump data, and the header data includes thread data, and the thread data is generated through the object sequence.

[0010] Preferably, the step of generating a control program according to the object program and the business program, generating instruction data by encoding the control program, and sending the instruction data to a control device, wherein the control device is used to control a load, comprises: generating a control program according to the object program and the business program, and generating instruction data by encoding the control program; The instruction data is input into the simulation program for verification, and the verified instruction data is sent to the control device, which is used to control the load.

[0011] Preferably, the step of inputting the instruction data into a simulation program for verification, and sending the verified instruction data to a control device, wherein the control device is used to control the load, comprises: Enter the instruction data into the simulation program for verification; And record the running time to the corresponding instruction data; The verified instruction data is sent to a control device, and the control device is used to control the load.

[0012] Preferably, the control program includes port definition, instruction encoding and instruction interpretation.

[0013] It also includes a Chinese instruction reasoning programming system based on language large model reasoning, including: an object program generation module, a business program generation module, a control program generation module, and an instruction data generation module connected in sequence; the object program generation module includes an object recognition unit, an object attribute extraction unit, an object state extraction unit, an object action advance unit and an object program generation unit; the business program generation module includes a business state recognition unit, a business state extraction unit, a state flow chart generation unit and a business program generation unit.

[0014] In the technical solution of the present invention, the language model is pre-trained through the original business data set, object data set, state data set and action data set; then the trained language model is used to perform object recognition and extraction on the newly input business text, and the object program corresponding to the object action is generated through the object action and the object state, and a business state flow chart is generated through reasoning from the business text and the object state, a business program is generated according to the business state flow chart, a control program is generated according to the object program and the business program, and instruction data is generated through the control program encoding, so that the large language model based on Chinese can program and modify the program according to the Chinese description, which can greatly reduce the workload of manual program modification and speed up the modification. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0016] Figure 1 The figure is a flow chart of the Chinese instruction reasoning programming method based on language large model reasoning of the present invention.

[0017] Figure 2 This is a schematic diagram of the program flow of the control device of the Chinese instruction reasoning programming method based on language large model reasoning of the present invention.

[0018] Figure 3 This is a schematic diagram of the objects in the Chinese instruction reasoning programming method based on language large model reasoning of the present invention.

[0019] Figure 4 This is a schematic diagram of business actions in the Chinese instruction reasoning programming method based on language large model reasoning of the present invention.

[0020] Figure 5 This is the program instruction data format in the Chinese instruction reasoning programming method based on language large model reasoning of the present invention.

[0021] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0024] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0025] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0026] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0027] Please refer to Figure 1-Figure 5 The present invention proposes a Chinese instruction reasoning programming method based on language large model reasoning, comprising: S100, obtaining a service data set, an object data set, a state data set, and an action data set corresponding to the device to pre-train a language model; S200, the trained language model performs object recognition and extraction on the newly input business text, and recognizes and extracts the object attributes, object states, object affiliations and object actions of the object; S300, generating an object program corresponding to the object action through the object action and the object state, wherein the object program is used to return the object action corresponding to the object state when the object state is obtained during execution; S400, generating a business state flow chart through the business text and the object state reasoning, and generating a business program according to the business state flow chart, wherein the business program is used to implement the business state process at runtime; S500, generating a control program according to the object program and the business program, generating instruction data through encoding the control program, and sending the instruction data to a control device, wherein the control device is used to control a load.

[0028] In the technical solution of the present invention, the language model is pre-trained through the original business data set, object data set, state data set and action data set; then the trained language model is used to perform object recognition and extraction on the newly input business text, and the object program corresponding to the object action is generated through the object action and the object state, and a business state flow chart is generated through reasoning from the business text and the object state, a business program is generated according to the business state flow chart, a control program is generated according to the object program and the business program, and instruction data is generated through the control program encoding, so that the large language model based on Chinese can program and modify the program according to the Chinese description, which can greatly reduce the workload of manual program modification and speed up the modification.

[0029] In another embodiment of the present invention, the language model in step S100 includes: a multi-head attention model of the Transformer model architecture: Define three aspects of an object: attributes, actions, and states Attributes (A): including location, sensor data, etc.

[0030] Actions (Ac): The actions of the actuator.

[0031] States (S): The current state of the actuator.

[0032] The training set includes the assumption that the input sequence is X=[x1,x2,...,xn], and each xi contains three parts: attributes, actions, and states.

[0033] We define different attention heads for each part; ; ; ; in, Represent the query, key, and value matrices of the attributes respectively; denote action query, key, and value matrices respectively; The query, key, and value matrices representing the state, respectively; is the dimension of the key; Representing attribute attention head: Represents the state attention head; Represents the action attention head.

[0034] Transformed through a linear layer: MultiHead(Q,K,V)=Concat( , , ) ; in, are the weights of the output linear layer.

[0035] 4. Transformer Encoder Layer Use multiple Transformer Encoder layers stacked, each layer contains the above multi-head attention mechanism and position feed-forward network (Position-wise Feed-Forward Network, PFFN): EncoderLayer(X)=LayerNorm(X+MultiHead(X,X,X)) Output=LayerNorm(EncoderLayer(X)+PFFN(EncoderLayer(X))) 5. Identify entities and output attributes, actions, and states After the output of the Transformer Encoder layer, an output layer is added to use a softmax classifier to identify entities and output their attributes, actions, and states, as well as the relationship labels between actions and states.

[0036] Multi-head attention mechanism: It can simultaneously focus on the attributes, actions, and states of an object, improving the model’s ability to process complex information.

[0037] Transformer Encoder: Powerful sequence modeling capabilities, suitable for processing variable-length inputs.

[0038] Modular design: easy to expand and debug.

[0039] Specifically, the object format definition of the object structure in the present invention is: Tn[(object name + description + attributes; coordinate position + actuator (controlled object) + subordinate object: Motor: cylinder; + sensor signal: + action A1: action 1; + state S1: state 1; + Subroutines: )]-->Tn_S1&Tn_S2&Tn_S3 Tn_S1{condition_object_signal}--->|state 1| Tn_A1[action block]; Tn_S2{condition_object_signal}--->|status 2| Tn_A2[action block] Tn_S3{condition_object_signal}--->|status 3| Tn_A3[action block] Tn_A1[action block 1]-->Tn_5[action instruction chain 1]--> Tn_6[6_status return_OK] Tn_A2[action block 2]--> Tn_8[action instruction chain 2]--> Tn_9[9_status return_OK] Tn_A3[action block 3]--> Tn_11[action instruction chain]--> Tn_12[12_status return_OK].

[0040] In another embodiment of the present invention, before step S100, the following steps are included: S110, obtaining an original data set of a service text and a service code of a device, and converting the service text into a structured text format, wherein the original data set includes an initialization process, a detection process, a cycle process, and an alarm process; S120: Generate an object data set, a state data set, an action data set and a business data set through the structured original data set.

[0041] Specifically, the preparation and generation of training datasets is a reverse process; By converting the description text into a structured text format such as JSON, you can easily generate a dataset suitable for fine-tuning.

[0042] Just adjust the data format according to the input requirements of the model.

[0043] Extract the data sets of each controlled object in the motor start / stop control scenario: [{"instruction":"Extract each controlled object in the motor start / stop control scenario", "input": "The start / stop of the motor is controlled by relay KM. Whether the relay coil is energized or not is controlled by the start button (SB1) and the stop button; (SB2) through the PLC. Press the start button (SB1) to start the motor; press the stop button (SB2) to stop the motor.", "output": "Start button (SB1): This is an input device. When the operator presses it, it will send a signal to the PLC to start the motor. Stop button (SB2): This is another input device. When the operator presses it, it will send a signal to the PLC to stop the motor. Relay KM: This is the main output device controlled by the PLC. Whether its coil is energized or not determines the start and stop of the motor. When the PLC receives the start signal and executes the corresponding program logic, it will control the coil of relay KM to energize, thereby starting the motor. On the contrary, when the PLC receives the stop signal, it will disconnect the coil power of relay KM to stop the motor. Motor: This is the final controlled object, and its start and stop are controlled by relay KM."}]; Extract each control state data set in the motor start / stop control scenario: [{"instruction": "Extract each control state in the motor start / stop control scenario", "input": "The start / stop of the motor is controlled by relay KM. Whether the relay coil is energized or not is controlled by the start button (SB1) and the stop button; (SB2) is controlled by PLC. Press the start button (SB1) to start the motor; press the stop button (SB2) to stop the motor.

[0044] "output": "Motor stop state:\n Description: The motor is not running and is in a stationary state.\n Control state: The relay coil is de-energized and the PLC has not received a start signal.\nMotor start state:\n Description: The motor starts running and is in a working state.\n Control state: The relay coil is energized and the PLC receives a start signal.\nStart button pressed state (SB1):\n Description: The start button SB1 is pressed.\n Control state: The PLC receives a start signal and is ready to control the relay coil to energize.\nStop button pressed state (SB2): \n Description: Stop button SB2 is pressed. \n Control status: PLC receives the stop signal and is ready to control the relay coil to de-energize. \n PLC controls the relay coil to energize: \n Description: After PLC receives the start signal, it controls the relay coil to energize. \n Control status: The relay coil is energized and the motor can be started. \n PLC controls the relay coil to de-energize: \n Description: After PLC receives the stop signal, it controls the relay coil to de-energize. \n Control status: The relay coil is de-energized and the motor stops. "}]; Extract the state switching action data set based on the object and state; {"instruction": "Extract the state switching action based on the object and state"; "input": "According to the control requirements and the controlled object, the controlled state of the output device is extracted as follows: \n Electric motor; \n Accused status; \n Start: When the PLC receives the signal from the start button (SB1), the control relay KM coil is energized and the motor starts running.

[0045] \n Stop: When the PLC receives the signal from the stop button (SB2), the control relay KM coil is de-energized and the motor stops running.

[0046] \nRelay KM; :\n Charged state; :\n Power on: When the PLC receives the signal from the start button (SB1), the PLC outputs a signal to energize the coil of relay KM and the motor starts.

[0047] \n Power off: When the PLC receives the signal from the stop button (SB2), the PLC outputs a signal to de-energize the relay KM coil and the motor stops. ", "output": "Motor start action: \n Description: When the PLC receives the signal from the start button (SB1), the control relay KM coil is energized and the motor starts running. \n Action: The PLC controls the relay KM coil to be energized and the motor starts running.

[0048] \nMotor stop action: \nDescription: When the PLC receives the signal from the stop button (SB2), the control relay KM coil is de-energized and the motor stops running. \nAction : PLC controls the relay KM coil to cut off power and the motor stops. \nRelay KM energizes action: \nDescription: When the PLC receives the start button; (SB1) signal, PLC output signal to energize relay KM coil, the motor starts. \nAction: PLC output signal to energize relay KM coil, the motor starts. \nRelay KM de-energize action: \nDescription: When PLC receives the stop button (SB2) signal, PLC output signal to de-energize relay KM coil, the motor stops. \nAction: PLC output signal to de-energize relay KM coil, the motor stops. "}Explanation; instruction: Instructions describing the task, such as "extract each control state in the motor start / stop control scenario". input: Input description text describing the motor start / stop control scenario.

[0049] output: The extracted control states and their descriptions.

[0050] Generate the corresponding JENASI control program data set based on the input Mermaid state diagram.

[0051] [{"instruction": "Convert Mermaid state diagram to JENASI control program"; "input": "A[Start button SB1] -->|Press SB1| B[PLC receives start signal]\nB -->C[Control relay KM is energized; ]\nC --> D[Motor starts]\n\nE[Stop button SB2] -->|Press SB2| F[PLC receives stop signal]\nF --> G[Control relay KM is de-energized]\nG --> H[Motor stops]", "output": "groupId1{group1}-->\nA0_0[ / 0_if_input_X0_rising_edge / ]-->\nC0_1[1_trigger_output_Y0_on]\ngroupId2{group2}-->\nA0_2[ / 2_if_input_X1_rising_edge / ]-->\nC0_3[3_trigger_output_Y0_on]"}]; Instruction: An instruction that describes the task, such as "Convert Mermaid state diagram to JENASI control program".

[0052] input: Mermaid state diagram description of the input.

[0053] output: The converted JENASI control program description.

[0054] In another embodiment of the present invention, the step of S200 includes: S210, the trained language model performs object recognition and extraction on the newly input business text; S220: Mining objects connected to the control device to obtain object attributes, object states, object dependencies, and object actions.

[0055] Specifically, the extracted controlled objects are: Start Push Button (SB1): This is an input device that, when pressed by the operator, sends a signal to the PLC to start the motor.

[0056] Stop Push Button (SB2): This is another input device that, when pressed by the operator, sends a signal to the PLC to stop the motor.

[0057] Relay KM: This is the main output device controlled by PLC. Whether its coil is energized or not determines the start and stop of the motor. When PLC receives the start signal and executes the corresponding program logic, it will control the coil of relay KM to energize, thereby starting the motor. On the contrary, when PLC receives the stop signal, it will disconnect the coil power of relay KM to stop the motor.

[0058] Motor: This is the final controlled object, and its start and stop are controlled by relay KM.

[0059] In this system, PLC is the control core, which realizes the start / stop control of the motor by processing the input signal (from SB1 and SB2) and controlling the output (relay KM).

[0060] Status extraction: The above example extracts the various control states in operation. From the description, the following various states in operation can be extracted: According to the description, the following control states can be extracted during operation: Motor stop state: Description: The motor is not running and is at rest.

[0061] Control status: The relay coil is de-energized and the PLC does not receive the start signal. Motor start status: Description: The motor starts running and is in working condition.

[0062] Control status: The relay coil is energized and the PLC receives the start signal. Start button pressed status (SB1): Description: The start button SB1 is pressed.

[0063] Control status: PLC receives the start signal and is ready to control the relay coil to energize. Stop button pressed status (SB2): Description: Stop button SB2 is pressed.

[0064] Control status: PLC receives the stop signal and is ready to control the relay coil to cut off the power. PLC controls the relay coil to be powered on: Description: After the PLC receives the start signal, the control relay coil is energized. Control status: The relay coil is energized and the motor can be started.

[0065] PLC control relay coil power-off status: Description: After the PLC receives the stop signal, the relay coil is de-energized. Control status: The relay coil is de-energized and the motor stops.

[0066] These control states describe the operation of the system under different operations, from the motor being stationary to running, and then to stopping, as well as the working state of each control element. Through these states, the system can realize the start and stop control of the motor.

[0067] In another embodiment of the present invention, the step of S300 includes: S310, using the object action and the object state, inferring the object action through the object state, and inferring the action instruction corresponding to the action object through the object action; S320, verifying the action instruction through the object state; S330. Generate an object program through the action instruction, wherein the object program is used to return the object action corresponding to the object state if the object state is obtained during execution.

[0068] Specifically, action reasoning.

[0069] According to the control requirements, the controlled object and its state generate a control flow chart and output it in Mermaid format.

[0070] Generate with model: According to the control requirements, the controlled object and the state of the controlled object, the control flow chart can be generated using the Mermaid format.

[0071] The following is a control flow diagram in Mermaid format: graph TD; A[Start button SB1] -->|Press SB1| B[PLC receives start signal] B --> C[Control relay KM is energized]; C --> D[motor start]; E[Stop button SB2] -->|Press SB2| F[PLC receives stop signal] F --> G[Control relay KM is de-energized]; G --> H [Motor stopped].

[0072] In another embodiment of the present invention, the step of S400 includes: S410, generating a business state, a business signal and a business action by inferring the business text, the object action and the object state; the business state and the business signal each include at least one object state, and the business action includes at least one object action; S420, generating a business status flow chart based on the business status and the business text, and generating a business program based on the business status flow chart, wherein the business program is used to implement the business status process at runtime, and the business program includes multiple object programs and object sequences.

[0073] Specific, detailed control process description: Start button (SB1) Press: The operator presses the start button (SB1). The PLC receives the start signal.

[0074] The PLC controls the relay KM coil to be energized and the motor starts to run.

[0075] Stop button (SB2) Press: The operator presses the stop button (SB2). The PLC receives the stop signal.

[0076] The PLC controls the relay KM coil to be de-energized and the motor stops running.

[0077] Mermaid format explained: graph TD: defines a top-down flowchart.

[0078] A[Start button SB1]: Define a node A, which represents the start button SB1.

[0079] A -->|Press SB1| B[PLC receives start signal]: defines an arrow from node A to node B, indicating that after pressing the start button SB1, the PLC receives the start signal.

[0080] B --> C [Control relay KM is energized]: Defines an arrow from node B to node C, indicating that the PLC control relay KM is energized. C --> D [Motor starts]: Defines an arrow from node C to node D, indicating that the motor starts.

[0081] E[Stop button SB2]: Define a node E to represent the stop button SB2.

[0082] E -->|Press SB2| F[PLC receives stop signal]: defines an arrow from node E to node F, indicating that after pressing the stop button SB2, the PLC receives a stop signal.

[0083] F --> G [Control relay KM de-energized]: Defines an arrow from node F to node G, indicating that the PLC control relay KM is de-energized. G --> H [Motor stopped]: Defines an arrow from node G to node H, indicating that the motor is stopped.

[0084] Through this Mermaid format control flow chart, you can clearly see the control logic from the input device (start button and stop button) to the output device (motor).

[0085] In another embodiment of the present invention, the language model in step S100 includes: a business identification and program output model of a Transformer model architecture; Use Bidirectional LSTM (BiLSTM) for business sequence modeling and Conditional Random Field (CRF) for label sequence decoding: Includes: BiLSTM layer and CRF layer; ; ; in, is the hidden state at the ith time step, is the business status; is the emission fraction, It is the transfer score, which infers the action sequence and state sequence of the business through the CRF layer.

[0086] Define the loss function: The negative log-likelihood loss function is usually used, and the goal is to minimize the negative log-likelihood probability of the correct label sequence.

[0087] Select an optimizer: such as Adam, SGD, etc. to update the model parameters. During the training process, the training data is input into the model, the loss is calculated according to the loss function, and then the optimizer is used to update the model parameters. After multiple rounds of training (epochs), the model gradually converges. Use the test set to evaluate the trained model and evaluate it by recall.

[0088] In another embodiment of the present invention, the instruction data includes header data, instruction function data, condition value data and jump data, and the header data includes thread data, and the thread data is generated by the object sequence.

[0089] Specifically, thread pool: The function of thread pool is to limit the number of execution threads in the system, and one thread represents a work chain. According to the system environment, the number of threads can be set automatically or manually to achieve the best operation effect; too few threads waste system resources, and too many threads cause system congestion and low efficiency. Use thread pool to control the number of threads, and other threads queue up and wait. After a task is executed, the front task in the queue is taken to start execution. If there is no waiting process in the queue, this resource of the thread pool is waiting. When a new task needs to be run, if there is a waiting work thread in the thread pool, it can start running; otherwise, it enters the waiting queue. The timing between each business program is controlled by threads, and the corresponding ones that can be executed synchronously can be executed at the same time to save time.

[0090] In another embodiment of the present invention, the step of S500 includes: S510, generating a control program according to the object program and the business program, and generating instruction data through encoding the control program; S520, input the instruction data into the simulation program for verification, and send the verified instruction data to the control device, where the control device is used to control the load.

[0091] In another embodiment of the present invention, the step of S520 includes: S521, input the instruction data into the simulation program for verification; S522, and record the running time to the corresponding instruction data; S523: Send the verified instruction data to a control device, where the control device is used to control the load.

[0092] Specifically, verification is performed through a simulation program or other means, and the running time is recorded as a screening condition and post-verification data, and the instruction data is marked and verified again.

[0093] In another embodiment of the present invention, the output of the Transformer Encoder layer (object level) and the output of the CRF layer (business level) are used to construct a two-head attention Transformer Encoder layer again to obtain the final control program output.

[0094] MultiHead( Q obj, K bus, Vbus)=softmax( ) V bus; Where: Qobj represents the query matrix at the object level, K bus and V bus represents the key and value matrices at the business level respectively.

[0095] The output of the two attentions is passed through a linear layer and a softmax classifier to obtain the final control program output.

[0096] Specifically, BiLSTM-CRF: effectively handles sequence labeling problems and can accurately identify services and their status and action sequences. Multi-head attention combination: realizes information fusion at the object level and service level to improve the accuracy of control programs. Modularity and scalability: the model design is flexible and easy to expand and adjust according to actual needs.

[0097] In another embodiment of the present invention, the control program includes port definition, instruction encoding and instruction interpretation.

[0098] Specifically, **Port definition: **Input IO port alias: X0: Start button (SB1) X1: Stop button (SB2) Output IO port alias: KM: Motor auxiliary mark Alias: **Instruction encoding:**; groupId1{group1}-->A0_0[ / 0_if_input_X0_rising_edge / ]-->C0_1[1_trigger_output_Y0_on] groupId2{group2}-->A0_2[ / 2_if_input_X1_rising_edge / ]-->C0_3[3_trigger_output_Y0_on] **Command explanation:** Group 1 description: (Team Leader) If <sb1>Rising edge signal; (Team member) trigger <km>Power-up Group 2 Description: Team Leader) If <sb2>Rising edge signal (member) trigger <km>power ups; In another embodiment of the present invention, Business description: Write a control program for the automatic loading and unloading of the robot. The robot structure is a rectangular coordinate type, with three servo motors controlling the X, Y, and Z positions, and a pneumatic gripper at the end.

[0099] The process is as follows: Check whether there is material available for picking, the robot moves to the picking position, descends, checks whether it touches the material, the robot grabs the material, the robot rises and moves to the discharge position, The robot descends and places the material, and then ascends and checks whether the material is placed correctly. If the material is placed successfully, it returns to the material picking step. If the material placement fails, an alarm is required and the system stops, waiting for operator intervention, and the system is reset to prepare to restart the process.

[0100] The control process of automatic loading and unloading of the robot usually includes steps such as initialization, detection, grasping, placement, feedback and loop. The following is an example of automatically generated process control, showing the basic control process instructions for automatic loading and unloading of the robot: Identify objects: The extracted objects can be divided into multiple layers, ultimately down to the operation layer of ports and registers.

[0101] Manipulator properties: coordinate position, material picking position, material placing position, grabbing plane, safety plane, and subordinate relationship.

[0102] Manipulator status: the manipulator is in the material picking position, the manipulator is in the material picking position, the manipulator is in the material placing position, the manipulator is lowered into position, the manipulator is raised into position, etc.; Object actions: robot moves, robot descends, robot rises, robot grabs materials, and places materials; The control process of automatic loading and unloading of the robot usually includes steps such as initialization, detection, grasping, placement, feedback and loop. The following is an example of writing and generating a flowchart, showing the basic control process of automatic loading and unloading of the robot: Extract objects: T1[(Robot; + Description: The robot's spatial motion X, Y, Z is controlled by motor axis 1, axis 2, axis 3.

[0103] +Attributes: Coordinate position: Zx0, Zy0, Zz0; Material picking position: Zx1, Zy1, Zz1; Material placing position: Zx2, Zy2, Zz2; Grasping plane: W3; Safety plane: W4.

[0104] +Actuator X-axis: axis1; Y-axis: axis2; Z-axis: axis3; Cylinder: Y1.

[0105] +Sensor limit 1: X1.

[0106] +Action A1: Emergency stop A2: Pause; A3: The robot moves to the material picking position; A4: The robot descends; A5: The robot arm rises; A6: The robot moves to the discharge position A7: The robot grabs; +status; S1: Operation status: running, stopped, paused S3: The robot moves to the material picking position; S4: The robot arm descends to its position; S5: The robot rises to its position; S6: The robot moves to the discharge position to complete; S7: The robot completes grabbing the material; S8: Material placement is completed; + Subroutines: )]-->T1_S1 & T1_S2 & T1_S3 & T1_S4 & T1_S5 & T1_S6; T1_S1[1_Condition_State]-->|2|T1_A3[The robot moves to the material picking position]; T1_S2[2_condition_state]-->|4|T1_A4[Robot descends] T1_S3[3_condition_state]-->|5|T1_A5[Robot rises] T1_S4[4_condition_state]-->|6|T1_A6[Robot moves to the discharge position] T1_S5[5_condition_state]-->|7|T1_A7[Robot grabs the material] T1_S6[6_condition_state]-->|8|T1_A8[Robot places the material]; T1_A3[7_The robot moves to the material picking position]--> T1_8[8_Operation Zx0=Zx1, Zy0=Zy1, Zz0=Zz2]-->T1_9[9_Trigger_X-axis_Y-axis_Z-axis_Run to the specified position_Coordinate: Zx0]--> T1_10[10_Wait_X-axis_Y-axis_Z-axis_Stop]--> T1_11[11_Status return_OK]; T1_A4[12_Robot descends]--> T1_13[13_Operation Zz0=W3]--> T1_14[14_Trigger Z axis to run to specified position_coordinate: Zz0]--> T1_15[15_Wait for Z axis to stop]--> T1_16[16_Status return_OK]; T1_A5[12_Robot rises]--> T1_18[18_Operation Zz0=W4]--> T1_19[19_Trigger Z axis to run to specified position_coordinate: Zz0]--> T1_20[20_Wait for Z axis to stop]--> T1_21[21_Status return_OK]; T1_A6[22_The robot moves to the discharge position]--> T1_23[23_Operation Zx0=Zx1, Zy0=Zy1, Zz0=Zz2]--> T1_24[24_Trigger_X-axis_Y-axis_Z-axis_Run to the specified position_Coordinate: Zx0]--> T1_25[25_Wait_X-axis_Y-axis_Z-axis_Stop]--> T1_26[26_Status return_OK]; T1_A7[27_Robot grabs material]--> T1_28[28_Trigger_Cylinder_On]--> T1_29[29_Delay_Numerical Mode_100]--> T1_30[31_Status Return_OK]; T1_A8[32_Manipulator places material]--> T1_33[33_Trigger_Cylinder_Off]--> T1_34[34_Delay_Numerical Mode_100]--> T1_35[35_Status Return_OK]; Extract process status action: For graph TD loopId1 (((timing loop 0)))-->L0_1[1_wait_signal_start signal_on_10]-->L0_2[2_trigger_object_T1 robot_robot moves to the material picking position]-->L0_3[3_trigger_object_T1 robot_robot descends]-->L0_4[4_wait_signal_whether there is material_on_10]-->L0_5[5_trigger_object_T1 robot_robot grabs material]-->L0_6[6_trigger_object_T1 robot_robot rises]-->L0_7[7_trigger_object_T1 robot_robot moves to the material placing position]-->L0_8[8_trigger_object_T1 robot_robot descends]-->L0_9[9_trigger_object_T1 robot_places material]--> L0_10[10_Trigger_Object_T1 Robot_Robot rise]--> L0_11[11_Condition_Input signal mode_Detect material placement]; L0_11-->|Pass|L0_1 L0_11-->|No|L0_12L0_12[12_Trigger_Object_T1 Robot_Stop]--> L0_13[13_Wait_Signal_Wait for operator intervention_Pass_10]--> L0_14[14_Trigger_Object_T1 Robot_Restart]-->L0_15[15_Jump]-->L0_1; Data parsing execution: The above 15 instruction action flows and 35 object instruction flows are encoded to generate program instruction data. The lower computer can control the robot by parsing and executing the parsed instruction data.

[0107] Such as the instruction: T1_S1[ / 1_State action / ]-->|2|T1_A3[The robot moves to the material picking position]; Generate instruction data according to the agreed data format: [header data, instruction function data, condition value data, jump to frame number data]; Generate instruction execution data [0x01, 0x05, 0x01, 0x07]; Header data: 0x01; instruction function data: 0x05; condition value data: 0x01; jump to frame number data: 0x07; Thread: According to the header of each instruction, the header stores the starting address of this instruction in the memory. All instruction headers in the same thread form a thread array and are stored in the thread area memory.

[0108] Thread pool pointer table: Objects and action flows are threads. A thread pool is constructed by multiple threads, and its pointer corresponds to the memory entry of each thread.

[0109] A Chinese instruction reasoning programming system based on language large model reasoning includes: an object program generation module, a business program generation module, a control program generation module, and an instruction data generation module connected in sequence; the object program generation module includes an object recognition unit, an object attribute extraction unit, an object state extraction unit, an object action advance unit, and an object program generation unit; the business program generation module includes a business state recognition unit, a business state extraction unit, a state flow chart generation unit, and a business program generation unit.

[0110] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. All equivalent structural changes made using the contents of the present invention's specification and drawings, or directly / indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.< / km> < / km>

Claims

1. A Chinese instruction reasoning programming method based on language large model reasoning, characterized in that: include: Obtain the business data set, object data set, state data set and action data set corresponding to the device to pre-train the language model; The trained language model performs object recognition and extraction on the newly input business text, and recognizes and extracts the object attributes, object states, object affiliations and object actions of the object; Generate an object program corresponding to the object action through the object action and the object state, wherein the object program is used to return the object action corresponding to the object state when the object state is obtained during execution; Generate a business state flow chart through the business text and the object state reasoning, generate a business program according to the business state flow chart, and the business program is used to implement the business state process at runtime; A control program is generated according to the object program and the business program, instruction data is generated by encoding the control program, and the instruction data is sent to a control device, which is used to control a load.

2. The Chinese instruction reasoning programming method based on language large model reasoning as described in claim 1 is characterized in that: Before the step of obtaining the device corresponding object data set, state data set and action data set to pre-train the language model, the following steps are included: Acquire an original data set of a service text and a service code of a device, and convert the service text into a structured text format, wherein the original data set includes an initialization process, a detection process, a cycle process, and an alarm process; The object data set, the state data set, the action data set and the business data set are generated by the structured original data set.

3. The Chinese instruction reasoning programming method based on language large model reasoning as claimed in claim 1 is characterized in that: The trained language model performs object recognition and extraction on the newly input business text, and the steps of recognizing and extracting the object attributes, object states, object affiliations and object actions of the object include: The trained language model performs object recognition and extraction on the newly input business text; Mining is performed from objects connected to the control device to obtain object attributes, object states, object dependencies and object actions.

4. The Chinese instruction reasoning programming method based on language large model reasoning as claimed in claim 1 is characterized in that: The step of generating an object program corresponding to the object action through the object action and the object state, wherein the object program is used to return to the step of obtaining the object action corresponding to the object state when the object state is acquired during execution, comprises: According to the object action and the object state, the object action is inferred according to the object state, and the action instruction corresponding to the action object is inferred according to the object action; Verifying the action instruction through the object state; An object program is generated through the action instruction, and the object program is used to return the object action corresponding to the object state when the object state is obtained during execution.

5. The Chinese instruction reasoning programming method based on language large model reasoning as claimed in claim 1 is characterized in that: The step of generating a business state flow chart by reasoning with the business text and the object state, generating a business program according to the business state flow chart, and the business program is used to implement the business state flow at runtime, includes: Generate a business state, a business signal and a business action by inferring the business text, the object action and the object state; the business state and the business signal each include at least one object state, and the business action includes at least one object action; A business state flow chart is generated through the business state and the business text, and a business program is generated according to the business state flow chart. The business program is used to implement the business state process at runtime, and the business program includes multiple object programs and object sequences.

6. The Chinese instruction reasoning programming method based on language large model reasoning as claimed in claim 1 is characterized in that: The instruction data includes header data, instruction function data, condition value data and jump data. The header data includes thread data, and the thread data is generated through the object sequence.

7. The Chinese instruction reasoning programming method based on language large model reasoning as claimed in claim 1 is characterized in that: The step of generating a control program according to the object program and the business program, generating instruction data by encoding the control program, and sending the instruction data to a control device, wherein the control device is used to control a load, comprises: generating a control program according to the object program and the business program, and generating instruction data by encoding the control program; The instruction data is input into the simulation program for verification, and the verified instruction data is sent to the control device, which is used to control the load.

8. The Chinese instruction reasoning programming method based on language large model reasoning as claimed in claim 7 is characterized in that: The step of inputting the instruction data into the simulation program for verification, and sending the verified instruction data to the control device, wherein the control device is used to control the load, comprises: Enter the instruction data into the simulation program for verification; And record the running time to the corresponding instruction data; The verified instruction data is sent to a control device, and the control device is used to control the load.

9. The Chinese instruction reasoning programming method based on language large model reasoning as described in any one of claims 1 to 8, characterized in that: The control program includes port definition, instruction encoding and instruction interpretation.

10. A Chinese instruction reasoning programming system based on language large model reasoning, characterized in that: include: An object program generation module, a business program generation module, a control program generation module, and an instruction data generation module connected in sequence; The object program generation module includes an object identification unit, an object attribute extraction unit, an object state extraction unit, an object action advance unit and an object program generation unit; the business program generation module includes a business state identification unit, a business state extraction unit, a state flow chart generation unit and a business program generation unit.