An axle control method, system, terminal and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-29
- Publication Date
- 2026-08-11
AI Technical Summary
[0004]本发明提出了一种轴控方法、系统、终端及存储介质,能够解决现有技术设备模型与运动控制模型之间耦合度高且通用性差而导致在复杂运动控制场景下存在轴控策略执行可靠性差的问题
[0010] In the above scheme, the validity of the axis object and the consistency of axis switching are verified based on the running status to obtain the legality verification result. The enable status and fault status are judged based on the error information to obtain the status judgment result. Then, the target running mode is determined according to the control request and the mode word is obtained. The verification, judgment and instruction generation logic that were originally mixed in a single control flow are separated. In addition, the initial control word combination will only be issued according to the mode word if the legality verification result is passed and the status judgment result meets the preset enable requirements. This avoids control chaos caused by illegal operation or abnormal status and helps to improve the reliability of axis control strategy execution.
Smart Images

Figure CN122546771A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation and robot control technology, and in particular to an axis control method, system, terminal and storage medium. Background Technology
[0002] In the fields of industrial automation and robot control, multi-axis motion control systems are typically implemented using a layered architecture. The CIA402 protocol, as the mainstream servo drive device model standard, defines the state machine structure of the axes, the mapping relationship between control words and state words, and various standardized operating modes. The PLCopen motion control model, on the other hand, provides a series of function block interfaces at the application layer, such as MC_Power, MC_MoveAbsolute, and MC_Stop, to describe axis control behavior. Theoretically, combining the CIA402 protocol with the PLCopen motion control model can realize a universal axis control system. However, due to their different hierarchical levels and design goals, their direct integration faces numerous engineering challenges.
[0003] Currently, the common approach in existing technologies is to allow the PLCopen function block to directly or indirectly manipulate the status words, control words, or PDO data of the CIA402 axis, meaning the motion control function block interacts directly with the underlying driver state machine. While this approach can meet basic requirements in simple single-axis control scenarios, the lack of a unified intermediate abstraction layer leads to the axis status judgment logic being scattered across multiple function blocks. Different function blocks have inconsistent understandings of axis status, error handling, and execution timing, which can easily result in instruction overwriting, unclear preemption, and uncertain behavior in scenarios with multiple concurrent motion commands, interpolation, or switching. Furthermore, axis status management, motion planning, and real-time execution logic are often mixed within the same control flow, requiring significant modifications to underlying code when adding new motion modes or planning algorithms, resulting in poor system scalability. Therefore, existing technologies generally suffer from high coupling and poor versatility between the device model and the motion control model, leading to poor reliability of axis control strategy execution in complex motion control scenarios. Summary of the Invention
[0004] This invention proposes an axis control method, system, terminal, and storage medium that addresses the problem of poor reliability in axis control strategy execution under complex motion control scenarios caused by the high coupling and poor versatility between existing equipment models and motion control models. This invention constructs a unified axis control model between the equipment model and the motion control model, enabling centralized management of axis control parameters and decoupling between the two models. This ensures consistent behavior of axis control parameters under complex motion control scenarios, thereby improving the reliability of axis control strategy execution.
[0005] To achieve the above objectives, embodiments of the present invention provide an axis control method executed by an axis control model, which is positioned between a device model and a motion control model. The method includes: responding to a control request issued by the motion control model to a target axis, reading real-time operating status data and protocol feedback data of the target axis from the device model; performing a validity check and status determination on the target axis based on the control request and the real-time operating status data; if the validity check passes and the status determination meets preset enable requirements, generating a control command for the current control stage; based on the protocol feedback data, if the control command for the current control stage meets a preset status check expectation, proceeding to the next control stage and generating a control command corresponding to the next control stage according to a preset status progression rule, obtaining a step-by-step control command; and generating an axis control strategy based on the step-by-step control command to complete the target axis control.
[0006] This invention proposes an axis control method in which an axis control model, positioned between the device model and the motion control model, uniformly executes control request responses, data reading, validity verification, state determination, hierarchical control command generation, and axis control strategy output. By constructing a clear intermediate abstraction layer between the device model and the motion control model, the upper-level motion control function modules can complete axis control operations without directly manipulating the underlying protocol details. Furthermore, the axis state judgment logic is centrally managed by the axis control model, thereby decoupling the device model and the motion control model. This ensures consistent axis control parameter behavior in complex motion control scenarios and improves the reliability of axis control strategy execution.
[0007] Furthermore, the step of responding to the control request issued by the motion control model to the target axis and reading the real-time operating status data and protocol feedback data of the target axis from the device model includes: encapsulating the physical axis or virtual axis to be controlled as the target axis; obtaining the execution trigger signal issued by the motion control model, parsing the corresponding target axis and the corresponding control request from the execution trigger signal, reading the operating status and error information associated with the target axis from the device model as real-time operating status data; and reading the protocol parameters associated with the target axis from the device model as protocol feedback data.
[0008] In the above scheme, physical or virtual axes are uniformly encapsulated as target axes, and the target axis and control request are parsed from the execution trigger signal. At the same time, the running status and error information are read from the device model as real-time running status data, and the protocol parameters are read as protocol feedback data. A standard target axis object is uniformly abstracted through the axis control model. The upper-level functional blocks only need to make control requests to this unified object, which effectively decouples the device model and the motion control model and helps to improve the reliability of axis control strategy execution.
[0009] Furthermore, based on the control request and the real-time operating status data, the target axis is subjected to legality verification and status determination. If the legality verification passes and the status determination meets the preset enable requirements, a control instruction for the current control stage is generated, including: based on the operating status associated with the target axis, performing axis object validity verification and axis switching consistency verification on the target axis to obtain a legality verification result; based on the error information associated with the target axis, performing enable status determination and fault status determination on the target axis to obtain a status determination result; determining the target operating mode based on the control request and obtaining the mode word corresponding to the target operating mode; if the legality verification result passes and the status determination result meets the preset enable requirements, then the initial control word combination for the current control stage is issued according to the mode word, and the initial control word combination is used as a control instruction.
[0010] In the above scheme, the validity of the axis object and the consistency of axis switching are verified based on the running status to obtain the legality verification result. The enable status and fault status are judged based on the error information to obtain the status judgment result. Then, the target running mode is determined according to the control request and the mode word is obtained. The verification, judgment and instruction generation logic that were originally mixed in a single control flow are separated. In addition, the initial control word combination will only be issued according to the mode word if the legality verification result is passed and the status judgment result meets the preset enable requirements. This avoids control chaos caused by illegal operation or abnormal status and helps to improve the reliability of axis control strategy execution.
[0011] Furthermore, based on the operating state associated with the target axis, the target axis is subjected to axis object validity verification and axis switching consistency verification to obtain a legality verification result, including: based on the operating state associated with the target axis, if the target axis is empty, the current control stage is determined to be invalid, and the axis object validity verification result is output as failing; if the target axis is not empty, the current control stage is determined to be valid, and the axis object validity verification result is output as passing; based on the operating state associated with the target axis, if the target axis bound to it changes when the same control action is executed, the current control stage is determined to have an abnormal axis switching error, and the axis switching consistency verification result is output as failing; if the target axis bound to it remains unchanged when the same control action is executed, the current control stage is determined to have no abnormal axis switching error, and the axis switching consistency verification result is output as passing; after completing the axis object validity verification and axis switching consistency verification, the axis object validity verification result and the axis switching consistency verification result are used as the legality verification result, wherein when the axis object validity verification result is passing and the axis switching consistency verification result is passing, the legality verification result is passing.
[0012] In the above scheme, the specific execution logic and judgment criteria for axis object validity verification and axis switching consistency verification are defined. Through the axis object validity verification mechanism and the axis switching consistency verification mechanism, it is ensured that the axis object of each control action is valid and corresponds to only one specific target axis. The verification result is used as the core component of the legality verification result, which helps to improve the reliability of axis control strategy execution.
[0013] Furthermore, based on the error information associated with the target axis, the target axis is assessed for both its enable state and fault state to obtain a state determination result. This includes: acquiring the current internal state and error information of the target axis; if the current internal state is an unenabled state and the error information indicates no fault, the state determination result is that the preset enable requirement is met; if the current internal state is not an unenabled state or the error information indicates a fault, the state determination result is that the preset enable requirement is not met and the control flow of the current control stage is terminated.
[0014] In the above scheme, the current internal state and error information of the target axis are obtained, and it is strictly determined that the preset enable requirements can only be met when the internal state is in the disabled enable state and the error information indicates no fault. Through dual verification of enable state judgment and fault state judgment, the protocol state advancement process is only allowed when the axis is in a safe and operable state; otherwise, the control process is immediately terminated, thereby effectively preventing illegal operation and improving the reliability of axis control strategy execution.
[0015] Furthermore, based on the protocol feedback data, if the control command of the current control stage meets the preset state verification expectation, then proceed to the next control stage and generate the control command corresponding to the next control stage according to the preset state progression rule, thus obtaining a step-by-step control command. This includes: whenever the control command of the current control stage is generated, obtaining the protocol feedback data of the current control stage; if the control command of the current control stage meets the preset state verification expectation, then proceed to the next control stage and construct a determination mask in each control stage; based on the determination mask and the preset state progression rule, adding a control bit to the control command of the current control stage to generate the control command corresponding to the next control stage, thus obtaining a step-by-step control command.
[0016] In the above scheme, protocol feedback data is obtained whenever a control command for the current control stage is generated, and the next control stage is entered after the preset state verification expectation is met. At the same time, a decision mask is constructed in each control stage, and a control bit is added to the current control command based on the decision mask and the preset state advancement rules to generate the next stage command. This ensures that the issuance of each level of control command is based on the confirmation of the execution result of the previous level, which helps to improve the reliability of the axis control strategy execution.
[0017] Furthermore, in the step of obtaining step-by-step control instructions based on the protocol feedback data, if the control instruction of the current control stage meets the preset state verification expectation, then proceed to the next control stage and generate the control instruction corresponding to the next control stage according to the preset state advancement rule, the step further includes: in each control stage, if the control instruction does not meet the preset state verification expectation within a preset time interval, then it is determined that the current stage has failed to advance, and the control process of the current control stage is terminated.
[0018] In the above scheme, a timeout monitoring mechanism is introduced. A preset time interval is set in each control stage. If the control command does not meet the preset state verification expectation within the time interval, the current stage is judged to have failed and the control process is terminated. This enables the axis control model to have the ability to monitor, interrupt and roll back the execution process. The result is transparent after the control is issued. When it fails, the error can be reported in time and the process can be terminated, which helps to improve the reliability of axis control strategy execution.
[0019] This invention also provides an axis control system applied to an axis control model, which is positioned between a device model and a motion control model. The axis control model includes a data acquisition module, a control command generation module, a hierarchical control command generation module, and a target axis control module. Specifically: the data acquisition module responds to a control request from the motion control model to the target axis by reading real-time operating status data and protocol feedback data of the target axis from the device model; the control command generation module performs legality verification and status determination on the target axis based on the control request and the real-time operating status data; if the legality verification passes and the status determination meets preset enabling requirements, it generates control commands for the current control stage; the hierarchical control command generation module, based on the protocol feedback data, if the control commands for the current control stage meet preset status verification expectations, proceeds to the next control stage and generates control commands corresponding to the next control stage according to preset status progression rules, thus obtaining hierarchical control commands; the target axis control module generates an axis control strategy based on the hierarchical control commands to complete the target axis control.
[0020] This invention proposes an axis control system in which an axis control model, positioned between the device model and the motion control model, uniformly executes control request responses, data reading, validity verification, status determination, hierarchical control command generation, and axis control strategy output. By constructing a clear intermediate abstraction layer between the device model and the motion control model, the upper-level motion control function modules can complete axis control operations without directly manipulating the underlying protocol details. Furthermore, the axis status judgment logic is centrally managed by the axis control model, thereby decoupling the device model and the motion control model. This ensures consistent axis control parameter behavior in complex motion control scenarios and improves the reliability of axis control strategy execution.
[0021] An axis control terminal includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the aforementioned axis control method when executing the computer program.
[0022] A shaft-controlled storage medium includes a stored computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute the shaft-controlled method. Attached Figure Description
[0023] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is one embodiment of the present invention; Figure 2 This is one embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0027] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0028] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0029] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0030] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0031] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0032] To address the issue of poor reliability in axis control strategy execution under complex motion control scenarios caused by the high coupling and poor versatility between existing equipment models and motion control models, see [reference needed]. Figure 1 , Figure 1 This is one embodiment provided by the present invention. For example... Figure 1 As shown, this embodiment of the invention proposes an axis control method, executed by an axis control model, which is set between a device model and a motion control model. The method includes steps 101 to 104, each step being as follows: Step 101: In response to the control request issued by the motion control model to the target axis, read the real-time operating status data and protocol feedback data of the target axis from the device model; Step 102: Based on the control request and the real-time operating status data, perform a legality check and a status determination on the target axis. If the legality check passes and the status determination meets the preset enable requirements, then generate the control command for the current control stage. Step 103: Based on the protocol feedback data, if the control command of the current control stage meets the preset state verification expectation, then proceed to the next control stage and generate the control command corresponding to the next control stage according to the preset state advancement rule to obtain the step-by-step control command. Step 104: Based on the step-by-step control instructions, generate an axis control strategy to complete the target axis control.
[0033] One possible implementation involves an axis control model positioned between the device model and the motion control model. The device model uses the CIA402 protocol model for interpretation, enabling communication and basic control with the servo driver. It also standardizes the interaction of axis control words, status words, and motion parameters. Furthermore, the CIA402 protocol model maintains the switching between axis states (enabled, running, stopped, and faulty), facilitates periodic interaction of data such as target position, target speed, and target torque, and sets axis attribute parameters such as encoder resolution, reduction ratio, direction, and limits. The motion control model uses the PLCopen motion control model for interpretation. This model includes various motion control functions, such as axis power-on / power-off, reset, fault clearing, functional position, speed, torque, stop, emergency stop, and parameter adjustment. Each motion control function uses a unified execution model. Simultaneously, status data such as execution trigger state, execution in progress state, completion state, interruption state, and error state are bound to the axis object through a standardized interface.
[0034] This invention proposes an axis control method executed by an axis control model. In this embodiment, the power-on scenario of a single axis switching from a de-enabled state to an operational standby state is used as an example. First, the axis control model receives a power-on request from the MC_PowerOn function block. The request data includes an execution trigger signal and the target axis object. The model reads the target axis's status word, actual position, internal status, and fault flag from the device model. Then, based on the control request and real-time operating status data, it performs legality verification and status determination. After successful verification, it generates control instructions for the current control stage and determines the CSP mode word and initial control word combination according to the CIA402 state machine rules. Next, the axis control model reads protocol feedback data and checks whether the current control instruction meets the preset state verification expectation. If it does, it enters the next control stage, generating subsequent control word combinations sequentially according to the preset state progression rules, ultimately obtaining complete hierarchical control instructions. Finally, these instructions are encapsulated into PDO data and sent to the driver, completing the axis power-on enable control.
[0035] It is worth mentioning that before entering the formal enable process, and in the non-initial preparation state, the protocol control layer performs target position alignment processing. First, it reads the actual position of the target axis, then writes the actual position into the target position register, and then calculates the position error. Thus, before switching to the cyclic synchronization position mode or entering the enable state, the target position is kept consistent with the actual position, thereby making the position deviation approach zero. The position error calculation process is as follows: ; In the formula, This refers to the positional error; This indicates the actual position of the current control cycle k; This indicates the target location to be written to the driver during the current control cycle; due to position alignment, the position error... or at least ,in, It can be designed according to the actual application. After the target position is aligned, the final target position can be used as the real-time running status data of the target axis for subsequent processing.
[0036] This invention proposes an axis control method in which an axis control model, positioned between the device model and the motion control model, uniformly executes control request responses, data reading, validity verification, state determination, hierarchical control command generation, and axis control strategy output. By constructing a clear intermediate abstraction layer between the device model and the motion control model, the upper-level motion control function modules can complete axis control operations without directly manipulating the underlying protocol details. Furthermore, the axis state judgment logic is centrally managed by the axis control model, thereby decoupling the device model and the motion control model. This ensures consistent axis control parameter behavior in complex motion control scenarios and improves the reliability of axis control strategy execution.
[0037] In a preferred embodiment, the step of responding to a control request issued by the motion control model to a target axis and reading real-time operating status data and protocol feedback data of the target axis from the device model includes: encapsulating the physical or virtual axis to be controlled as a target axis; obtaining an execution trigger signal issued by the motion control model; parsing the corresponding target axis and the corresponding control request from the execution trigger signal; reading the operating status and error information associated with the target axis from the device model as real-time operating status data; and reading the protocol parameters associated with the target axis from the device model as protocol feedback data.
[0038] For example, the axis control model first encapsulates the physical servo axis or the virtual axis simulated by software into a standard target axis object. This object internally associates the axis's operating status, error information, and CIA402 protocol parameters. When the motion control model issues a control request, the axis control model obtains the execution trigger signal of the upper-level function block, and parses the bound target axis object identifier and the specific type of control request from this signal. The control request type includes power-on enable, position movement, or stop. Then, the axis control model reads the operating status and error information associated with the target axis from the device model as real-time operating status data, and simultaneously reads the protocol parameters as protocol feedback data. The operating status includes whether it is currently enabled and whether it is in motion; the error information includes overvoltage, overcurrent, and communication failure; and the protocol parameters include the current status word value and the actual encoder position.
[0039] In the above scheme, physical or virtual axes are uniformly encapsulated as target axes, and the target axis and control request are parsed from the execution trigger signal. At the same time, the running status and error information are read from the device model as real-time running status data, and the protocol parameters are read as protocol feedback data. A standard target axis object is uniformly abstracted through the axis control model. The upper-level functional blocks only need to make control requests to this unified object, which effectively decouples the device model and the motion control model and helps to improve the reliability of axis control strategy execution.
[0040] In a preferred embodiment, based on the control request and the real-time operating status data, the target axis is subjected to legality verification and status determination. If the legality verification passes and the status determination meets the preset enable requirements, a control instruction for the current control stage is generated. This includes: performing axis object validity verification and axis switching consistency verification on the target axis based on the operating status associated with the target axis to obtain a legality verification result; performing enable status determination and fault status determination on the target axis based on the error information associated with the target axis to obtain a status determination result; determining the target operating mode based on the control request and obtaining the mode word corresponding to the target operating mode; if the legality verification result passes and the status determination result meets the preset enable requirements, issuing an initial control word combination for the current control stage according to the mode word, and using the initial control word combination as a control instruction.
[0041] For example, the axis control model performs axis object validity verification and axis switching consistency verification based on the running status associated with the target axis. If both verifications pass, the validity verification result is passed. At the same time, based on the error information associated with the target axis, the enable status judgment and fault status judgment are performed. If the axis is in the off-enable state and there is no fault, the status judgment result is that the preset enable requirements are met. After the validity verification and status judgment both pass, in this embodiment, the axis control model determines the target running mode as the cyclic synchronous position mode, denoted as CSP, according to the "power on" intention in the control request. It obtains the mode word corresponding to this mode from the configuration table, denoted as 0x08. Then, according to the transition rules of the CIA402 state machine from the current state to the next state, it issues the initial control word combination required for the current control stage. For example, the initial control word combination is set to the bit combination corresponding to 0x06. This initial control word combination is the control instruction for the current control stage.
[0042] In the above scheme, the validity of the axis object and the consistency of axis switching are verified based on the running status to obtain the legality verification result. The enable status and fault status are judged based on the error information to obtain the status judgment result. Then, the target running mode is determined according to the control request and the mode word is obtained. The verification, judgment and instruction generation logic that were originally mixed in a single control flow are separated. In addition, the initial control word combination will only be issued according to the mode word if the legality verification result is passed and the status judgment result meets the preset enable requirements. This avoids control chaos caused by illegal operation or abnormal status and helps to improve the reliability of axis control strategy execution.
[0043] In a preferred embodiment, based on the operating state associated with the target axis, axis object validity verification and axis switching consistency verification are performed on the target axis to obtain a legality verification result. This includes: based on the operating state associated with the target axis, if the target axis is empty, the current control phase is determined to be invalid, and the axis object validity verification result is output as "failed"; if the target axis is not empty, the current control phase is determined to be valid, and the axis object validity verification result is output as "passed"; based on the operating state associated with the target axis, if the target axis bound to it changes when the same control action is executed, an abnormal axis switching error is determined to exist in the current control phase, and the axis switching consistency verification result is output as "failed"; if the target axis bound to it remains unchanged when the same control action is executed, an abnormal axis switching error is determined to exist in the current control phase, and the axis switching consistency verification result is output as "passed"; after completing the axis object validity verification and axis switching consistency verification, the axis object validity verification result and the axis switching consistency verification result are used as the legality verification result, wherein when both the axis object validity verification result and the axis switching consistency verification result are passed, the legality verification result is considered passed.
[0044] For example, when the axis control model performs axis object validity verification, it obtains the parsed target axis object pointer. If the pointer is null, the current control phase is determined to be invalid, the axis object validity verification result is output as "failed," and an error flag and error code are returned, specifically as follows: ; In the formula, Axis represents the target axis object pointer, Error represents the target axis error status, when the target axis error status value is 1, the current control phase is determined to be invalid, ErrorID represents the error flag, and SMEC_INVALID_AXIS represents the axis object validity verification error code.
[0045] If the pointer is not null, it is considered valid, and the output is passed.
[0046] During axis switching consistency verification, the axis control model records the axis object ID bound to each function block instance upon its first execution. This axis object ID can be represented as a target axis object pointer. In subsequent calls to the same function block instance, the model compares the currently bound target axis object pointer with the initially recorded target axis object pointer. If they do not match, an abnormal axis switching error is determined, the axis switching consistency verification result is output as "failed," an error code is returned, and the system enters an error-stopped state. Specifically: ; In the formula, bExecute=1 indicates that the current function block instance is triggered to execute in this scan cycle; m_bExecute=1 indicates that the current function block instance was also in the execution state during the previous call, that is, the current function block is in continuous execution; Axis new Axis represents the pointer to the target axis object bound when the current function block is invoked again. old Axis represents the pointer to the target axis object recorded when the current function block is first executed; new ≠Axis old This indicates that the target axis object pointers bound before and after the same function block instance change during continuous execution; ErrorStop indicates entering an error stop state.
[0047] If they match, output "Pass".
[0048] The validity check result is considered to be passed only if the axis object validity check result is passed and the axis switching consistency check result is passed; otherwise, the control flow is terminated.
[0049] In the above scheme, the specific execution logic and judgment criteria for axis object validity verification and axis switching consistency verification are defined. Through the axis object validity verification mechanism and the axis switching consistency verification mechanism, it is ensured that the axis object of each control action is valid and corresponds to only one specific target axis. The verification result is used as the core component of the legality verification result, which helps to improve the reliability of axis control strategy execution.
[0050] In a preferred embodiment, based on the error information associated with the target axis, an enable state judgment and a fault state judgment are performed on the target axis to obtain a state judgment result, including: obtaining the current internal state and error information of the target axis; if the current internal state is a disabled enable state and the error information indicates no fault, the state judgment result is that the preset enable requirement is met; if the current internal state is not a disabled enable state or the error information indicates a fault, the state judgment result is that the preset enable requirement is not met and the control flow of the current control stage is terminated.
[0051] For example, the axis control model calls the axis object's read interface to obtain its current internal state and error information. For instance, it determines the current internal state using the enumeration value returned by the `Axis_ReadAxisState()` function and the error information using the error code returned by the `Axis_CheckError()` function. The error code is non-zero when there is a fault and zero when there is no fault. If the current internal state is equal to the disabled enable state and the error information indicates no fault, the state determination result is that the preset enable requirement is met, and the axis control model continues to execute the subsequent protocol state advancement process. If the current internal state is not the disabled enable state, or the error information indicates a fault, the state determination result is that the preset enable requirement is not met, and the axis control model immediately terminates the control flow of the current control phase and outputs a failure flag and the corresponding error code. It is worth noting that the protocol state advancement phase is only allowed when the axis is currently in an enableable disabled state and there is no fault; otherwise, the power-on request fails directly, which can be represented as: ; In the formula, EnableAllowed indicates whether the enable phase is allowed, with 1 indicating permission and 0 indicating disallowance; State indicates the current internal state of the axis; power_off indicates that the axis is in the off-enabled state, i.e., not powered on; Fault indicates the axis's fault flag, where Fault=0 indicates no fault and Fault≠0 indicates a fault; otherwise indicates other fault conditions.
[0052] In the above scheme, the current internal state and error information of the target axis are obtained, and it is strictly determined that the preset enable requirements can only be met when the internal state is in the disabled enable state and the error information indicates no fault. Through dual verification of enable state judgment and fault state judgment, the protocol state advancement process is only allowed when the axis is in a safe and operable state; otherwise, the control process is immediately terminated, thereby effectively preventing illegal operation and improving the reliability of axis control strategy execution.
[0053] In a preferred embodiment, based on the protocol feedback data, if the control command of the current control stage meets the preset state verification expectation, then proceed to the next control stage and generate the control command corresponding to the next control stage according to the preset state progression rule to obtain a hierarchical control command, including: whenever the control command of the current control stage is generated, obtaining the protocol feedback data of the current control stage; if the control command of the current control stage meets the preset state verification expectation, then proceed to the next control stage and construct a determination mask in each control stage; based on the determination mask and the preset state progression rule, adding a control bit to the control command of the current control stage to generate the control command corresponding to the next control stage, thus obtaining a hierarchical control command.
[0054] For example, after generating and issuing control commands in each control stage, the axis control model does not immediately proceed to the next stage. Instead, it reads the protocol data fed back by the device model, particularly the value of the target axis's status word. Then, the axis control model constructs a decision mask based on the target state of the current stage. It performs a bitwise AND operation between the read status word and the decision mask. If the result equals the expected value, the control command of the current control stage is determined to meet the preset state verification expectation. After meeting the expectation, the axis control model enters the next control stage. In this stage, based on the control command of the previous stage, it adds corresponding control bits according to the preset state progression rule, thereby generating a new control command for the next control stage. The preset state progression rule can be the state transition path defined by CIA402. The hierarchical construction of the control word can be abstracted as follows: ; In the formula, The current control word; Add control bits required for the i-th protocol phase.
[0055] It is worth mentioning that the process of adding corresponding control bits according to the preset state progression rules can be represented as follows: In the first stage, when the waiting state meets the 0x06 condition, a judgment mask is constructed. When satisfied This indicates that the system has entered the next advanceable state, and only then will the next control word be issued. The value of the status word for the target axis; In the second stage, if the waiting state word satisfies the 0x07 condition, a decision mask is constructed. If satisfied If so, then we will continue to move forward.
[0056] In the third stage, the wait state word satisfies the 0x08 condition, and a decision mask is constructed. If satisfied This indicates that the driver has completed power-on enable. Here, 0x08 is the mode word corresponding to the cyclic synchronization position mode. and This refers to the specific control word.
[0057] This results in hierarchical control commands.
[0058] In the above scheme, protocol feedback data is obtained whenever a control command for the current control stage is generated, and the next control stage is entered after the preset state verification expectation is met. At the same time, a decision mask is constructed in each control stage, and a control bit is added to the current control command based on the decision mask and the preset state advancement rules to generate the next stage command. This ensures that the issuance of each level of control command is based on the confirmation of the execution result of the previous level, which helps to improve the reliability of the axis control strategy execution.
[0059] In a preferred embodiment, the step of proceeding to the next control stage and generating the control instruction corresponding to the next control stage according to the preset state progression rule based on the protocol feedback data to obtain the step-by-step control instruction further includes: in each control stage, if the control instruction does not meet the preset state verification expectation within a preset time interval, it is determined that the current stage has failed to progress, and the control process of the current control stage is terminated.
[0060] For example, the axis control model starts a timer while issuing control commands in each control stage, and sets a preset time interval, which is represented as a timeout threshold in this embodiment, for example, 100 milliseconds based on the fieldbus cycle and driver response characteristics. During the timer's operation, the axis control model periodically reads the status word fed back by the device model and compares it with the expected status. If a status word matching the expected status is detected within the timeout threshold, the timer is stopped and the next control stage is entered; if the expected status is not matched after the timer expires, the current stage is determined to have failed, the axis control model immediately terminates the entire control process, outputs a timeout error flag and the corresponding error code, and performs a safety rollback operation as needed. Specifically, this can be represented as follows: ; In the formula, The duration of the current phase; The preset timeout threshold is SMEC_TIMEOUT, which is the timeout monitoring error code.
[0061] In the above scheme, a timeout monitoring mechanism is introduced. A preset time interval is set in each control stage. If the control command does not meet the preset state verification expectation within the time interval, the current stage is judged to have failed and the control process is terminated. This enables the axis control model to have the ability to monitor, interrupt and roll back the execution process. The result is transparent after the control is issued. When it fails, the error can be reported in time and the process can be terminated, which helps to improve the reliability of axis control strategy execution.
[0062] Based on the above method embodiments, corresponding apparatus embodiments are provided; see [link to apparatus embodiments]. Figure 2 , Figure 2 This is one embodiment provided by the present invention. For example... Figure 2 As shown, this embodiment of the invention also provides an axis control system applied to an axis control model. The axis control model is set between a device model and a motion control model, including a data acquisition module 201, a control command generation module 202, a step-by-step control command generation module 203, and a target axis control module 204. Specifically: the data acquisition module 201 is used to respond to a control request issued by the motion control model to a target axis by reading real-time operating status data and protocol feedback data of the target axis from the device model; the control command generation module 202 is used to perform legality verification and status determination on the target axis based on the control request and the real-time operating status data. If the legality verification passes and the status determination meets preset enabling requirements, then a control command for the current control stage is generated; the step-by-step control command generation module 203 is used to, based on the protocol feedback data, if the control command of the current control stage meets a preset status verification expectation, then proceed to the next control stage and generate the control command corresponding to the next control stage according to a preset status advancement rule, thus obtaining step-by-step control commands; the target axis control module 204 is used to generate an axis control strategy based on the step-by-step control commands to complete the target axis control.
[0063] This invention proposes an axis control system in which an axis control model, positioned between the device model and the motion control model, uniformly executes control request responses, data reading, validity verification, status determination, hierarchical control command generation, and axis control strategy output. By constructing a clear intermediate abstraction layer between the device model and the motion control model, the upper-level motion control function modules can complete axis control operations without directly manipulating the underlying protocol details. Furthermore, the axis status judgment logic is centrally managed by the axis control model, thereby decoupling the device model and the motion control model. This ensures consistent axis control parameter behavior in complex motion control scenarios and improves the reliability of axis control strategy execution.
[0064] It is understood that the above-described device embodiments correspond to the method embodiments of the present invention, and can implement the axis control method provided by any of the above-described method embodiments of the present invention.
[0065] It should be noted that the device embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can specifically be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0066] Based on the above embodiment of the axis control method, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements an axis control method of any embodiment of the present invention.
[0067] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.
[0068] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0069] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0070] Based on the above-described method embodiments, another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute an axis control method as described in any of the above-described method embodiments of the present invention.
[0071] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0072] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method of shaft control, characterized by, Executed by an axis control model, wherein the axis control model is positioned between the device model and the motion control model, the method includes: In response to the control request issued by the motion control model to the target axis, the real-time operating status data and protocol feedback data of the target axis are read from the device model; Based on the control request and the real-time operating status data, the target axis is subjected to legality verification and status determination. If the legality verification passes and the status determination meets the preset enable requirements, then the control command for the current control stage is generated. Based on the protocol feedback data, if the control command of the current control stage meets the preset state verification expectation, then proceed to the next control stage and generate the control command corresponding to the next control stage according to the preset state advancement rule, thus obtaining the step-by-step control command. Based on the step-by-step control instructions, an axis control strategy is generated to complete the target axis control.
2. A shaft control method according to claim 1, wherein The step of responding to the control request issued by the motion control model to the target axis by reading the real-time operating status data and protocol feedback data of the target axis from the device model includes: Encapsulate the physical or virtual axis to be controlled as the target axis; Obtain the execution trigger signal issued by the motion control model, and parse the corresponding target axis and the corresponding control request from the execution trigger signal. Read the operating status and error information associated with the target axis from the device model as real-time operating status data; The protocol parameters associated with the target axis are read from the device model as protocol feedback data.
3. A shaft control method according to claim 2, wherein Based on the control request and the real-time operating status data, the target axis undergoes legality verification and status determination. If the legality verification passes and the status determination meets the preset enable requirements, then control instructions for the current control phase are generated, including: Based on the running status associated with the target axis, the target axis is subjected to axis object validity verification and axis switching consistency verification to obtain the legality verification result; Based on the error information associated with the target axis, the target axis is judged for enable status and fault status to obtain the status judgment result. Based on the control request, the target operating mode is determined, and the mode word corresponding to the target operating mode is obtained. If the legality verification result is passed and the status determination result meets the preset enable requirements, the initial control word combination of the current control stage is issued according to the mode word, and the initial control word combination is used as the control instruction.
4. A shaft control method as claimed in claim 3, characterized in that Based on the associated running status of the target axis, the target axis is subjected to axis object validity verification and axis switching consistency verification to obtain the legality verification result, including: Based on the running status associated with the target axis, if the target axis is empty, the current control phase is determined to be invalid, and the axis object validity verification result is output as failing. If the target axis is not empty, the current control phase is determined to be valid, and the axis object validity verification result is output as passed; Based on the operating status associated with the target axis, if the target axis bound to it changes when the same control action is executed, it is determined that there is an abnormal axis switching error in the current control stage, and the axis switching consistency verification result is output as failing. If the target axis remains unchanged when performing the same control action, it is determined that there is no abnormal axis switching error in the current control phase, and the axis switching consistency verification result is output as passed; After completing the axis object validity check and axis switch consistency check, the axis object validity check result and the axis switch consistency check result are used as the legality check result. Specifically, when the axis object validity check result is passed and the axis switch consistency check result is passed, the legality check result is passed.
5. A shaft control method as claimed in claim 3, characterized in that Based on the error information associated with the target axis, the target axis is assessed for both its enable status and fault status to obtain a status determination result, including: Obtain the current internal state and error information of the target axis; If the current internal state is an disabled enable state and the error message indicates no fault, then the state determination result is that the preset enable requirement is met; If the current internal state is not in an off-enabled state or the error message indicates a fault, the state determination result is that the preset enable requirement is not met and the control flow of the current control stage is terminated.
6. A shaft control method as claimed in claim 1, characterized in that Based on the protocol feedback data, if the control command in the current control phase meets the preset state verification expectation, then the next control phase is entered and the control command corresponding to the next control phase is generated according to the preset state progression rule, resulting in hierarchical control commands, including: Whenever the control command for the current control phase is generated, the protocol feedback data for the current control phase is obtained; If the control command in the current control phase meets the preset state verification expectation, then proceed to the next control phase, and construct a judgment mask in each control phase; Based on the determination mask and the preset state progression rule, a control bit is added to the control instruction in the current control stage to generate the control instruction corresponding to the next control stage, thus obtaining a step-by-step control instruction.
7. A shaft control method as claimed in claim 6, characterized in that In the step of obtaining step-by-step control instructions based on the protocol feedback data, if the control instructions of the current control stage meet the preset state verification expectation, then proceed to the next control stage and generate the control instructions corresponding to the next control stage according to the preset state progression rules, the step further includes: In each of the control stages, if the control command fails to meet the preset state verification expectation within a preset time interval, it is determined that the current stage has failed to proceed, and the control process of the current control stage is terminated.
8. A shaft governing system characterized by, This is applied to an axis control model, which is positioned between the equipment model and the motion control model. The model includes a data acquisition module, a control command generation module, a hierarchical control command generation module, and a target axis control module; wherein: The data acquisition module is used to respond to the control request issued by the motion control model to the target axis and read the real-time operating status data and protocol feedback data of the target axis from the device model; The control command generation module is used to perform legality verification and status determination on the target axis based on the control request and the real-time running status data. If the legality verification passes and the status determination meets the preset enable requirements, then the control command for the current control stage is generated. The step-by-step control instruction generation module is used to, based on the protocol feedback data, if the control instruction of the current control stage meets the preset state verification expectation, then proceed to the next control stage and generate the control instruction corresponding to the next control stage according to the preset state advancement rule, thereby obtaining the step-by-step control instruction. The target axis control module is used to generate an axis control strategy based on the hierarchical control instructions to complete the target axis control.
9. An axle control terminal, characterized in that The terminal includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements an axis control method as described in any one of claims 1 to 7.
10. A shaft-controlled storage medium, characterized by The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform an axis control method as described in any one of claims 1 to 7.