Action triggering method, device and equipment and computer readable storage medium

By converting the host computer position parameters into target pulse values ​​and comparing them in real time, the error problem in motor position control is solved, and the stability and response speed of high-precision and high-speed continuous action triggering are achieved.

CN122044067APending Publication Date: 2026-05-15HANGZHOU IECHO SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610141689.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-02
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

In existing technologies, the field programmable gate array (FPGA) and microcontroller unit (MCU) communicate via a 100MHz parallel bus for real-time calculations in motor position control, resulting in process errors and cumulative errors from continuous triggering, which makes it difficult to meet the requirements of high-precision processes.

Method used

The position parameters transmitted from the host computer are converted into target pulse values ​​and stored in a dedicated array address. The actual feedback pulse value is captured in real time and compared with the target pulse value. When the pulse matches, an external output signal is triggered. When the comparison result is a pulse match, the next target pulse value is seamlessly switched to for the next cycle of comparison.

Benefits of technology

By pre-converting position parameters into pulse values ​​and comparing them in real time, the errors and switching delays of real-time calculations are eliminated, improving output accuracy and response speed. This makes it suitable for high-speed triggering scenarios such as assembly line workpiece inspection and automated assembly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122044067A_ABST
    Figure CN122044067A_ABST
Patent Text Reader

Abstract

The invention discloses an action triggering method, device and equipment and a computer readable storage medium, and is applied to the field of control, and the method comprises the steps: converting all position parameters transmitted by an upper computer into corresponding target pulse values, and storing the target pulse values to a special array address; presetting a first target pulse value in the special array address to a position comparison address; when the equipment starts to run, capturing an actual feedback pulse value of the current relative position in real time, and comparing the actual feedback pulse value with a target pulse value in the position comparison address; and when the comparison result is pulse matching, triggering an external output signal to execute a corresponding action, and simultaneously writing the next target pulse value in the special array address into the position comparison address to carry out next cycle comparison until the comparison is finished to the last target pulse value. According to the method, the computing power consumption and the time delay of real-time parameter conversion in the high-speed operation process of equipment are avoided, and the response speed and the control precision of high-speed continuous action triggering at different intervals are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of control, and in particular to an action triggering method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] In the field of motor position control, a field-programmable gate array (FPGA) and a microcontroller unit (MCU) are commonly used to construct a position comparison signal output device, which communicates via a 100MHz parallel bus. The MCU polls the actual position of the motor at a preset period and predicts the position for the next period based on the real-time speed. The position for the next period is then compared with the preset position for judgment. The FPGA is responsible for encoder signal processing and real-time pulse output to trigger external actions. This method relies on multiple modules communicating via the bus for real-time calculation, which is prone to process errors due to sampling lag. When triggered continuously, these errors accumulate, leading to unstable external output accuracy and making it difficult to meet the requirements of high-precision processes.

[0003] Therefore, how to eliminate process errors caused by real-time calculation and cumulative errors caused by continuous triggering, and improve the controllability and stability of output accuracy, is a technical problem that urgently needs to be solved. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide an action triggering method, apparatus, device and computer-readable storage medium, which solves the problem of poor output accuracy in the prior art.

[0005] To address the aforementioned technical problems, this invention provides an action triggering method applied to a programmable logic controller, comprising: All position parameters transmitted from the host computer are converted into corresponding target pulse values ​​and stored in a dedicated array address; The first target pulse value in the dedicated array address is preset to the position comparison address; When the device starts running, it captures the actual feedback pulse value of the current relative position in real time and compares the actual feedback pulse value with the target pulse value in the position comparison address. When the comparison result is a pulse match, the external output signal is triggered to perform the corresponding action. At the same time, the next target pulse value in the dedicated array address is written to the position comparison address for the next cycle comparison, until the comparison ends with the last target pulse value.

[0006] Optionally, all position parameters transmitted from the host computer are converted into corresponding target pulse values ​​and stored in a dedicated array address, including: The position parameter is decomposed into integer and decimal values, and the decimal part is enlarged according to a preset multiplication factor to obtain the enlarged value; The integer value is converted into an integer pulse value, and the expanded value is converted into a decimal pulse value; The decimal pulse value is reduced according to a preset reduction factor to obtain a reduced pulse value; the preset reduction factor is equal to the preset magnification factor. The integer pulse value and the reduced pulse value are fused together to obtain the target pulse value corresponding to the position parameter, and the target pulse value is stored in the dedicated array address.

[0007] Optionally, before converting all position parameters transmitted from the host computer into corresponding target pulse values ​​and storing them in a dedicated array address, the method further includes: The system uses a FOR loop to iterate through all parameters sent by the host computer and filters out valid point parameters according to preset parameter format verification rules. The point parameters include at least the location parameters. The parameter format verification rules include at least the parameter value range, number of bits, and integrity of the identifier bits.

[0008] Optionally, it also includes: Extract the time data and quantity data attached to the point parameters; the time data includes the preset delay time for each point trigger and the minimum interval time between adjacent points; the quantity data includes the total number of trigger points in this run and the number of peripheral linkages in a single trigger. The time data is initially calculated to obtain the actual trigger time window for each point. The starting value of the actual trigger time window is the theoretical trigger time corresponding to the target pulse value of the current point, and the ending value of the actual trigger time window is the sum of the theoretical trigger time and the preset delay time. The quantity data is initially calculated to obtain the peripheral device linkage execution sequence for this operation; the peripheral device linkage execution sequence allocates the trigger priority of each external output signal according to the number of peripheral devices linked; The calculated actual trigger time window and the peripheral device linkage execution sequence are stored in a preset auxiliary parameter address group; Upon receiving the automatic start command, while capturing the actual feedback pulse value of the current relative position in real time and comparing it with the target pulse value in the position comparison address, the effective output range of the trigger signal at each point is determined using the actual trigger time window, and each external output device is triggered sequentially according to priority using the peripheral linkage execution sequence.

[0009] Optionally, it also includes: The system records the actual feedback pulse value, the current trigger point number, and the system timestamp when the comparison result is a pulse mismatch in real time, and determines the mismatch type. If the unmatched type is deviation exceeding the threshold, an alarm signal will be output and the equipment operation will be suspended; If the unmatched type is timeout, the current point is automatically skipped and the comparison of the next target pulse value is performed, while the current point is marked as not triggered.

[0010] Optionally, after the comparison ends at the last target pulse value, the process further includes: Clear the dedicated array address and position comparison address, and re-enter the host computer parameter receiving state.

[0011] Optionally, before re-entering the host computer parameter receiving state, the following steps are also included: All trigger points, trigger times, and pulse deviation data for this operation are stored in the buffer. The trigger point is the position parameter or pulse value corresponding to the actual triggering of the external output signal. The trigger time is the time node when the external output signal is triggered. The pulse deviation data is the difference between the target pulse value and the actual feedback pulse value.

[0012] The present invention also provides an action triggering device, applied to a programmable logic controller, comprising: The parameter conversion module is used to convert all position parameters transmitted from the host computer into corresponding target pulse values ​​and store them in a dedicated array address; The comparison preset module is used to preset the first target pulse value in the dedicated array address to the position comparison address; The comparison module is used to capture the actual feedback pulse value of the current relative position in real time when the device starts running, and compare the actual feedback pulse value with the target pulse value in the position comparison address; The loop module is used to trigger an external output signal to perform a corresponding action when the comparison result is a pulse match. At the same time, it writes the next target pulse value in the dedicated array address to the position comparison address for the next loop comparison, until the comparison ends with the last target pulse value.

[0013] The present invention also provides an action triggering device, comprising: Memory, used to store computer programs; A processor is used to implement the action triggering method described above when executing the computer program.

[0014] The present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the action triggering method described above.

[0015] As can be seen, this invention converts all position parameters transmitted by the host computer into corresponding target pulse values ​​and stores them in a dedicated array address; the first target pulse value in the dedicated array address is preset to the position comparison address; when the device starts running, the actual feedback pulse value of the current relative position is captured in real time and compared with the target pulse value in the position comparison address; when the comparison result is a pulse match, an external output signal is triggered to execute the corresponding action, and the next target pulse value in the dedicated array address is written to the position comparison address for the next cycle of comparison, until the last target pulse value is compared. The beneficial effects of this method are: by pre-converting the position parameters sent by the host computer into target pulse values ​​and storing them in a dedicated array address, the computational power consumption and time delay of real-time parameter conversion during high-speed device operation are avoided; at the same time, pre-setting the first target pulse value to the position comparison address ensures that the device can immediately enter the pulse comparison process after startup, eliminating the parameter loading window period. During equipment operation, the system accurately compares the actual feedback pulse value with the target pulse value in real time, achieving strict synchronization between the trigger action and the equipment position. Furthermore, when the comparison result indicates a pulse match trigger action, the system seamlessly switches to the next target pulse value for comparison, forming a continuous closed loop of trigger-switching-re-comparison. This completely solves the problems of missed and false triggers caused by untimely pulse switching in traditional solutions, significantly improving the response speed and control accuracy of high-speed continuous action triggering at different intervals. In addition, the entire process relies on a programmable logic controller (PLC) for execution, eliminating the need for multi-module polling communication. This results in high instruction transmission and computation efficiency, making it suitable for high-speed triggering scenarios with multiple points, such as assembly line workpiece inspection and automated assembly, greatly enhancing the practicality and compatibility of the solution.

[0016] In addition, the present invention also provides an action triggering device, an apparatus, and a computer-readable storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0018] Figure 1 A flowchart of an action triggering method provided in an embodiment of the present invention; Figure 2 This is an example diagram of a parameter processing flow before equipment operation provided by an embodiment of the present invention; Figure 3 A timing flowchart provided for an embodiment of the present invention; Figure 4 This is a schematic diagram of the address for parameter storage provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an action triggering device provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an action triggering device provided in an embodiment of the present invention. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] For a typical position comparison signal output device, the hardware includes a Field Programmable Gate Array (FPGA) module and a Microcontroller Unit (MCU) module. The FPGA module is responsible for encoder signal processing (reading the position feedback signal from the motor encoder) and real-time pulse signal output (sending control pulses to peripherals). The MCU module is responsible for data calculation (position and speed related calculations) and motor control (outputting motor drive commands). The method involves the MCU module polling at a preset period to obtain the actual position of the motor within the current period. Based on the actual position and speed of the motor in the current period, it calculates the actual position of the motor to be obtained in the next polling period and compares it with the preset position. The modules communicate with each other via a parallel bus at a frequency of 100MHz, working together through the MCU module and the FPGA module. Because conventional techniques involve several modules working together and using a 100MHz bus for polling, calculation errors occur, leading to uncertainty in output accuracy. Furthermore, continuous triggering can cause problems such as accumulated continuous errors.

[0021] To overcome the impact of communication time between different modules and the data calculation process, and to address the issue of excessively large and uncontrollable cumulative errors when triggering actions at consecutive different times or pulse intervals, this invention provides an action triggering method. For details, please refer to... Figure 1 , Figure 1 A flowchart illustrating an action triggering method provided in an embodiment of the present invention. The method may include: S101: Convert all position parameters transmitted from the host computer into corresponding target pulse values ​​and store them in a dedicated array address.

[0022] The execution entity in this embodiment is a PLC (Programmable Logic Controller), such as a motion control PLC-based system with a 200MHz hardware high-speed grasping function. It should be noted that this embodiment applies to scenarios involving high-speed continuous output at varying intervals. To better understand this application scenario, consider the following example: When a production line is conveying products at high speed, it needs to continuously trigger a camera to take pictures when the product moves to three different locations at intervals of 10cm, 35cm, and 80cm from the starting point—the control logic in this scenario is the "high-speed continuous output scenario at varying intervals."

[0023] The PLC receives all parameters transmitted from the host computer and places them in a designated array address. After all software and hardware preparations are complete, the PLC calculates / converts all position parameters at once and places the calculated / converted parameters (i.e., target pulse values) in a dedicated array address.

[0024] S102: Preset the first target pulse value in the dedicated array address to the position comparison address.

[0025] After all position parameters have been calculated / converted, the parameter of the first position (i.e. the first target pulse value) is placed in the position comparison address in advance to prepare for the subsequent comparisons.

[0026] S103: When the device starts running, it captures the actual feedback pulse value of the current relative position in real time and compares the actual feedback pulse value with the target pulse value in the position comparison address.

[0027] In this embodiment, the device refers to the control command electrical signal actively sent by the PLC / control device to an external execution device to trigger a preset external action. It is a key link in the command execution in the control closed loop. After the device starts normal operation, the PLC's high-speed hardware capture function begins to capture the number of external displacement pulses (i.e., the actual feedback pulse value) in real time and compares it with the target pulse value in the position comparison address.

[0028] S104: When the comparison result is a pulse match, the external output signal is triggered to perform the corresponding action. At the same time, the next target pulse value in the dedicated array address is written to the position comparison address for the next cycle comparison, until the last target pulse value is compared and the comparison ends.

[0029] This embodiment does not limit the action; for example, it can be triggered by taking a picture, executing an action, or issuing an alarm. Pulse matching in this embodiment refers to the actual feedback pulse value matching the target pulse value in the position comparison address, or the difference between the two being within a certain preset range. Simultaneously with the action triggering, the next target pulse value from the dedicated array address is written to the position comparison address for the next loop comparison. Steps S103 and S104 are repeated until the last point's action is triggered, at which point the triggering stops, and the system waits for the next command execution, entering a sleep state. Experimental verification shows that the minimum error time in this loop is within 500μs, which meets the allowable error for continuous triggering. Furthermore, it makes the PLC's internal program logic more structured and concise, thereby improving the PLC's internal calculation cycle and overall operating efficiency and accuracy.

[0030] Furthermore, the process of converting all position parameters transmitted from the host computer into corresponding target pulse values ​​and storing them in a dedicated array address can specifically include: decomposing the position parameters into integer and decimal values, and multiplying the decimal part by a preset multiplication factor to obtain the multiplied value; converting the integer value into an integer pulse value, and converting the multiplied value into a decimal pulse value; multiplying the decimal pulse value by a preset reduction factor to obtain the reduced pulse value; ensuring the preset reduction factor is equal to the preset multiplication factor; and performing a fusion calculation on the integer pulse value and the reduced pulse value to obtain the target pulse value corresponding to the position parameter, and storing the target pulse value in a dedicated array address. Alternatively, the position parameters containing decimal parts can be multiplied by an integer multiple, then the multiplied position parameters can be converted, and then the converted pulse value can be reduced by an equal integer multiple to obtain the actual converted pulse value. For example, all decimal parameters can be multiplied into integer parameters, calculated / converted using integer parameters, and then converted back to decimal parameters (e.g., 123.456). 456.123 converted to 123456 (Calculate using 456123 / 1000000), which minimizes errors during the calculation process.

[0031] Furthermore, before converting all position parameters transmitted by the host computer into corresponding target pulse values ​​and storing them in a dedicated array address, the above process may also include: using a FOR loop to traverse all parameters sent by the host computer and filtering out valid point parameters through preset parameter format verification rules; point parameters include at least position parameters; parameter format verification rules include at least parameter value range, number of bits, and integrity of identifier bits.

[0032] It should be noted that the point parameters in this embodiment are a complete set of parameters used to trigger the action, including position parameters. The core parameter is the position parameter, and it often includes auxiliary control information such as trigger priority, output type, accuracy level, and delay time. The position parameter is a quantified parameter characterizing the motor's operating position, used to convert it into the corresponding target pulse value and participate in high-speed comparison calculations. Other auxiliary control information can be used for assistance. This embodiment uses a FOR loop to iterate through all parameters issued by the host computer, systematically and comprehensively covering all parameters to be processed, avoiding the problem of missing valid parameters due to manual screening or random sampling. At the same time, relying on preset parameter format verification rules (covering numerical range, number of bits, and integrity of identifier bits) to perform multi-dimensional verification of parameters, it can accurately screen out valid point parameters. This not only eliminates invalid parameters with out-of-limit values, abnormal number of bits, or missing identifier bits, preventing them from entering the subsequent pulse value conversion and comparison process and causing triggering deviations and equipment malfunctions, but also ensures the uniformity of the format and data reliability of point parameters (the core being position parameters). This lays a solid data foundation for subsequent high-speed continuous pulse comparison and action triggering, significantly improving the stability and fault tolerance of the entire action triggering process and reducing the probability of production line downtime due to parameter abnormalities.

[0033] Furthermore, it may also include: extracting time and quantity data attached to the point parameters; the time data includes the preset delay time for each point trigger and the minimum interval time between adjacent points, and the quantity data includes the total number of trigger points in this operation and the number of peripheral linkages in a single trigger; performing preliminary calculations on the time data to obtain the actual trigger time window for each point, the starting value of the actual trigger time window being the theoretical trigger time corresponding to the target pulse value of the current point, and the ending value of the actual trigger time window being the sum of the theoretical trigger time and the preset delay time; performing preliminary calculations on the quantity data to obtain the peripheral linkage execution sequence for this operation; allocating the trigger priority of each external output signal according to the number of peripheral linkages in the peripheral linkage execution sequence; storing the calculated actual trigger time window and the peripheral linkage execution sequence in a preset auxiliary parameter address group; when receiving the automatic operation start command, in the process of real-time capturing of the actual feedback pulse value of the current relative position and comparing it with the target pulse value in the position comparison address, using the actual trigger time window to determine the effective output range of the trigger signal of each point, and using the peripheral linkage execution sequence to trigger each external output device in order of priority.

[0034] In this embodiment, the automatic start command refers to the instruction signal sent from the host computer or human-machine interface to the PLC to initiate the current high-speed continuous output control process with different intervals. This instruction signal can be a parameter transmission; that is, when the host computer sends parameters to the PLC, the current high-speed continuous output control process with different intervals is started. After receiving the instruction, the PLC completes preparatory work such as benchmark zeroing, parameter loading, and parameter conversion, and can synchronously or with a delay send a run instruction to the device driver, causing the device to enter a high-speed running state. Subsequently, the PLC executes real-time pulse comparison and external output triggering actions. In this embodiment, the trigger signal refers to a trigger point corresponding to each target pulse value. The instruction generated when the comparison result shows a pulse match is the trigger signal for that point. The external output signal is triggered to execute the corresponding action, and the executor of this corresponding action is the external output device. To better understand, let's illustrate this using the combination of external output signal - external output device - action - scene: 24V high level - industrial area scan camera - captures an image of the product's appearance - high-speed workpiece appearance inspection on the production line; 50ms pulse signal (switching signal) - pneumatic gripper cylinder - clamps the workpiece, completing station positioning - robotic arm grasps and transfers the workpiece; 24V high level (switching signal) - barcode scanner - scans the product's QR code / barcode, records traceability information - product information collection on the packaging line. Taking camera photography as an example: When the PLC comparison result is a pulse match (actual pulse value = target pulse value), it generates a trigger signal for that point, the PLC outputs a 24V high level (external output signal), the camera receives the signal, immediately takes a picture (action), the PLC switches to the next target pulse value, and enters the next cycle. Multiple devices can be linked at the same trigger point. For example, the PLC outputs a 24V high level to the camera (to take pictures) and at the same time outputs a 50ms pulse to the cylinder (to clamp). According to the priority of the peripheral linkage execution sequence, clamping is performed first and then taking pictures to avoid blurry images caused by workpiece vibration.

[0035] In this embodiment, before the equipment starts running automatically, preliminary calculations are performed on time data (trigger delay at each point, minimum interval time between adjacent points) and quantity data (total number of trigger points, number of peripheral linkages). On the one hand, the trigger time window and peripheral linkage execution sequence for each point can be generated in advance, avoiding the time consumption of real-time calculations during high-speed operation and reducing the computing power occupation of PLC core comparison and triggering actions. This ensures a trigger response speed at the microsecond / millisecond level and prevents problems such as target pulse value switching delay, false triggering, or missed triggering due to insufficient computing power. On the other hand, data format verification can be performed simultaneously during the preliminary calculation process to eliminate invalid parameters in advance. At the same time, the calculation results are stored in the auxiliary address group, which not only avoids control disorder caused by invalid parameters entering the operation process, but also provides data support for subsequent process traceability and parameter optimization. In addition, the pre-allocated peripheral linkage priority can effectively avoid instruction conflicts caused by multiple peripherals triggering simultaneously, adapt to the collaborative control requirements of multiple types of external output signals, and ultimately achieve a comprehensive improvement in response accuracy, operational stability, and process compatibility of high-speed continuous output at different intervals.

[0036] Furthermore, it may also include: real-time recording of the actual feedback pulse value, the current trigger point number, and the system timestamp when the comparison result indicates a pulse mismatch, and determining the mismatch type; if the mismatch type is a deviation exceeding a threshold, an alarm signal is output and the device operation is paused; if the mismatch type is a timeout, the current point is automatically skipped and the comparison of the next target pulse value is performed, while the current point is marked as not triggered. In this embodiment, a deviation exceeding a threshold means that the absolute value of the difference between the actual feedback pulse value and the target pulse value is greater than a preset deviation threshold. In this embodiment, a timeout means that the device has run to a preset maximum stroke and still has not matched the target pulse value. This embodiment accurately retains core data at the time of fault occurrence by using the actual feedback pulse value, the trigger point number, and the system timestamp when a real-time pulse mismatch occurs. This provides complete data support for subsequent tracing of the root cause of the fault (such as pulse threshold setting deviation, encoder feedback abnormality, equipment movement timeout, etc.), significantly reducing the cost and time of fault investigation. At the same time, by distinguishing between two types of core pulse mismatches—deviation exceeding the threshold and timeout—and adopting differentiated processing strategies: for serious faults such as deviation exceeding the threshold, which may lead to product defects or equipment damage, an alarm signal is immediately output and equipment operation is suspended, effectively avoiding the risk of batch defective products and equipment damage; for non-fatal faults such as timeout, the current point is automatically skipped and marked as not triggered before continuing to execute the next pulse value comparison, avoiding the entire production line from stopping due to a single point abnormality. This balances production safety and continuity, significantly improving the fault tolerance and production capacity stability of the equipment in high-speed continuous action triggering scenarios.

[0037] Furthermore, after the comparison ends with the last target pulse value, the process can also include: clearing the dedicated array address and the position comparison address, and re-entering the host computer parameter receiving state. This embodiment, by clearing the dedicated array address and the position comparison address after each running cycle, can thoroughly remove residual target pulse values ​​and other parameters from the previous run, avoiding pulse comparison errors and action trigger misalignment caused by the confusion between old and new parameters, ensuring the independence and purity of each round of parameter receiving and triggering processes. Simultaneously, re-entering the host computer parameter receiving state allows for rapid response to new rounds of parameters issued by the host computer, adapting to the needs of different product process switching. No manual intervention is required in the parameter clearing process, improving the efficiency of parameter switching and reducing the risk of parameter anomalies caused by human error. This significantly enhances the flexibility and adaptability of the high-speed continuous action triggering scheme, ensuring the stability of equipment operation in multi-round, multi-process scenarios.

[0038] Furthermore, before re-entering the host computer parameter receiving state, it may also include: storing all trigger points, trigger times, and pulse deviation data of this operation in the buffer area; the trigger point is the position parameter or pulse value corresponding to the actual triggering of the external output signal; the trigger time is the time node when the external output signal is triggered; and the pulse deviation data is the difference between the target pulse value and the actual feedback pulse value. This embodiment stores the trigger point, trigger time, and pulse deviation data of the current operation completely in the cache. The trigger point is precisely associated with the actual position parameter / pulse value of the action trigger, the trigger time is the precise time node of the signal trigger, and the difference between the quantified target of the pulse deviation data and the actual pulse value. This not only provides full-dimensional raw data support for subsequent process traceability, but also allows for the rapid location of specific points and time nodes of trigger anomalies (such as excessive deviation or trigger delay), facilitating root cause analysis and optimization of position parameters or pulse threshold conversion rules. Furthermore, through statistical analysis of pulse deviation data, the accuracy of action triggering can be continuously improved iteratively. At the same time, the complete operation data can serve as the basis for production process optimization and equipment performance evaluation, significantly enhancing the traceability and optimizability of the high-speed continuous action triggering process, and further ensuring the stability and accuracy of action triggering at different intervals.

[0039] The action triggering method provided in this embodiment of the invention is applied to a programmable logic controller (PLC). In step S101, all position parameters transmitted from the host computer are converted into corresponding target pulse values ​​and stored in a dedicated array address. In step S102, the first target pulse value in the dedicated array address is preset to the position comparison address. In step S103, when the device starts running, the actual feedback pulse value of the current relative position is captured in real time and compared with the target pulse value in the position comparison address. In step S104, when the comparison result is a pulse match, an external output signal is triggered to execute the corresponding action, and the next target pulse value in the dedicated array address is written to the position comparison address for the next cycle of comparison, until the last target pulse value is compared. This method avoids the computational power consumption and time delay of real-time parameter conversion during high-speed device operation by pre-converting the position parameters sent by the host computer into target pulse values ​​and storing them in a dedicated array address. Simultaneously, pre-setting the first target pulse value to the position comparison address ensures that the device can immediately enter the pulse comparison process after startup, eliminating the parameter loading window. During equipment operation, the system accurately compares the actual feedback pulse value with the target pulse value in real time, achieving strict synchronization between the trigger action and the equipment position. Furthermore, when the comparison result indicates a pulse match trigger action, the system seamlessly switches to the next target pulse value for comparison, forming a continuous closed loop of trigger-switching-re-comparison. This completely solves the problems of missed and false triggers caused by untimely pulse switching in traditional solutions, significantly improving the response speed and control accuracy of high-speed continuous action triggering at different intervals. In addition, the entire process relies on a programmable logic controller (PLC) for execution, eliminating the need for multi-module polling communication. This results in high instruction transmission and computation efficiency, making it suitable for high-speed triggering scenarios with multiple points, such as assembly line workpiece inspection and automated assembly, greatly enhancing the practicality and compatibility of the solution.

[0040] To make this invention easier to understand, please refer to... Figure 2 , Figure 2 This is an example diagram of a parameter processing flow before equipment operation provided by an embodiment of the present invention. Specifically, it may include: After the PLC detects and receives a set of position parameters from the host computer, it starts, first filtering out valid position parameters using a FOR loop, then temporarily storing the valid parameters in a transfer array, and classifying the parameters in the transfer array into corresponding arrays; subsequently, it performs preliminary calculations on data such as time and quantity, extracting the integer and decimal parts of the position parameters and merging them into complete parameters; then, it uses a FOR loop to amplify the complete position parameters by 10000 times and convert them into integer parameters; finally, it converts all position parameters into corresponding pulse values ​​and stores them sequentially in the position comparison address for later use; when all parameters are ready, it enters the automatic operation comparison stage; after all point comparisons are completed, the PLC enters standby mode.

[0041] Figure 3A timing flowchart is provided as an embodiment of the present invention. Specifically, it may include: Before the equipment starts operating, the host computer directly transmits all preset trigger data (parameters) to the corresponding array addresses in the PLC via communication. (See reference...) Figure 4 , Figure 4 This is a schematic diagram of a parameter storage address provided in an embodiment of the present invention. The PLC sends parameters sent from the host computer to the corresponding dedicated array address. After preparation, the PLC clears the pulse value of the actual feedback relative running position recorded at the current PLC position (i.e., the current value of the actual position). After the equipment starts running, the PLC will capture the actual feedback pulse value of the current relative running position in real time. While reading, the PLC compares the actual feedback pulse value with the target pulse value in the position comparison address using a high-speed comparison instruction (HCnt instruction). When the comparison result is a pulse match, the PLC can trigger an external output signal. At the same time as triggering, the calculated next target pulse value is placed in the position comparison address, and the real-time comparison continues. The comparison continues in the next round, and so on. After the last point is compared, the PLC will automatically stop the comparison operation, terminate the external feedback relative running pulse value, and enter sleep mode, waiting for the next round of running instructions.

[0042] The entire operation is a closed-loop process, requiring no external intervention, resulting in more stable and reliable operation with smaller errors and improved accuracy compared to conventional methods. This improved accuracy is also more controllable, providing greater assurance for the overall equipment operation and process requirements. Using array addresses to calculate the target pulse values ​​for all points before comparison offers higher accuracy, clearer logic, and a cleaner PLC program compared to calculating each point individually during operation, reducing the PLC's single-cycle program computation time. During computation, floating-point parameters are split into integer and fractional parts, the fractional part is converted to a positive integer, and then both the integer and fractional parts are calculated separately before being merged back into a floating-point number. This eliminates floating-point precision loss, improves PLC computation speed to match PLC scan cycle characteristics, and avoids floating-point overflow.

[0043] The action triggering device provided in the embodiments of the present invention will be described below. The action triggering device described below and the action triggering method described above can be referred to each other.

[0044] Please refer to the details. Figure 5 , Figure 5 A schematic diagram of an action triggering device provided in an embodiment of the present invention may include: The parameter conversion module 100 is used to convert all position parameters transmitted by the host computer into corresponding target pulse values ​​and store them in a dedicated array address; The comparison preset module 200 is used to preset the first target pulse value in the dedicated array address to the position comparison address; The comparison module 300 is used to capture the actual feedback pulse value of the current relative position in real time when the device starts running, and compare the actual feedback pulse value with the target pulse value in the position comparison address; The loop module 400 is used to trigger an external output signal to perform a corresponding action when the comparison result is a pulse match. At the same time, it writes the next target pulse value in the dedicated array address to the position comparison address for the next loop comparison, until the comparison ends with the last target pulse value.

[0045] Based on any of the above embodiments, the parameter conversion module 100 may include: An expansion processing unit is used to decompose the position parameter into integer and decimal values, and to expand the decimal part according to a preset expansion factor to obtain the expanded value; The conversion unit is used to convert the integer value into an integer pulse value and the expanded value into a decimal pulse value. A reduction unit is used to reduce the decimal pulse value according to a preset reduction factor to obtain a reduced pulse value; the preset reduction factor is equal to the preset magnification factor; The fusion calculation unit is used to perform fusion calculation on the integer pulse value and the reduced pulse value to obtain the target pulse value corresponding to the position parameter, and store the target pulse value in the dedicated array address.

[0046] Based on any of the above embodiments, the action triggering device may further include: The filtering module is used to traverse all parameters sent by the host computer using a FOR loop before converting all position parameters transmitted by the host computer into corresponding target pulse values ​​and storing them in a dedicated array address, and to filter out valid point parameters through preset parameter format verification rules; the point parameters include at least the position parameters; the parameter format verification rules include at least the parameter value range, number of bits, and integrity of the identifier bits.

[0047] Based on any of the above embodiments, the action triggering device may further include: The extraction module is used to extract the time data and quantity data attached to the point parameters; the time data includes the preset delay time for each point trigger and the minimum interval time between adjacent points; the quantity data includes the total number of trigger points in this run and the number of peripheral linkages in a single trigger. The first calculation module is used to perform preliminary calculations on the time data to obtain the actual trigger time window for each point. The starting value of the actual trigger time window is the theoretical trigger time corresponding to the target pulse value of the current point, and the ending value of the actual trigger time window is the sum of the theoretical trigger time and the preset delay time. The second calculation module is used to perform preliminary calculations on the quantity data to obtain the peripheral device linkage execution sequence for this operation; the peripheral device linkage execution sequence allocates the trigger priority of each external output signal according to the number of peripheral devices linked. The first storage module is used to store the calculated actual trigger time window and the peripheral device linkage execution sequence into a preset auxiliary parameter address group; The judgment and triggering module is used to determine the effective output range of the trigger signal of each point by using the actual trigger time window during the process of capturing the actual feedback pulse value of the current relative position in real time and comparing it with the target pulse value in the position comparison address after receiving the automatic run start command, and to trigger each external output device in order of priority by using the peripheral linkage execution sequence.

[0048] Based on any of the above embodiments, the action triggering device may further include: The real-time recording module is used to record the actual feedback pulse value, the current trigger point number, and the system timestamp when the comparison result is a pulse mismatch, and to determine the mismatch type. The first type of execution module is used to output an alarm signal and suspend the operation of the device if the unmatched type is deviation exceeding the threshold. The second type of execution module is used to automatically skip the current point and perform the comparison of the next target pulse value if the unmatched type is timeout, while marking the current point as not triggered.

[0049] Based on any of the above embodiments, the action triggering device may further include: The clearing module is used to clear the dedicated array address and position comparison address after the comparison ends with the last target pulse value, and then re-enter the host computer parameter receiving state.

[0050] Based on any of the above embodiments, the action triggering device may further include: The second storage module is used to store all trigger points, trigger times, and pulse deviation data of this operation in the buffer area before re-entering the host computer parameter receiving state; the trigger points are the position parameters or pulse values ​​corresponding to the actual triggering of the external output signal; the trigger time is the time node when the external output signal is triggered; and the pulse deviation data is the difference between the target pulse value and the actual feedback pulse value.

[0051] It should be noted that the order of the modules and units in the above-mentioned action triggering device can be changed without affecting the logic.

[0052] The action triggering device provided in this embodiment of the invention uses a parameter conversion module 100 to convert all position parameters transmitted from the host computer into corresponding target pulse values ​​and store them in a dedicated array address; a comparison preset module 200 to preset the first target pulse value in the dedicated array address to a position comparison address; a comparison module 300 to capture the actual feedback pulse value of the current relative position in real time when the device starts running, and compare the actual feedback pulse value with the target pulse value in the position comparison address; and a loop module 400 to trigger an external output signal to execute a corresponding action when the comparison result is a pulse match, and simultaneously write the next target pulse value in the dedicated array address to the position comparison address for the next loop comparison, until the comparison ends with the last target pulse value. This device avoids the computational power consumption and time delay of real-time parameter conversion during high-speed device operation by pre-converting the position parameters sent by the host computer into target pulse values ​​and storing them in a dedicated array address; at the same time, pre-setting the first target pulse value to the position comparison address ensures that the device can immediately enter the pulse comparison process after startup, eliminating the parameter loading window period. During equipment operation, the system achieves strict synchronization between triggering actions and equipment position by accurately comparing the actual feedback pulse value with the target pulse value in real time. Furthermore, when the comparison result indicates a pulse match, the system seamlessly switches to the next target pulse value for comparison, forming a continuous closed loop of trigger-switching-re-comparison. This completely solves the problems of missed and false triggers caused by untimely pulse switching in traditional solutions, significantly improving the response speed and control accuracy of high-speed continuous action triggering at different intervals. In addition, the entire process relies on a programmable logic controller (PLC) for execution, eliminating the need for multi-module polling communication. This results in high efficiency in instruction transmission and computation, making it suitable for high-speed triggering scenarios with multiple points, such as assembly line workpiece inspection and automated assembly, greatly enhancing the practicality and compatibility of the solution.

[0053] The action triggering device provided in the embodiments of the present invention will be described below. The action triggering device described below and the action triggering method described above can be referred to in correspondence.

[0054] Please refer to Figure 6 , Figure 6 A schematic diagram of an action triggering device provided in an embodiment of the present invention may include: Memory 10 is used to store computer programs; Processor 20 is used to execute computer programs to implement the above-described action triggering method.

[0055] The memory 10, processor 20, and communication interface 31 all communicate with each other through the communication bus 32.

[0056] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment of the invention, the memory 10 may store programs for implementing the following functions: All position parameters transmitted from the host computer are converted into corresponding target pulse values ​​and stored in a dedicated array address; The first target pulse value in the dedicated array address is preset to the position comparison address; When the device starts running, it captures the actual feedback pulse value of the current relative position in real time and compares the actual feedback pulse value with the target pulse value in the position comparison address. When the comparison result is a pulse match, the external output signal is triggered to perform the corresponding action. At the same time, the next target pulse value in the dedicated array address is written to the position comparison address for the next cycle comparison, until the last target pulse value is compared and the comparison ends.

[0057] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.

[0058] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.

[0059] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.

[0060] Communication interface 31 can be an interface for the communication module, used to connect with other devices or systems.

[0061] Of course, it should be noted that, Figure 6The structure shown does not constitute a limitation on the action triggering device in the embodiments of the present invention. In practical applications, the action triggering device may include more than Figure 6 More or fewer components as shown, or combinations of certain components.

[0062] The following describes the computer-readable storage medium provided in the embodiments of the present invention. The computer-readable storage medium described below can be referred to in correspondence with the action triggering method described above.

[0063] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described action triggering method.

[0064] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0065] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0066] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0067] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0068] The foregoing has provided a detailed description of an action triggering method, apparatus, device, and computer-readable storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An action triggering method, characterized in that, Applied to programmable logic controllers, including: All position parameters transmitted from the host computer are converted into corresponding target pulse values ​​and stored in a dedicated array address; The first target pulse value in the dedicated array address is preset to the position comparison address; When the device starts running, it captures the actual feedback pulse value of the current relative position in real time and compares the actual feedback pulse value with the target pulse value in the position comparison address. When the comparison result is a pulse match, the external output signal is triggered to perform the corresponding action. At the same time, the next target pulse value in the dedicated array address is written to the position comparison address for the next cycle comparison, until the comparison ends with the last target pulse value.

2. The action triggering method according to claim 1, characterized in that, All position parameters transmitted from the host computer are converted into corresponding target pulse values ​​and stored in a dedicated array address, including: The position parameter is decomposed into integer and decimal values, and the decimal part is enlarged according to a preset multiplication factor to obtain the enlarged value; The integer value is converted into an integer pulse value, and the expanded value is converted into a decimal pulse value; The decimal pulse value is reduced according to a preset reduction factor to obtain a reduced pulse value; the preset reduction factor is equal to the preset magnification factor. The integer pulse value and the reduced pulse value are fused together to obtain the target pulse value corresponding to the position parameter, and the target pulse value is stored in the dedicated array address.

3. The action triggering method according to claim 1, characterized in that, Before converting all position parameters transmitted from the host computer into corresponding target pulse values ​​and storing them in a dedicated array address, the process also includes: The system uses a FOR loop to iterate through all parameters sent by the host computer and filters out valid point parameters according to preset parameter format verification rules. The point parameters include at least the location parameters. The parameter format verification rules include at least the parameter value range, number of bits, and integrity of the identifier bits.

4. The action triggering method according to claim 3, characterized in that, Also includes: Extract the time data and quantity data attached to the point parameters; the time data includes the preset delay time for each point trigger and the minimum interval time between adjacent points; the quantity data includes the total number of trigger points in this run and the number of peripheral linkages in a single trigger. The time data is initially calculated to obtain the actual trigger time window for each point. The starting value of the actual trigger time window is the theoretical trigger time corresponding to the target pulse value of the current point, and the ending value of the actual trigger time window is the sum of the theoretical trigger time and the preset delay time. The quantity data is initially calculated to obtain the peripheral device linkage execution sequence for this operation; the peripheral device linkage execution sequence allocates the trigger priority of each external output signal according to the number of peripheral devices linked; The calculated actual trigger time window and the peripheral device linkage execution sequence are stored in a preset auxiliary parameter address group; Upon receiving the automatic start command, while capturing the actual feedback pulse value of the current relative position in real time and comparing it with the target pulse value in the position comparison address, the effective output range of the trigger signal at each point is determined using the actual trigger time window, and each external output device is triggered sequentially according to priority using the peripheral linkage execution sequence.

5. The action triggering method according to claim 1, characterized in that, Also includes: The system records the actual feedback pulse value, the current trigger point number, and the system timestamp when the comparison result is a pulse mismatch in real time, and determines the mismatch type. If the unmatched type is deviation exceeding the threshold, an alarm signal will be output and the equipment operation will be suspended; If the unmatched type is timeout, the current point is automatically skipped and the comparison of the next target pulse value is performed, while the current point is marked as not triggered.

6. The action triggering method according to claim 1, characterized in that, After the comparison ends at the last target pulse value, it also includes: Clear the dedicated array address and position comparison address, and re-enter the host computer parameter receiving state.

7. The action triggering method according to claim 6, characterized in that, Before re-entering the host computer parameter receiving state, the following steps are also included: All trigger points, trigger times, and pulse deviation data for this operation are stored in the buffer. The trigger point is the position parameter or pulse value corresponding to the actual triggering of the external output signal. The trigger time is the time node when the external output signal is triggered. The pulse deviation data is the difference between the target pulse value and the actual feedback pulse value.

8. An action triggering device, characterized in that, Applied to programmable logic controllers, including: The parameter conversion module is used to convert all position parameters transmitted from the host computer into corresponding target pulse values ​​and store them in a dedicated array address; The comparison preset module is used to preset the first target pulse value in the dedicated array address to the position comparison address; The comparison module is used to capture the actual feedback pulse value of the current relative position in real time when the device starts running, and compare the actual feedback pulse value with the target pulse value in the position comparison address; The loop module is used to trigger an external output signal to perform a corresponding action when the comparison result is a pulse match. At the same time, it writes the next target pulse value in the dedicated array address to the position comparison address for the next loop comparison, until the comparison ends with the last target pulse value.

9. An action triggering device, characterized in that, include: Memory, used to store computer programs; A processor for implementing the action triggering method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the action triggering method as described in any one of claims 1 to 7.