An automatic control device and method of a measurement and control station based on an editable script
By using an automated control device for telemetry and control stations based on editable scripts, the problem of standardized management caused by inconsistencies in the monitoring systems of telemetry and control stations has been solved. This has enabled efficient, flexible, and low-cost multi-task parallel control of aerospace telemetry and control stations, and improved the standardization and adaptability of the stations.
Patent Information
- Application Number
- CN202511009019.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-07-22
AI Technical Summary
Due to the inconsistency of the monitoring systems of the telemetry and control stations, each station lacks a unified control command interface, making it difficult to achieve standardized management. Furthermore, the existing automated processes are not flexible enough to adapt to tracking and control tasks of different types of spacecraft.
An automated control device for the telemetry and control station based on editable scripts is adopted. The control process is defined by script files, and the script server calls the script parsing and execution module and the equipment control command execution module to realize parallel control of multiple script tasks, thereby improving the standardization and flexibility of the telemetry and control station.
It enables low-cost and efficient execution of tracking and control tasks for various spacecraft against the backdrop of a continuous increase in the number and types of aerospace tracking and control stations, and improves the standardization, flexibility and scalability of aerospace tracking and control stations.
Smart Images

Figure CN120523577B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of spaceflight TT&C (Tracking, Telemetry and Command) technology, and in particular to a TT&C station automatic control device and method based on editable scripts. BACKGROUND
[0002] With the rapid development of commercial space industry, the number and types of TT&C stations in the ground TT&C network are increasing synchronously, and there are differences in the equipment configuration of each station, which puts forward higher requirements on the automatic execution of spacecraft tracking tasks by spaceflight TT&C stations.
[0003] In the prior art, due to the inconsistency of the TT&C station monitoring system, each station lacks a unified control command interface provided to the station network control center, and it is difficult for the control center to implement standardized monitoring and management of the TT&C station network. The current automatic process of the TT&C station for executing tracking and TT&C tasks is usually fixed in the source code, and there are fewer configurable parameters, and the flexibility for adapting to different types of spacecraft tracking and TT&C tasks is poor. SUMMARY
[0004] The technical problem to be solved by the embodiments of the present application is to provide a TT&C station automatic control device and method based on editable scripts, which defines the control process of the TT&C station through an editable script file, and calls different execution modules using a script server, so as to effectively improve the standardization, flexibility and scalability of the spaceflight TT&C station, and ensure that the spaceflight TT&C network can flexibly and efficiently execute tracking and TT&C tasks of various spacecraft at low cost under the background of continuous growth of the number and types of spaceflight TT&C stations.
[0005] To solve the above technical problems, the present application provides a TT&C station automatic control device based on editable scripts, comprising,
[0006] At least one script file for defining the tracking and TT&C task process of the TT&C station in the form of editable text;
[0007] A script analysis and execution module for analyzing the script file and mapping to internal functions for calling;
[0008] At least one device control command execution module for controlling the tracking and TT&C equipment in the TT&C station;
[0009] A script server for calling the script analysis and execution module and the device control command execution module to perform parallel control on the TT&C station according to a preset execution mode.
[0010] In a feasible implementation manner, the script file is determined according to basic syntax and basic commands, and the basic syntax includes statement configuration rules, variable definition rules, condition judgment syntax and loop control syntax.
[0011] The basic commands include TT&C station control commands and device control commands.
[0012] In a feasible implementation, the sentence configuration rule includes a command start symbol, a command name, parameters, and a command end symbol, the command name is separated from the parameters by a setting symbol.
[0013] In a feasible implementation, the TT&C station control commands include a command for acquiring a current task identity, a command for macro reading, a command for checking a device state, a command for macro execution, and a command for updating a task state.
[0014] In a feasible implementation, the device control commands include a command for sending a track, a command for sending a plan, a command for data sending control, a command for data storage control, a command for output control, a command for starting antenna tracking, and a command for ending antenna tracking.
[0015] In a feasible implementation, the script analysis and execution module includes,
[0016] a script execution unit that reads the script file through a script loading function, stores a single instruction object obtained by analysis into an instruction queue;
[0017] a single instruction execution unit that dynamically calls a corresponding internal function according to the single instruction object in the instruction queue based on a single instruction execution function;
[0018] an instruction block execution unit that batch executes instruction blocks in the instruction queue through an instruction block execution function;
[0019] a conditional judgment execution unit that acquires variable values from a variable queue to judge an execution direction of the instruction block through a conditional judgment execution function.
[0020] In a feasible implementation, each type of the TT&C device in the TT&C station is provided with a corresponding device control command execution module;
[0021] The device control command execution module includes,
[0022] a device parameter management unit that encapsulates state parameters and communication protocol parameters of the TT&C device through a structure or a class;
[0023] a device control command storage unit that is used to store parameter control commands and general format control commands of the TT&C device;
[0024] a script instruction execution unit that performs instruction mapping, parameter conversion, and asynchronous execution through a script instruction execution function.
[0025] In a feasible implementation, at least one device control command configuration file is further included for storing basic configuration information of control commands of the TT&C device.
[0026] The file format of the device control command configuration file is one of XML format or Json format.
[0027] In a feasible implementation, the preset execution mode is one of a first running mode or a second running mode.
[0028] The first running mode is loaded according to the start and end time of the TT&C task of the TT&C station.
[0029] The second running mode is to receive and execute externally incoming control commands.
[0030] Correspondingly, the application further provides a TT&C station automatic control method based on an editable script, comprising,
[0031] Defining a TT&C task flow of the TT&C station in the form of editable text;
[0032] Loading a device control command execution module corresponding to each TT&C device;
[0033] The script server controls the TT&C station in a multi-script task parallel mode by calling a script analysis execution module and the device control command execution module in a preset execution mode.
[0034] The application has the following beneficial effects:
[0035] The standardization, flexibility and scalability of the TT&C station can be effectively improved, and various spacecraft tracking and TT&C tasks can be flexibly and efficiently executed at a low cost.
[0036] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the application. BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 FIG. 1 is a schematic diagram of a TT&C station automatic control device of the application;
[0038] Figure 2 FIG. 4 is a schematic diagram of a script analysis execution module of the application;
[0039] Figure 3 FIG. 5 is a schematic diagram of a device control command execution module of the application;
[0040] Figure 4 FIG. 6 is a running flowchart of a TT&C station automatic control device of the application;
[0041] Figure 5 A flow chart of steps of a method for automatic control of a TT&C station according to the present application;
[0042] Figure 6 An example diagram of a script file according to the present application;
[0043] Figure 7 An example diagram of a device control command configuration file according to the present application;
[0044] Figure 8 A flow chart of execution of an instruction block according to the present application. DETAILED DESCRIPTION
[0045] In order to make the above objectives, features and advantages of the present application more obvious and comprehensible, specific embodiments of the present application will be described in detail below with reference to the accompanying drawings. In the following description, a large number of specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be implemented in many different ways other than those described herein, and one of ordinary skill in the art can make similar improvements without departing from the spirit of the present application, and therefore the present application is not limited to the specific embodiments disclosed below.
[0046] It should be noted that when an element is referred to as being "fixed" to another element, it can be directly on the other element or there can be an intervening element. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements can be present. The terms "vertical", "horizontal", "left", "right", and the like as used herein are for purposes of illustration only.
[0047] 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 belongs. The terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0048] An automatic control device for a TT&C station based on an editable script, referring to Figure 1 , comprising,
[0049] at least one script file 10 for defining a TT&C task flow of the TT&C station in an editable text form;
[0050] a script analysis and execution module 20 for analyzing the script file 10 and mapping to internal functions for calling;
[0051] at least one device control command configuration file 50 for storing basic configuration information of control commands of the TT&C device;
[0052] The script server 30 controls the TT&C station in a preset execution mode by calling the script analysis execution module 20 and the device control command execution module 40 to perform multiple script tasks in parallel.
[0053] Specifically, the application provides a TT&C station automatic control device based on an editable script, wherein the script server 30 is a core control module, creates a script running environment, reads a script file 10, creates and schedules a script execution task, and realizes a multiple script task parallel function, which can effectively improve the standardization, flexibility and scalability of a space TT&C station, and ensure that the space TT&C network can flexibly and efficiently perform tracking and control tasks of various spacecraft at a low cost under the background of continuous growth of the number and types of space TT&C stations.
[0054] In a feasible implementation manner, the script file 10 is written according to a basic syntax and a basic command, the basic syntax includes a statement configuration rule, a variable definition rule, a condition judgment syntax and a loop control syntax;
[0055] The basic command includes a TT&C station control command and a device control command;
[0056] The statement configuration rule includes a command start symbol, a command name, a parameter and a command end symbol, the command name and the parameter and adjacent parameters are separated by a set symbol.
[0057] Specifically, the statement basic format is as follows:
[0058] @command [parameter1] [parameter2][parameter3]…;
[0059] Each command is composed of a command start symbol (which can use '@'), a command, a parameter, and a command end symbol (which can use ';'). Each parameter does not need to be wrapped with '[]', the command and the parameter and the adjacent parameters are separated by a special symbol (recommended to use space), and the command start symbol and the command and the parameter and the command end symbol do not need to be separated. For example:
[0060] @COPY. / TLE1 / SAT1.TLE. / TLE2 / SAT1.TLE;
[0061] The variable definition rule: the variable used in the script needs to be defined and initialized, and the type of the variable mainly includes five types of integer (INT), floating point (FLOAT), Boolean (BOOL), string (STRIGN) and time (TIME).
[0062] Note: used to explain the function and effect of the script statement, starting with a special character (such as / / ), until the end of the line;
[0063] Conditional judgment syntax: Conditional judgment statements are used to execute different code blocks according to different conditions, which are important means to control the task flow. Single conditional judgment, two mutually exclusive conditional judgments, and multi-condition branch judgment are supported. The basic syntax can be as follows:
[0064] @IF [condition1] ELSEIF [condition2] ELSE [condition3].
[0065] IF is mandatory, ELSEIF and ELSE are optional, and are added according to the number of conditions to be judged.
[0066] Loop control statement: The loop control of the facility uses conditional loop, and the basic statement is WHILE statement, which can be as follows:
[0067] @WHILEBGAIN [condition];
[0068] @loop body statement;
[0069] @WHILEEND;
[0070] In a feasible implementation manner, the control commands of the measurement and control station include commands for obtaining the current task identifier, commands for macro reading, commands for checking the device state, commands for macro execution, and commands for updating the task state.
[0071] Specifically, the control commands of the measurement and control station can realize some local general functions of the facility, such as GET_ACTIVE_TASK_ID statement (obtaining the current task identifier), MACRO_READ (macro reading), CHECK_LINK_DEV statement (checking the device state), MACRO_EXE statement (macro execution), UPDATE_ACTIVE_TASK_STA statement (updating the task state), etc.
[0072] In a feasible implementation manner, the device control commands include commands for sending tracks, commands for sending plans, commands for data sending control, commands for data storage control, commands for output control, commands for starting antenna tracking, and commands for ending antenna tracking.
[0073] Specifically, the device control commands are used to realize the control of the device, and each device has several device control commands corresponding thereto. The basic configuration information of all device control commands is stored in the device control command configuration file 50.
[0074] Basic format of device parameter setting command:
[0075] DEV_PARAM_CTRL [device identification] [device command ID] [parameter name1, parameter name2, parameter name3, …] [parameter value1, parameter value2, parameter value3, …];
[0076] In addition to the most basic device parameter setting command, the device control command also has SEND_ORBIT_DEV (orbit sending), SEND_PLAN (sending plan), DEV_SEND_CTRL (data sending control), DEV_SAVE_CTRL (data saving control), DEV_RF_ON (output control), ACU_TASK_START (antenna tracking start), ACU_TASK_STOP (antenna tracking end), etc.
[0077] Referring to Figure 6 is a schematic diagram of the script file 10 of the present application, and the script file 10 can be written in a text file, an XML file, etc. Each command of the script file 10 should correspond to a line of script, and each line of script ends with a special character such as ‘;’. The scope of a variable is the entire code of the file, and there should be no name conflict between variables; the script file 10 is divided into two main areas: a main function definition area and a general function definition area, and each script file 10 contains and only contains one main function, and can contain no or multiple general functions.
[0078] In a feasible implementation manner, referring to Figure 2 , the script analysis and execution module 20 includes,
[0079] The script execution unit 201 reads the script file 10 through a script loading function, stores a single instruction object obtained by analysis into an instruction queue;
[0080] The single instruction execution unit 202 dynamically calls a corresponding internal function according to a single instruction object in the instruction queue based on a single instruction execution function;
[0081] The instruction block execution unit 203 batch executes instruction blocks in the instruction queue through an instruction block execution function;
[0082] The conditional judgment execution unit 204 obtains variable values from a variable queue to judge the execution direction of an instruction block through a conditional judgment execution function.
[0083] Specifically, the script analysis and execution module 20 is implemented in a class library manner, and can be written in a high-level language such as C, C# or Java, and the module can be called by the script server 30, and is used to analyze a script program and realize mapping calling between the script program and an internal function.
[0084] Further, the script analysis and execution module 20 includes the following six main parts:
[0085] Variable queue: use dictionary or thread-safe set to store variables.
[0086] Instruction queue: use queue structure to save read script instructions.
[0087] Script loading function: read script file 10, parse into single instruction object, fill queue.
[0088] Single instruction execution function: call corresponding internal function according to instruction.
[0089] Instruction block execution function: batch execute instructions in instruction queue, mainly used for execution function, judgment statement and loop statement.
[0090] Conditional judgment execution function: parse conditions to determine which instruction block to jump to.
[0091] Among them, the variable queue uses thread-safe dictionary, queue and other ways to store dynamic variables. In the management of variable life cycle, it provides variable registration access interface and variable value setting and getting interface, and supports type conversion.
[0092] Instructions are stored in instruction queue, which can be implemented using list, dictionary and other ways. Struct, class and other structured data types are defined for instructions, including instruction type, function name, parameter, condition expression and other attributes.
[0093] When loading scripts, the monitoring software can parse script file 10 and add instructions one by one to the instruction queue.
[0094] Instruction execution mechanism: the execution of instructions can be realized by single instruction execution function, instruction block (multiple instructions) execution function, conditional instruction execution function and loop instruction execution function. Among them, single instruction execution function is the basis, conditional instruction execution function is used to judge and execute conditional instructions with IF, ELSEIF, loop instruction execution function is used to judge and execute WHILE loop statements, and instruction block execution function is the comprehensive use of single instruction, conditional instruction and loop instruction functions.
[0095] The flow of instruction block execution function is shown in Figure 8 When the flow starts, first check if it is the end of the instruction block. If yes: directly jump to the end of the flow (end). If no: continue execution, read an instruction.
[0096] For the read instruction, it is divided into 3 categories:
[0097] 1. Is it a control instruction? If yes: go to the "control instruction" branch. If no: continue to judge whether it is a judgment statement.
[0098] 2. If it is a judgment statement, go to the "judgment logic" process. If not, continue to determine whether it is a loop statement.
[0099] 3. If it is a loop statement, go to the "loop logic" process to determine whether to repeat the execution of a piece of code. If not, execute the statement directly and return to "whether to end" to continue the loop.
[0100] In the judgment statement branch, the code block list corresponding to the judgment statement is extracted, and it is determined whether the end of the judgment statement instruction block is reached. If so, the current judgment logic is skipped directly using the instruction block statement index. If not, the next instruction block is read.
[0101] It is determined whether the next statement is IF / ELSEIF or ELSE. If it is IF / ELSEIF, it is checked whether the judgment condition is established. If so, the instruction block (code logic in the if) is executed. If not, it is continued to be determined. If it is ELSE, the instruction block is executed directly.
[0102] In the loop statement branch, the instruction block (not including the loop condition statement) corresponding to the loop statement is read. For example, in while (condition) { code to be looped}, the "code to be looped" is the instruction block.
[0103] It is determined whether the loop condition is established. If so, the loop instruction block is executed, and after execution, the loop statement instruction block is skipped using the instruction block statement index. If not, the loop is exited and execution is continued.
[0104] In a feasible implementation, each type of measurement and control device in the measurement and control station is provided with a device control command execution module 40 corresponding to it;
[0105] Referring to Figure 3 , the device control command execution module 40 includes,
[0106] The device parameter management unit 401 encapsulates the state parameters and communication protocol parameters of the measurement and control device through a structure or a class.
[0107] The device control command storage unit 402 is used to store the parameter control commands and general format control commands of the measurement and control device.
[0108] The script instruction execution unit 403 performs instruction mapping, parameter conversion, and asynchronous execution through a script instruction execution function.
[0109] Specifically, the device control command execution module 40 is implemented in a class library manner and can be written in a high-level language such as C, C# or Java. The module can be called by the script server 30 and used to complete specific control of different types of devices. Each device type corresponds to a device control command execution module 40.
[0110] The device parameter management unit 401 encapsulates the state parameters and communication protocol parameters of the device through a structure or a class. The parameters include a device ID, a protocol version number, a communication timeout threshold and the like. For different device types (such as an antenna servo system and a radio frequency front end), the parameter differential configuration can be achieved through inheritance of a base class.
[0111] The device control command function list is classified into two categories according to the control commands of the devices as control objects. One is a device parameter control command. The format of this type of command is highly related to the monitoring protocol of each device. The other is a general format control command. The general format control command mainly includes commands of the same format for each device type, such as a sending track, a sending plan, data sending control, data storage control, output control, antenna tracking start and antenna tracking end.
[0112] The device control command is stored in a queue manner. A structured data type is defined for the control command in a structure or a class manner. The data type includes basic attributes such as an instruction ID, a command type, a function name and parameters.
[0113] The script instruction execution function implements the association between the script instruction and the device control command. The function can implement the following functions:
[0114] Instruction mapping: the corresponding device control function is found according to the received instruction ID;
[0115] Parameter conversion: the data type mapping between the script language and the high-level programming language is automatically processed, including special types (such as conversion of a space vehicle time code from a DateTime to a UTC millisecond stamp).
[0116] Asynchronous execution: the device control command can be executed in an asynchronous manner, and timeout interruption is supported.
[0117] In a feasible implementation manner, the device control command configuration file 50 for storing the basic configuration information of the control command of the TT&C device is further included.
[0118] The file format of the device control command configuration file 50 is one of an XML format and a Json format.
[0119] Specifically, the control commands for the monitoring and control devices, each device has several device control commands corresponding to it, and the basic configuration information of all device control commands is stored in the device control command configuration file 50. The device control command configuration file 50 can adopt standard formats such as XML and Json, and the basic content of each control command in the file includes the ID, name and parameter list of the command. The device control command configuration file 50 is shown in the following table: Figure 7 .
[0120] In one possible implementation, the preset execution mode is one of the first running mode or the second running mode;
[0121] The first running mode is loaded according to the start and end time of the monitoring and control task of the monitoring and control station;
[0122] The second running mode is to receive and execute the externally transmitted control command.
[0123] Specifically, after the script server 30 is started, the server configuration file is first read, the script running environment is created, the script task manager is created, and the default initial script is loaded.
[0124] Further, the server loads the configuration file when starting, reads and parses the basic configuration parameters required for server operation, including communication interface configuration, monitoring and control device configuration, script storage path, parallel task upper limit, security policy, etc.
[0125] Script running environment construction: The control script does not need to be compiled, and after the server is started, the script parsing and execution module 20 and the device control command execution module 40 corresponding to each monitoring and control device are loaded, and the running environment for script interpretation and execution is created. The creation of the script running environment mainly includes the following contents:
[0126] Script parsing and execution module 20 and device control command execution module 40: automatically load the script parsing and execution module 20 and the device control command execution module 40 required for script parsing and execution;
[0127] Monitoring and control task timer: create a monitoring and control task timer, and automatically load and execute the monitoring and control task automation control script according to the start and end time of the monitoring and control task;
[0128] Server control command interface: create a network-based server control command interface, which allows script control commands to be sent to the server through remote control commands. For status query type commands, multiple users are allowed to send commands at the same time, and for control type commands, only one user is allowed to send commands at the same time.
[0129] Further, the script is executed in two modes, one is to automatically load and run according to the tracking start and end time of the measurement and control task, and the other is to receive and execute the external incoming control command through the server external command interface.
[0130] After the script interpretation module is started, the initial script file 10 is loaded, and the measurement and control task timer is created.
[0131] The loading of the script file 10 is through the way of specifying the file name, and the script file 10 is placed in the specified folder. The path of the specified folder can be configured through the server configuration file.
[0132] The script server 30 can start multiple Task instances at the same time, each instance runs in an independent thread or task, and a mutex, a semaphore or the like is used to control the maximum number of concurrent to avoid resource contention. A timeout threshold (such as 3000 ms) is set for each script task, and after the timeout, the process is automatically terminated and an exception handling script (such as retry or log alarm) is triggered.
[0133] Referring to Figure 4 is the device running process of the present application. First, the script server 30 is started, the configuration file of the server is loaded, the basic parameters are set, the device control command configuration file 50 and the device control command execution module 40 are loaded, then the task timer is created, it is judged whether the measurement and control task exceeds the set time threshold of the timer, if yes, the task is ended, if not, the task execution script is loaded and parsed, and after completion, the task is ended.
[0134] A measurement and control station automation control method based on editable scripts, referring to Figure 5 , comprising,
[0135] Step S100, defining the measurement and control task flow of the measurement and control station in the form of editable text;
[0136] Step S200, loading the device control command execution module 40 corresponding to each measurement and control device;
[0137] Step S300, the script server 30 calls the script interpretation and execution module 20 and the device control command execution module 40 to control the measurement and control station in multiple script tasks in parallel according to the preset execution mode.
[0138] Specifically, the script file 10 needs to be written in advance according to the design method, wherein each command is composed of four parts: command start symbol '@', command identifier, parameter, and command end symbol ';'. The command and the parameter, and the parameter are separated by spaces, and the command start symbol and the command, and the parameter and the command end symbol do not need to be separated. Unless otherwise stated, the parameter can be a specific value or a variable. Referring to Figure 1The device can include multiple script files 10, such as control script a, control script b, and control script n. The device also includes multiple types of device control command execution modules 40 and device control command configuration files 50, such as A-type device control command execution module 40 and A-type device control command configuration file 50, B-type device control command execution module 40 and B-type device control command configuration file 50, and N-type device control command execution module 40 and N-type device control command configuration file 50.
[0139] Among them, the general statement includes: (a) variable definition and assignment statement:
[0140] The variables used in the script need to be defined and initialized, and the types of variables mainly include integer (INT), floating point (FLOAT), Boolean (BOOL), string (STRIGN), and time (TIME). The variable definition statement format is:
[0141] @data type [variable name];
[0142] In the script, '=' is used to assign values to variables, and the statement format is:
[0143] @variable name = value;
[0144] (b) Operator:
[0145] An operator is a symbol that tells the script execution parsing module to perform a specific mathematical or logical operation. The script supports three types of operators: arithmetic operators, relational operators, and logical operators. Arithmetic operators include '+', '-', '×', and ' / '. Relational operators support '&' and '|'. Logical operators support '>', '<', '==', '<=', and '>='. Logical relationships allow the use of '&&' or '||' for simultaneous operation.
[0146] (c) Conditional statement:
[0147] The conditional statement is used to execute different code blocks based on different conditions, and supports nesting with loop control statements or conditional statements. The basic syntax is as follows:
[0148] @IF_BEGIN [condition1];
[0149] @ ELSEIF [condition2];
[0150] @ELSE [condition3];
[0151] @IF_END;
[0152] IF_BEGIN and IF_END are mandatory, ELSEIF and ELSE are optional, add according to the number of conditions to be judged.
[0153] (d) Loop control statements:
[0154] Loop control uses conditional loops, the basic statement is WHILE statement, supports nesting with loop control statements or conditional judgment statements, format as follows:
[0155] @WHILE_BGAIN [condition];
[0156] @loop body statements;
[0157] @WHILE_END;
[0158] (e) File copy statement:
[0159] Used to copy files from the source file path to the destination file path, [source file path] [destination file path] are input parameters, both are strings or string type variables.
[0160] @COPY [source file path] [destination file path];
[0161] (f) Wait statement:
[0162] Used to implement the necessary time interval between control commands, input parameter [time] is an integer value or an integer variable, unit is millisecond, command format:
[0163] @SLEEP [time];
[0164] The script file 10 also includes station control commands and device control commands. The station control command refers to the control command implemented in the server for the object of the station, including the following statements:
[0165] (a) Get current task identification statement: used to get the identification of the task that is about to be or is being executed in the active state, the task identification variable is used as the output variable, the data type is string.
[0166] @GET_ACTIVE_TASK_ID [task identification variable];
[0167] (b) Get current satellite identification statement: used to get the identification of the satellite that is about to be or is being tracked, the satellite identification variable is used as the output variable, the data type is string.
[0168] @GET_ACTIVE_SATE_ID [satellite identification variable];
[0169] (c) Get the current task state statement: used to get the specific state of the task to be executed or being executed, the obtained state is stored in the state variable, and the data type is string.
[0170] @GET_ACTIVE_TASK_STA [state variable];
[0171] (d) Macro read statement: used to read the macro parameter content of the task from the database, [task identification] is the input parameter, the data type is string or string type variable, [result variable] is the output parameter, and whether the macro reading is successful is stored, the data type is integer, 0 represents failure, and 1 represents success.
[0172] @MACRO_READ [task identification] [result variable];
[0173] (e) Check device state: check whether the device state is normal, and store the check result in the result variable.
[0174] @CHECK_LINK_DEV [result variable];
[0175] (f) Macro parameter modification: modify the macro parameter according to the parameter carried by the task. Whether the modification is successful is stored in the result variable, and the command format is as follows:
[0176] @MACRO_PARAM_MOD [task identification] [result variable];
[0177] (g) Macro execution: the command is used to issue task execution parameters to the station equipment. [task identification] is the input parameter, the data type is string or string type variable, [result variable] is the output parameter, and whether the macro execution is successful is stored, the data type is integer, 0 represents failure, and 1 represents success, and the command format is:
[0178] @MACRO_EXE [task identification] [result variable];
[0179] (h) Get task parameter control object: according to the task information, get the target and control type required for the task parameter control, according to the task information, get the target and control type required for the task parameter control, [task identification] is the input parameter, the data type is string or string type variable, [satellite identification variable] is the output parameter, the data type is string type, [operation type variable] is the output parameter, the data type is integer, 0 represents not control, 1 represents start control, 2 represents end control, [result variable] is the output parameter, and whether the control is successful is stored, the data type is integer, 0 represents failure, and 1 represents success, and the command format is:
[0180] @GET_TASK_PARAM_CTRL_TARGET [task id] [satellite id variable] [operation type variable] [result variable];
[0181] (i) Update the current task state: [state1] represents the updated task state, input parameter, data type is string type, [state2] is the just ended task state, input parameter, data type is string type, [control count variable] and [control result variable] are input parameters, which must be variables, and the data types are both integers, after the command is executed, the values of the two variables are assigned to the initial value 0, [control result] is an input parameter, which represents whether the control of the just ended task is successful, the data type is integer, 0 represents failure, and 1 represents success, the command format is:
[0182] @UPDATE_ACTIVE_TASK_STA [state1] [control count variable] [control result variable] [state2] [control result];
[0183] Device control commands are control commands for measurement and control devices, and each device has a plurality of device control commands corresponding thereto. The basic configuration information of all device control commands is stored in the device control command configuration file 50. The device control command includes:
[0184] (a) Parameter setting command: used for setting one or more parameters of the device, all parameters are input parameters, and the data format is string:
[0185] @DEV_PARAM_CTRL [device id] [device command id] [parameter name1, parameter name2, parameter name3, …] [parameter value1, parameter value2, parameter value3, …];
[0186] (b) Send orbit: send TLE, instantaneous root number, and orbit information of guiding data to the device, [device id] [task id] are input parameters, data type is string, [result variable] is output parameter, which stores whether the control is successful, data type is integer, 0 represents failure, and 1 represents success, the command format is:
[0187] @ SEND_ORBIT_DEV [device id] [task id] [result variable];
[0188] (c) Send plan: send task plan information to the device, [device id] [task id] are input parameters, data type is string, [result variable] is output parameter, which stores whether the control is successful, data type is integer, 0 represents failure, and 1 represents success, the command format is:
[0189] @SEND_PLAN [device id] [task id] [result variable];
[0190] (d) Data sending control: send data sending control command to device, [device identification] [task identification] as input parameter, data type as string, [control type] as input parameter, data format as integer, 0 means off, 1 means on, [result variable] as output parameter, store whether the control is successful, data type as integer, 0 means failure, 1 means success, command format:
[0191] @ DEV_SEND_CTRL [device identification] [task identification] [control type] [result variable];
[0192] (e) Data saving control: send data saving control command to device, [device identification] [task identification] as input parameter, data type as string, [control type] as input parameter, data format as integer, 0 means off, 1 means on, [result variable] as output parameter, store whether the control is successful, data type as integer, 0 means failure, 1 means success, command format:
[0193] @DEV_SAVE_CTRL [device identification] [task identification] [control type] [result variable];
[0194] (f) Output control: send signal output control command to device, [device identification] [task identification] as input parameter, data type as string, [control type] as input parameter, data format as integer, 0 means off, 1 means on, [result variable] as output parameter, store whether the control is successful, data type as integer, 0 means failure, 1 means success, command format:
[0195] @ DEV_RF_ON [device identification] [task identification] [control type] [result variable];
[0196] variable];
[0197] (g) Antenna tracking start: send tracking start command to antenna control unit, [task identification] as input parameter, data type as string, [result variable] as output parameter, store whether the control is successful, data type as integer, 0 means failure, 1 means success, command format:
[0198] @ACU_TASK_START [task identification] [result variable];
[0199] (h) Antenna tracking end: send a tracking end command to the antenna control unit, [device identification] [task identification] as input parameters, data type is string, [result variable] as output parameter, store control success or not, data type is integer, 0 indicates failure, 1 indicates success, command format:
[0200] @ACU_TASK_STOP [task identification] [result variable];
[0201] The script file 10 of the present application is divided into two main areas: the main function definition area, the general function definition area, each script file 10 contains and only contains a main function, can not contain or contain multiple general functions.
[0202] The script analysis and execution module 20 can be written in C# language and generate DLL dynamic link library. For example, the core class structure of the script analysis and execution module 20 is as follows:
[0203] public class ScriptEngine
[0204] {
[0205] private ConcurrentDictionary<string, object>_variablePool; / / Variable queue
[0206] private List <scriptcommand>_instructionQueue; / / Instruction queue
[0207] public void LoadScript(string path) {...} / / Script loading function
[0208] public void ExecuteSingleCommand(ScriptCommand cmd) {...} / / Execute a single command
[0209] public void ExecuteCommandBlock() {...} / / Execute the command block
[0210] public bool EvaluateCondition(string expr) {...} / / Conditional judgment is executed
[0211] }
[0212] The variable queue is implemented using a thread-safe dictionary to store dynamic variables.
[0213] private ConcurrentDictionary<string, object> _variablePool = new();
[0214] Variable lifecycle management: Register variables using the AddVariable(string name, object value) method and SetVariable... <t>(string name) generic method sets value, GetVariable <t>(string name) generic method to get value;
[0215] Type conversion mechanism built-in Convert.ChangeType handles numeric / string conversion;
[0216] Build instruction queue need to define a serializable instruction structure:
[0217] public struct ScriptCommand {
[0218] public CommandType Type; / / instruction type enumeration
[0219] public string FunctionName; / / function name
[0220] public object[] Parameters; / / parameter array
[0221] public string ConditionExpr; / / condition expression
[0222] }
[0223] Script loading function through regular parsing script file 10, generate instruction object queue:
[0224] public void LoadScript(string path) {
[0225] var lines = File.ReadAllLines(path);
[0226] foreach(var line in lines.Where(l =>!l.StartsWith(" / / "))) {
[0227] var cmd = ParseCommand(line); / / instruction parser
[0228] _instructionQueue.Enqueue(cmd);
[0229] }
[0230] }
[0231] Single instruction instruction execution function (ExecuteDSLine) can dynamically load the target DLL function and call:
[0232] public void ExecuteDSLine (ScriptCommand cmd) {
[0233] IntPtr dll = LoadLibrary("CommandLib.dll");
[0234] IntPtr func = GetProcAddress(dll, cmd.FunctionName);
[0235] / / Construct the parameter list (including variable substitution)
[0236] object[] parameters = cmd.Parameters.Select(p =>
[0237] p is VariableRef vr ? _variablePool[vr.Name] : p
[0238] ).ToArray();
[0239] / / Dynamic invocation via delegate
[0240] var delegateType = CreateDelegateType(parameters.Length);
[0241] Delegate funcDelegate=Marshal.GetDelegateForFunctionPointer(func,delegateType);
[0242] funcDelegate.DynamicInvoke(parameters);
[0243] FreeLibrary(dll); / / Release DLL resources
[0244] }
[0245] The instruction block execution function (ExecDSSection) enables the execution of multiple instructions with conditional jumps, supporting nested execution of conditional statements and loop statements. Figure 8 This describes the execution flow of the instruction block.
[0246] This code parses conditional statements containing IF and ELSEIF, retrieves variable values from the variable queue based on the conditional expression, performs logical judgments, and executes the corresponding instruction block when the result meets the execution condition. Key code examples are shown below:
[0247] foreach (List <string>x in codeListIn)
[0248] {
[0249] List <string>codeStrList = new List <string>();
[0250] for (int i = 1; i<x.Count; i++)
[0251] {codeStrList.Add(x[i]);}
[0252] if (x[0].Contains("IF_BEGIN") || x[0].Contains("ELSEIF"))
[0253] {
[0254] List<List <string>ifCode = new List<List <string>>();
[0255] PickJudgeCode(x[0], ref ifCode);
[0256] if (JudgeDS(ifCode)) / / Conditional judgment
[0257] {
[0258] result = ExecDSSection(codeStrList); / / Execute instruction block
[0259] return result;
[0260] }
[0261] }
[0262] else if (x[0].Contains("ELSE"))
[0263] {ExecDSSection(codeStrList);} / / Execute instruction block
[0264] }
[0265] During the execution of a loop statement, the loop statement with WHILE is parsed, and the variable values are retrieved from the variable queue based on the loop condition expression for logical judgment. If the execution condition is met, the instruction block within the loop body is executed. Key code examples are as follows:
[0266] List <List <string>whileCode = new List<List <string>>();
[0267] PickJudgeCode(codeListIn[0], ref whileCode);
[0268] while (JudgeDS(whileCode)) / / Conditional judgment
[0269] {
[0270] List <string>tempStrList = new List <string>();
[0271] for (int i = 1; i <codeListIn.Count; i++)
[0272] {
[0273] tempStrList.Add(codeListIn[i]);
[0274] }
[0275] ExecDSSection(tempStrList); / / Execute instruction block
[0276] }
[0277] Furthermore, the device control command execution module 40 is a DLL dynamic link library architecture implemented in C#, and its specific implementation includes the following three parts:
[0278] 1. Device Parameter Management Unit 401: This unit encapsulates device status parameters and communication protocol parameters through structures or classes. For example, the DeviceParameters structure is defined to include fields such as device ID, protocol version number, and communication timeout threshold, and parameter extensibility is achieved through attribute-based design. Differentiated parameter configurations are implemented for different device types (such as antenna servo systems, RF front-ends, etc.) by inheriting from a base class.
[0279] 2. Equipment control command function list: Control commands for equipment are divided into two main categories. One is equipment parameter control commands, the format of which is highly related to the monitoring protocol of each device. The other is general format control commands, which mainly include commands with the same format for each device type, such as sending track, sending plan, data sending control, data storage control, output control, antenna tracking start, and antenna tracking end.
[0280] The device control commands are stored in a queue. The control command structure is defined as follows:
[0281] public struct DeviceCommand
[0282] {
[0283] public string DSComandID; / / Command ID
[0284] public CommandType Type; / / Command type
[0285] public string FunctionName; / / Function name
[0286] public object[] Parameters; / / parameter array
[0287] }
[0288] 3. Script instruction execution function, which implements the association between script instructions and device control commands. This function can implement the following functions:
[0289] Instruction mapping: find the corresponding device control function according to the received instruction ID.
[0290] Parameter conversion: automatically handle data type mapping between script language and C#, including special types (such as DateTime to UTC millisecond timestamp of spacecraft time code).
[0291] Asynchronous executor: encapsulate blocking DLL calls through Task.Run, supporting timeout interruption function.
[0292] Further write the device control command configuration file 50, which is the control command of the TT&C device. Each device has several device control commands corresponding to it, and the basic configuration information of all device control commands is stored in the device control command configuration file 50. The device control command configuration file 50 is in XML format, and the basic content of each control command in the file includes the ID, name and parameter list of the command. The device control command configuration file 50 is shown in Figure 5.
[0293] Finally, implement the script server 30, which is the core control module, developed in C# language, running on Windows system, loading server configuration file, creating script running environment, reading script file 10, creating and scheduling script execution tasks, and realizing multi-script task parallel function. Its function architecture and implementation are as follows:
[0294] 1. Server configuration loading and initialization: when the server starts, load the XML format configuration file, read and parse the basic configuration parameters required for server operation, including communication interface configuration, TT&C device configuration, script storage path, parallel task upper limit, security policy, etc.
[0295] 2. Script running environment construction: control script does not need to be compiled, after the server starts, load the script parsing and execution module 20 and the device control command execution module 40 corresponding to each TT&C device, create a script interpretation execution running environment. Creating a script running environment mainly includes the following contents:
[0296] The script analysis and execution module 20 and the device control command execution module 40: the script analysis and execution module 20 and the device control command execution module 40 required by the script analysis and execution module 20 are automatically loaded through a reflection mechanism;
[0297] The measurement and control task timer: a measurement and control task timer is created, and the measurement and control task automation control script is automatically loaded and executed according to the start and end time of the measurement and control task;
[0298] The server control command interface: a server control command interface based on a UDP Socket is created, which allows sending script control commands to the server through remote control commands. For state query type commands, multiple users can send commands simultaneously, and for control type commands, only one user is allowed to send commands at the same time.
[0299] 3. Script task scheduling and parallel control: scripts are executed in two modes, one is an automatic loading and running mode according to the tracking start and end time of the measurement and control task, and the other is a running mode of receiving and executing external incoming control commands through the server external command interface.
[0300] After the script interpretation module is started, the initial script file 10 is loaded, and the measurement and control task timer is created.
[0301] The loading of the script file 10 is performed by specifying the file name, and the script file 10 is placed in a specified folder. The path of the specified folder can be configured through the server configuration file.
[0302] Multiple Task instances are started using the C# Task Parallel Library (TPL), each instance runs in an independent thread, and the maximum number of concurrent instances is controlled through a semaphore (Semaphore) to avoid resource contention.
[0303] A timeout threshold (such as 3000ms) is set for each script task, and after the timeout, the process is automatically terminated and an exception handling script (such as retry or log alarm) is triggered.
[0304] The technical features of the above-described embodiments can be combined in any manner. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described, however, as long as the combinations of the technical features do not contradict, they should be considered within the scope of the present disclosure.
[0305] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be noted that for ordinary skilled persons in the art, without departing from the concept of the present application, several modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.< / string> < / string> < / string> < / string> < / string> < / string> < / string> < / string> < / string> < / t> < / t> < / scriptcommand>
Claims
1. A test control station automation control device based on an editable script, characterized in that, The measurement and control station comprises: at least one script file for defining the measurement and control task flow of the measurement and control station in editable text form; the script file comprises a main function definition area and a general function definition area; a script analysis and execution module for analyzing the script file and mapping to internal functions for calling; at least one device control command execution module for controlling the measurement and control devices in the measurement and control station; a script server for performing parallel control on the measurement and control station according to a preset execution mode by calling the script analysis and execution module and the device control command execution module; the script analysis and execution module comprises: a script execution unit for reading the script file through a script loading function, analyzing a single instruction object, and storing the single instruction object in an instruction queue; a single instruction execution unit for dynamically calling corresponding internal functions according to the single instruction object in the instruction queue based on a single instruction execution function; an instruction block execution unit for batch executing instruction blocks in the instruction queue through an instruction block execution function; a condition judgment execution unit for obtaining variable values from a variable queue to judge the execution direction of the instruction blocks through a condition judgment execution function.
2. The automation control device of claim 1, wherein, The script file is determined according to a basic syntax and a basic command, the basic syntax comprises a statement configuration rule, a variable definition rule, a condition judgment syntax, and a loop control syntax; the basic command comprises a measurement and control station control command and a device control command.
3. The automation control device of claim 2, wherein, The statement configuration rule comprises a command start symbol, a command name, a parameter, and a command end symbol, the command name is separated from the parameter and adjacent parameters by a setting symbol.
4. The automation control device of claim 2, wherein, The measurement and control station control command comprises a command for obtaining a current task identifier, a command for macro reading, a command for checking a device state, a command for macro execution, and a command for updating a task state.
5. The automation control device of claim 2, wherein, The device control command comprises a command for sending a track, a command for sending a plan, a command for data sending control, a command for data storage control, a command for output control, a command for starting antenna tracking, and a command for ending antenna tracking.
6. The automation control device of claim 1, wherein, Each type of the measurement and control device in the measurement and control station is provided with a corresponding device control command execution module; the device control command execution module comprises: a device parameter management unit for encapsulating state parameters and communication protocol parameters of the measurement and control device through a structure or a class; a device control command storage unit for storing parameter control commands and general format control commands of the measurement and control device; a script instruction execution unit for instruction mapping, parameter conversion, and asynchronous execution through a script instruction execution function.
7. The automation control device of claim 1, wherein, The measurement and control station further comprises at least one device control command configuration file for storing basic configuration information of the control commands of the measurement and control device; the file format of the device control command configuration file is one of an XML format or a Json format.
8. The automation control device of claim 1, wherein, The preset execution mode is one of a first running mode or a second running mode; the first running mode is loaded according to the start and end time of the measurement and control task of the measurement and control station; the second running mode is for receiving and executing externally transmitted control commands.
9. A method for automatic control of a TT&C station based on an editable script, characterized in that, The automation control device of any one of claims 1-8, Comprising, Defining the measurement and control task flow of the measurement and control station in editable text form; Loading the device control command execution module corresponding to each measurement and control device; The script server controls the measurement and control station in parallel mode by calling the script analysis execution module and the device control command execution module.
Citation Information
Patent Citations
Automatic flow control method and system
CN109634253A
Embedded satellite task scheduling management method and system and electronic equipment
CN114968533A