Satellite attitude orbit control real-time semi-physical simulation method and device
Patent Information
- Application Number
- CN202611073805.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-08-21
AI Technical Summary
[0005]然而,传统仿真平台的接口设计方案一旦确定,通常难以根据不同硬件接口灵活调整,所有数据往往需按照统一格式和固定长度进行交互
(1)本发明通过建立卫星姿态轨道动力学模型并定义标准化输入输出信号端口,利用代码生成方式将模型封装为可由实时控制平台周期调用的模型运行体,实现了Simulink动力学模型与LabVIEW实时平台之间的无缝标准化集成,避免了传统手动编写DLL接口所带来的代码复杂、数据映射困难及可维护性差等问题,在保证仿真可靠性的同时显著降低了系统开发成本与集成难度。
Smart Images

Figure CN122613784A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of satellite attitude and orbit control technology, and in particular to a real-time semi-physical simulation method and device for satellite attitude and orbit control. Background Technology
[0002] With the rapid development of aerospace technology, satellite attitude and orbit control (AOR) systems are showing a trend towards higher precision and reliability. Against this backdrop, to fully verify the correctness and real-time performance of attitude and orbit control algorithms during the ground phase, traditional technologies typically employ real-time semi-physical simulation schemes. These mainly include pure digital simulation based on MATLAB / Simulink, LabVIEW co-simulation with manually written DLL interfaces, and hardware-in-the-loop simulation based on dedicated real-time simulators.
[0003] Pure digital simulation technology based on MATLAB / Simulink suffers from several drawbacks. During operation, the dynamic model and control algorithm run in the same software environment but not in real time, making it impossible to connect to real hardware devices. This results in significant discrepancies between the simulation timing and the actual flight timing, hindering effective verification of the control algorithm's real-time performance and hardware interface compatibility. Manually written DLL interfaces for LabVIEW co-simulation involve compiling the Simulink model into a dynamic link library, which is then called by LabVIEW for co-simulation. However, the interaction between the Simulink model and LabVIEW after DLL generation often requires developers to manually write extensive interface code. This leads to complex data mapping relationships, difficulties in synchronizing sampling time, and poor interface flexibility and maintainability. Changes to the model interface necessitate modification and debugging of the interface program, resulting in long system development cycles and poor scalability. While hardware-in-the-loop simulation based on dedicated real-time simulators effectively solves the problems of real-time performance and deterministic execution, dedicated simulation hardware is expensive, system construction is complex, portability is poor, and the platform is highly closed, making flexible configuration and rapid migration difficult to adapt to different satellite mission requirements.
[0004] Furthermore, in practical applications, satellite attitude and orbit control semi-physical simulation systems typically require access to various types of physical data, including sensor measurement data, actuator feedback data, and internal dynamic variables of the model. These different data types often exhibit significant differences in length, update frequency, and accuracy requirements. Specifically, critical control data is relatively small in quantity but demands high real-time performance and completeness, while auxiliary monitoring data is larger in volume but has relatively lower real-time requirements.
[0005] However, once the interface design of traditional simulation platforms is determined, it is usually difficult to flexibly adjust it according to different hardware interfaces. All data often needs to be exchanged in a uniform format and with a fixed length. When the length of the physical data packet output by the external real sensor or actuator simulator is inconsistent with the data length required by the model dynamics, the system usually needs to manually modify the model structure or rewrite the interface program, resulting in high system integration complexity, high development cost, and insufficient flexibility and engineering practicality. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a real-time semi-physical simulation method for satellite attitude and orbit control, comprising the following steps: S1: Establish a satellite attitude and orbit dynamics model, and define the input signal port and output signal port between the satellite attitude and orbit dynamics model and the external real-time control platform; S2: Generate a model running entity from the satellite attitude and orbit dynamics model that can be periodically called by the real-time control platform; S3: Load the model runtime into the real-time control platform, read the model sampling period, model input length, model output length and input / output port information, and establish the mapping relationship between external interface data, platform internal variables and the input signal port and the output signal port; S4: Adapt the external input data collected in the current cycle according to the mapping relationship to form a target input array with the same length as the model input, and write the target input array into the model running body; S5: In the deterministic real-time loop of the real-time control platform, the single-step advancement interface is called according to the model sampling period to perform state update calculations in order to obtain the model output array for the current period; S6: According to the mapping relationship, the model output array is unpacked and distributed. A portion of the output data is used for display, recording or status monitoring, and another portion of the output data is sent to an external device. The feedback data returned by the external device is received as part of the model input for the next cycle to form a closed-loop semi-physical simulation link. S7: Monitor the execution status of each cycle during operation. When an execution timeout, input anomaly, or feedback anomaly is detected, execute a preset stability handling strategy to maintain the stable operation of the satellite attitude and orbit dynamics model on the real-time control platform.
[0007] Preferably, in step S1, a satellite attitude and orbit dynamics model is established, including: Construct an attitude dynamics sub-model to characterize the satellite's attitude motion state and an orbital dynamics sub-model to characterize the satellite's orbital motion state; Based on the requirements of the semi-physical simulation, at least one of the following is introduced into the attitude dynamics sub-model, the orbital dynamics sub-model: an environmental disturbance model, a sensor model, and an actuator model, to form the satellite attitude and orbital dynamics model. Based on the data flow of the internal state variables, control variables, and measurement variables of the satellite attitude and orbit dynamics model, the input signal ports and output signal ports for interaction with the external real-time control platform are defined, and the data categories and arrangement order corresponding to each input signal port and output signal port are determined.
[0008] Preferably, in step S2, generating the model runtime includes: A consistency check is performed on the input / output port dimensions, data types, discrete sampling settings, and runtime calling methods of the satellite attitude and orbit dynamics model. Based on the periodic calling requirements of the real-time control platform, the satellite attitude and orbit dynamics model is processed by code generation and compilation linking to generate a model runtime that can be called by the real-time control platform; The model runtime encapsulates an initialization interface, an execution parameter reading interface, an input writing interface, a single-step advancement interface, and an output reading interface, so that the real-time control platform can complete model initialization, parameter reading, input writing, state update, and output reading in a preset order.
[0009] Preferably, in step S3, establishing the mapping relationship includes: The model sampling period, model input length, model output length, input signal port arrangement information, and output signal port arrangement information of the model runtime are obtained through the parameter reading interface. Based on the external interface data format and the platform's internal variable organization method, establish the positional and length correspondences between the external interface data and the input signal ports, and establish the data correspondences between the output signal ports and the display module, recording module, status monitoring module, and external devices; If the length of the i-th type of input data segment is The starting index is Then its mapping relationship in the target input array is expressed as: , in, Input array for the model, This is the input data segment of type i; If the length of the output data segment of the j-th type is The starting index is Then its extraction relationship in the model output array is expressed as: , in, For the j-th type of output data segment, Output an array for the model; Based on the arrangement order of each input signal port and output signal port and the data segment length information, index rules are generated for input data packing and output data unpacking.
[0010] Preferably, in step S4, the external input data collected in the current period is adapted, including: It collects input data from external real sensors, sensor simulators, actuator simulators, or control interface devices, and converts it into the platform's internal data format. Based on the position correspondence, length correspondence, and indexing rules, the input data is subjected to at least one of the following processing methods: truncation, zero padding, default value padding, preservation of data from the previous period, sorting, and concatenation. Wherein, when the actual length of a certain input data segment in the k-th sampling period is... The expected length is At that time, construct the adapted input data. Segment satisfies: When hour, ;when hour, ,in, To pad a vector with zeros or default values, the length is... ;when hour, When input data is missing, the hold strategy from the previous cycle is used: ; A target input array with the same length as the model input is formed, and the target input array is written into the model runtime so that the single-step advancement interface can be called in the current cycle to perform state update operations.
[0011] Preferably, in step S5, the state update operation is performed in the deterministic timing loop of the real-time control platform, including: Establish a fixed-step timed loop that matches the model sampling period, and set each loop period as one discrete model update period; At the beginning of each cycle, the target input array corresponding to the current cycle is written into the model runtime. The single-step propulsion interface is invoked to perform a state update operation, so that the satellite attitude and orbit dynamics model completes the state iteration within the current sampling period and generates the corresponding model output array. After completing the state update calculation for the current cycle, the model output array is read through the output reading interface, and the next cycle is entered to realize the continuous real-time operation of the satellite attitude and orbit dynamics model.
[0012] Preferably, in step S6, the model output array is unpacked and distributed, including: Based on the mapping relationship and indexing rules, data segments with different functions are split from the model output array; Identify at least one of the following in the data segments of the different functions: attitude angle data, angular velocity data, orbital position data, orbital velocity data, control command data, actuator drive data, and status monitoring data; Data used for human-machine display and operation analysis is sent to the display module, recording module or status monitoring module, and data used for external device driving or interaction is sent to the external device communication module; The external device communication module encapsulates the corresponding output data into a data format recognizable by the external device and sends it to the external device.
[0013] Preferably, in step S6, the feedback data returned by the external device is received as part of the model input for the next cycle: Receive feedback data from external real sensors, sensor simulators, actuator simulators, or control interface devices; The feedback data is format-converted, length-validated, and validity-determined, and then written into the corresponding data segment of the target input array for the next cycle according to the mapping relationship. Let the output of the current cycle model be External device feedback data is The input vector for the next cycle is The closed-loop input construction relation is then expressed as: , in, This is the internal mapping matrix from output to input. This is the mapping matrix from feedback data to input. This is to provide supplementary input from the external interface for the next cycle; This creates a continuous feedback path between the model output of the current cycle, the response of the external device, and the model input of the next cycle, thus forming a closed-loop semi-physical simulation link.
[0014] Preferably, in step S7, the preset stability processing strategy is executed, including: The execution time of the single-step advancement interface, the integrity of the target input array, and the validity of the feedback data are monitored within each cycle. When the execution time exceeds the model sampling period, or when input data is missing, input length is mismatched, feedback is missing or abnormal, an alarm message is output. Depending on the type of anomaly, at least one of the following actions is performed: maintain the input from the previous cycle, switch to default parameter input, pause writing to non-critical external interfaces, reduce the data refresh frequency, or terminate the current simulation, in order to maintain the stable operation of the satellite attitude and orbit dynamics model on the real-time control platform.
[0015] Based on the same concept, the present invention also provides a computer device, including a memory and one or more processors, wherein the memory stores computer code, and when the computer code is executed by the one or more processors, the one or more processors cause the one or more processors to perform the steps of a real-time semi-physical simulation method for satellite attitude and orbit control as described in any one of the embodiments.
[0016] Compared with the prior art, the beneficial effects of the present invention are: (1) This invention establishes a satellite attitude and orbit dynamics model and defines standardized input and output signal ports. It encapsulates the model into a model running body that can be periodically called by the real-time control platform by using code generation. This achieves seamless standardized integration between the Simulink dynamics model and the LabVIEW real-time platform, avoiding the problems of code complexity, data mapping difficulty and poor maintainability caused by traditional manual writing of DLL interfaces. While ensuring the reliability of simulation, it significantly reduces the system development cost and integration difficulty.
[0017] (2) This invention automatically reads the model sampling period, input and output length and port information in the real-time control platform, and establishes a mapping relationship between external interface data, platform internal variables and model ports. It can adaptively adapt external input data according to the mapping relationship, so that the physical data packet length of different signal sources and the length of model input ports are dynamically matched. There is no need to modify the model structure or rewrite the interface program due to changes in hardware interface, which greatly improves the versatility, flexibility and rapid adaptation capability of the simulation system.
[0018] (3) This invention performs state updates by calling the single-step propulsion interface according to the model sampling period in the deterministic real-time loop of the real-time control platform, and unpacks and distributes the model output data, sends control commands to external devices in real time and receives feedback data to form a closed-loop semi-physical simulation link, realizing a smooth transition from pure digital simulation to hardware-in-the-loop closed-loop verification, ensuring the high real-time performance and deterministic execution of the satellite attitude and orbit control simulation process, and effectively improving the confidence of the attitude and orbit control algorithm from ground verification to on-orbit flight.
[0019] (4) By continuously monitoring the execution status of each cycle during operation, and executing a preset stability handling strategy when execution timeout, input abnormality or feedback abnormality is detected, the present invention can respond to abnormal working conditions in the simulation process in a timely manner, prevent the overall simulation from collapsing due to a single timeout or data abnormality, ensure the long-term stable operation of the satellite attitude and orbit dynamics model on the real-time control platform, and further improve the robustness and engineering practicality of the system. Attached Figure Description
[0020] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.
[0021] Figure 1 This is a flowchart of a real-time semi-physical simulation method for satellite attitude and orbit control according to the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. Obviously, the described embodiments are only some, not all, of the embodiments described in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without creative effort are within the scope of protection of this application.
[0023] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a” and “an” used herein, and “the”, may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0024] First Embodiment Please see Figure 1 As shown, this embodiment provides a real-time semi-physical simulation method for satellite attitude and orbit control. This method enables the real-time deployment and closed-loop operation of a satellite attitude and orbit dynamics model established in the MATLAB / Simulink environment within the LabVIEW real-time control platform. It also supports data interaction with external real or simulated devices to complete real-time digital simulation or semi-physical simulation verification. The method includes the following steps: S1: Establish a satellite attitude and orbit dynamics model in the MATLAB / Simulink environment, and define the input signal port and output signal port between the satellite attitude and orbit dynamics model and the external real-time control platform. Specifically, in this embodiment, the NI VeriStand In input interface module and the NIVeriStand Out output interface module are configured in the satellite attitude and orbit dynamics model.
[0025] Preferably, in step S1, a satellite attitude and orbit dynamics model is established, including: An attitude dynamics sub-model is constructed to characterize the satellite's attitude motion state, and an orbital dynamics sub-model is constructed to characterize the satellite's orbital motion state. Specifically, in this embodiment, the attitude dynamics sub-model is used to describe the dynamic characteristics of the satellite's attitude angle, angular velocity, and other states as a function of the control torque; the orbital dynamics sub-model is used to describe the evolution of the satellite's orbital parameters, such as orbital position and orbital velocity.
[0026] Among them, the attitude dynamics sub-model satisfies the rigid body attitude dynamics relation: , in, Here is the satellite's rotational inertia matrix. It is the angular velocity vector. To control the torque, For external disturbance torque, Angular acceleration; The attitude dynamics sub-model satisfies the quaternion update relation: , in, For attitude quaternions, The quaternion kinematics are constructed from angular velocities. The time derivative of the quaternion; The orbital dynamics sub-model satisfies: , , in, The orbital position vector, For orbital velocity, For orbital acceleration, The orbital velocity vector, The gravitational constant of Earth, To control acceleration, Acceleration of environmental disturbances.
[0027] Based on the requirements of the semi-physical simulation, at least one of the following is introduced into the attitude dynamics sub-model, the orbital dynamics sub-model: an environmental disturbance model, a sensor model, and an actuator model, to form a satellite attitude and orbital dynamics model. Specifically, in this embodiment, the environmental disturbance model can be used to simulate external influences such as gravity gradient disturbances, aerodynamic disturbances, solar radiation pressure disturbances, or magnetic field disturbances; the sensor model can be used to simulate the measurement characteristics of gyroscopes, star sensors, solar sensors, or orbital measurement units; and the actuator model can be used to simulate the dynamic response characteristics of flywheels, magnetic torquers, thrusters, or servo actuators.
[0028] Based on the data flow of internal state variables, control variables, and measurement variables in the satellite attitude and orbit dynamics model, input signal ports and output signal ports for interaction with the external real-time control platform are defined, and the data categories and arrangement order corresponding to each input signal port and output signal port are determined. Specifically, in this embodiment, according to the data flow for interaction with the external real-time control platform, an NI VeriStand In input interface module is configured on the model input side, and an NIVeriStand Out output interface module is configured on the model output side to define the input signal ports and output signal ports required for model operation. The input ports can be used to receive external physical sensor data, control parameters, or closed-loop feedback data, and the output ports can be used to output control commands, attitude and orbit state variables, and / or measurement data.
[0029] S2: Generate a model runtime that can be periodically called by the real-time control platform from the satellite attitude and orbit dynamics model. Specifically, in this embodiment, the model runtime is a dynamic link library (DLL) file. Code generation settings are performed on the configured satellite attitude and orbit dynamics model, the system target file is set to NIVeristand.tlc, and the target language is set to C language to generate a dynamic link library (DLL) file that can be called by the LabVIEW real-time control platform.
[0030] Preferably, in step S2, generating the model runtime includes: A consistency check is performed on the input / output port dimensions, data types, discrete sampling settings, and runtime calling methods of the satellite attitude and orbit dynamics model.
[0031] Based on the periodic calling requirements of the real-time control platform, code generation and compilation linking are performed on the satellite attitude and orbit dynamics model to generate a model runtime that can be called by the real-time control platform. Specifically, in this embodiment, the system target file of the satellite attitude and orbit dynamics model is set to NIVeristand.tlc so that the compiled model has a runtime interface compatible with NI VeriStand.
[0032] Discretize the satellite attitude and orbit dynamics model as follows: , , in, Let k be the state vector of the kth sampling period. This is the state vector for the (k+1)th sampling period. Let be the input vector for the kth sampling period. This is the output vector for the kth sampling period. The model sampling period, For discrete state transition functions, It is a discrete output function.
[0033] The model runtime encapsulates an initialization interface, an execution parameter reading interface, an input writing interface, a single-step advancement interface, and an output reading interface, so that the real-time control platform can complete model initialization, parameter reading, input writing, state update, and output reading in a preset order. Specifically, in this embodiment, the single-step advancement function is used to drive the model to perform a state update operation once in each real-time cycle, and is the core runtime interface for realizing real-time simulation.
[0034] S3: Load the model runtime in the real-time control platform, read the model sampling period, model input length, model output length and input / output port information, and establish the mapping relationship between external interface data, platform internal variables and input signal ports and output signal ports. Specifically, in this embodiment, load the DLL file in the LabVIEW real-time control platform.
[0035] Preferably, in step S3, establishing the mapping relationship includes: The model sampling period, model input length, model output length, input signal port arrangement information, and output signal port arrangement information of the model runtime are obtained through the parameter reading interface. Specifically, in this embodiment, the model loading function is called to load the DLL file into the LabVIEW runtime environment. The model sampling period is used to determine the time interval for single-step calculation of the model. The model input length and model output length represent the total length required for the input array and output array of the DLL file, respectively.
[0036] Let the model input array be... for: , The input array consists of its components; the model output array consists of its components. for: , in, The output array consists of M, where M is the model input length and N is the model output length.
[0037] Based on the external interface data format and the platform's internal variable organization method, establish the positional and length correspondences between the external interface data and the input signal ports, and establish the data correspondences between the output signal ports and the display module, recording module, status monitoring module, and external devices.
[0038] If the length of the i-th type of input data segment is The starting index is Then its mapping relationship in the target input array is expressed as: , in, This is the input data segment of type i; If the length of the output data segment of the j-th type is The starting index is Then its extraction relationship in the model output array is expressed as: , in, This is the output data segment for the j-th class.
[0039] Based on the arrangement order of each input signal port and output signal port and the data segment length information, index rules for input data packing and output data unpacking are generated. Specifically, in this embodiment, based on the arrangement order of the DLL file's input and output ports, the port dimensions, and the external interactive data format, a positional correspondence and a length correspondence relationship are established between external interface data, LabVIEW internal variables, and the DLL file's input and output ports. Through this mapping relationship, the conversion of data from different sources to a unified model input array and the distribution of data from a unified output array to different application modules can be realized.
[0040] S4: Adapt the external input data collected in the current cycle according to the mapping relationship to form a target input array with the same length as the model input, and write the target input array into the model runtime. Specifically, in this embodiment, a mapping relationship between external interface data, LabVIEW internal variables and DLL file input / output ports is established according to the model execution parameters, and the external input data is packaged according to the mapping relationship to form an input array that matches the length of the DLL file input port and then written into the DLL file.
[0041] Preferably, in step S4, the external input data collected in the current period is adapted, including: The system collects input data from external real sensors, sensor simulators, actuator simulators, or control interface devices and converts it into the platform's internal data format. Specifically, in this embodiment, the input data collected by the external interface is converted into a LabVIEW internal array. Based on positional correspondence, length correspondence, and indexing rules, the input data is processed by at least one of the following methods: truncation, zero padding, default value padding, preservation of data from the previous period, sorting, and concatenation. Where the actual length of a certain input data segment in the k-th sampling period is... The expected length is At that time, construct the adapted input data segment. Satisfy: When hour, ;when hour, ,in, To pad a vector with zeros or default values, the length is... ;when hour, That is, the front of the actual data is extracted. Each element serves as the adapted input segment; when input data is missing, the previous cycle's hold strategy is employed. Specifically, in this embodiment, external physical sensor data is truncated or padded according to the length of the physical data packet, control parameters are processed according to the length of the control quantity, and then the two are concatenated into an input array with the same total length as the model input. The control parameters are arranged according to the length of the control quantity, and the above data are concatenated in a predetermined order to form a target input array with the same total length as the model input. When the length of the external interface input data is less than the length of the model input, at least one of zero-padding, previous cycle data retention, or default parameter filling is performed on the missing part. When the length of the external interface input data is greater than the length of the model input, data fields related to model operation are extracted according to a preset priority and redundant fields are discarded. A target input array with the same length as the model input is formed and written into the model runtime so that the state update operation can be performed by calling the single-step advancement interface in the current cycle. Specifically, in this embodiment, the target input array is written into the DLL file through the ImportArray method to provide input for the model operation in the current cycle.
[0042] S5: In the deterministic real-time loop of the LabVIEW real-time control platform, the single-step advancement interface is called according to the model sampling period to perform state update calculations in order to obtain the model output array of the current period. Specifically, in this embodiment, a timed While loop or other deterministic real-time loop structure is adopted to make the real-time loop period correspond to the model sampling period.
[0043] Preferably, in step S5, the state update operation is performed in the deterministic timing loop of the real-time control platform, including: Establish a fixed-step timed loop that matches the model sampling period, and set each loop period as one discrete model update period.
[0044] At the beginning of each cycle, the target input array corresponding to the current cycle is written into the model runtime.
[0045] Call the single-step propulsion interface to perform a state update operation so that the satellite attitude and orbit dynamics model completes the state iteration within the current sampling period and generates the corresponding model output array.
[0046] The state update operation adopts the following discrete iterative form: , The state derivative for the current period is calculated from the continuous state equation, or a pre-generated discrete state equation can be used: , , In the formula, , , , These are the discrete state matrix, input matrix, output matrix, and through matrix, respectively.
[0047] After completing the state update operation of the current cycle, the model output array is read through the output reading interface, and the next cycle is entered to realize the continuous real-time operation of the satellite attitude and orbit dynamics model. Specifically, in this embodiment, when the single-step propulsion function is detected to return an abnormal state, at least one of the following processes can be performed: error information recording, model reset, stopping the real-time loop, or reloading the DLL file.
[0048] S6: Based on the mapping relationship, the model output array is unpacked and distributed. A portion of the output data is used for display, recording or status monitoring, while another portion of the output data is sent to external devices. The feedback data returned by the external devices is received as part of the model input for the next cycle, thus forming a closed-loop semi-physical simulation link.
[0049] Preferably, in step S6, the model output data is unpacked and distributed, including: Based on the mapping relationship and indexing rules, data segments with different functions are separated from the model output array. Specifically, in this embodiment, the output array is read from the DLL file using the Export Array method, and the control command data segment and the dynamic measurement data segment are separated from the output array according to the control quantity length and the dynamic measurement length.
[0050] Identify at least one of the following in different functional data segments: attitude angle data, angular velocity data, orbital position data, orbital velocity data, control command data, actuator drive data, and condition monitoring data.
[0051] Where the attitude quaternion output is: , For the quaternion scalar part, If the quaternion vector part is used, then the attitude angle can be calculated by the following formula: , , , in, For roll angle, The pitch angle, This is the yaw angle.
[0052] Data used for human-machine display and operation analysis is sent to the display module, recording module, or status monitoring module. Data used for external device driving or interaction is sent to the external device communication module. Specifically, in this embodiment, a portion of the output data is sent to the display module for real-time display of attitude and orbit status; a portion of the output data is sent to the data recording module for recording the model operation process; a portion of the output data is sent to the monitoring module for operation status diagnosis or anomaly detection; and a portion of the output data is sent to the external device communication module for interaction with real or simulated devices.
[0053] The external device communication module encapsulates the corresponding output data into a data format recognizable by the external device and sends it to the external device. Specifically, in this embodiment, the output data participating in the semi-physical closed loop is encapsulated into a data packet recognizable by the external device and sent to the external device through a serial port, TCP / IP interface or bus interface to support real-time digital simulation or closed-loop semi-physical simulation.
[0054] Preferably, in step S6, the feedback data returned by the external device is used as part of the model input for the next cycle: Receive feedback data from external real sensors, sensor simulators, actuator simulators, or control interface devices; The feedback data undergoes format conversion, length verification, and validity assessment. Based on the mapping relationship, the feedback data is written into the corresponding data segment of the target input array for the next cycle. Let the output of the current cycle model be External device feedback data is The input vector for the next cycle is The closed-loop input construction relation is then expressed as: , in, This is the internal mapping matrix from output to input. This is the mapping matrix from feedback data to input. This is to provide supplementary input from the external interface for the next cycle; This creates a continuous feedback path between the model output of the current cycle, the response of the external device, and the model input of the next cycle, thus forming a closed-loop semi-physical simulation link.
[0055] S7: Monitors the execution status of each cycle during operation. When execution timeout, input abnormality, or feedback abnormality is detected, a preset stability handling strategy is executed to maintain the stable operation of the satellite attitude and orbit dynamics model on the real-time control platform.
[0056] Further, in step S7, a preset stability processing strategy is executed, including: The execution time of the single-step advancement interface, the integrity of the target input array, and the validity of the feedback data are monitored within each cycle.
[0057] Let the actual execution time of the k-th cycle be... The model sampling period is Then when the following conditions are met If the execution timeout occurs, it is determined to be an execution timeout. Let the actual length of the target input array in the k-th period be... If the model input length is M, then when the following conditions are met... When this happens, it is determined that the input length is abnormal; Let the valid feedback flag be... ,in , Then when If this occurs, it is determined to be a feedback anomaly.
[0058] An alarm message is output when the execution time exceeds the model sampling period, or when input data is missing, input length is mismatched, feedback is missing, or feedback is abnormal.
[0059] Based on the anomaly type, perform at least one of the following actions: retain the input from the previous cycle, switch to default parameter input, pause non-critical external interface writing, reduce data refresh frequency, or terminate the current simulation. Among these, retaining the input from the previous cycle... It can be represented as: , The current cycle input is used, and when an anomaly occurs, the current cycle input uses the value from the previous cycle. Switching to the default parameter input can be represented as: , This is a pre-defined safety default input vector used to replace the actual input in case of data anomalies, ensuring the simulation continues to run. This maintains the stable operation of the satellite attitude and orbit dynamics model on the real-time control platform.
[0060] The above processing can be performed in conjunction with the processing of the abnormal state returned by the single-step advancement function in step S5 to ensure that the simulation system can maintain stable operation or safely exit under various abnormal conditions.
[0061] In one specific implementation, the location of the dynamic link library model file is specified through the model path input module in the LabVIEW real-time control platform, and Load Model.vi is called to complete the model loading. After the model is loaded, the model sampling period is obtained through Get Model Period.vi. The obtained native model period value is multiplied by 1000 to convert it to milliseconds, resulting in a model running period value of 1 in ms. The model sampling period is used for the verification or setting of real-time loop scheduling parameters. The system sets 1000ms as the period validity verification threshold. After parameter judgment is completed through comparison logic, the timing loop main scheduling period is configured. The timing loop priority is set to 500. In the LabVIEW real-time system, the higher the priority value, the greater the task scheduling priority, thereby ensuring the accuracy of the timing loop timing and preventing the simulation calculation task from being preempted by other background programs, so as to ensure that the single-step calculation period of the model matches the loop period of the real-time control platform. Furthermore, by traversing and parsing the model input ports (Inports) and output ports (Outports), the names, order, dimensions, and port attribute information of the model input and output ports are obtained, and parameters such as the length of received quantities, the length of control quantities, the length of semi-physical data packets, and the length of dynamic measurements are statistically analyzed. Specifically, according to the agreed protocol, the model output information is a string array. Index position 1 represents information related to the half-physical data packet. Indexing position 2 of the half-physical data packet yields the physical data packet length string. This string is then truncated by 3 units from position 1 and converted to an integer to obtain the half-physical data packet length. The dynamic telemetry length is indexed in the same way. After obtaining the above parameters, a mapping relationship is established between external input data, LabVIEW internal variables, and DLL file input / output arrays. Based on this mapping relationship, the input array is organized and the output array is parsed. In the real-time loop, the Import Array interface is called to write the model input array sent by the satellite via serial port into the model. Then, Take Model Time Step.vi is called to execute a single-step calculation of the model to drive the satellite attitude and orbit dynamics model to complete a real-time state update. After the model runs, the model output results are read for subsequent display, recording, or external interface transmission. At the end of the simulation, the model is unloaded using Unload Model.vi to release related runtime resources.
[0062] In one specific implementation, the real-time timed loop configuration parameters are set to priority 3, loop scheduling period of 100ms, and the maximum byte capacity of the serial port single read buffer is set to 4096 bytes. A serial communication link is established with the external device through the VISA communication interface, and the byte stream data sent by the external device is received and processed in the real-time loop. Specifically, the available byte data in the serial port buffer is first read, and the received byte stream is processed according to the preset communication protocol to identify the frame header, determine the data length, extract the payload, and perform verification processing to obtain valid input data that can be used by the model. After completing the protocol parsing, the valid input data is reassembled, truncated, padded, or type-converted according to the established input mapping relationship to generate an input array that conforms to the DLL file input format requirements, and this input array is written into the model. Simultaneously, the model output is split according to a preset output field order, extracting control data segments and dynamic measurement data segments respectively. The output data is then encapsulated, concatenated, and format-converted according to the external device communication protocol. During data conversion, array index 0 is used as the starting index for data reading. The serial port link uses a single-floating-point 2-byte compressed format to encapsulate messages, while the UDP forwarding link uses a single-floating-point 16-byte high-precision format. This forms a string that can be sent by VISAWrite.vi and is then transmitted via the serial port. Furthermore, the serial port response section can continuously complete the closed-loop interactive process of receiving data from external devices, parsing and reassembling it, writing it into the model, reading the output, encapsulating it, and sending it within a real-time loop. This allows the model calculation results to be fed back to the external device in real time, while the data returned by the external device is used as part of the model input for the next cycle, thus forming a stable closed-loop semi-physical simulation link.
[0063] The above structure enables rapid deployment, deterministic driving, and closed-loop data interaction with external devices of satellite attitude and orbit dynamics models established in the MATLAB / Simulink environment within the LabVIEW real-time control platform. Through the coordinated operation of the model-driven module and the serial port response module, unified management, real-time computation, and protocol communication of model input and output data can be achieved, thereby improving the real-time performance, flexibility, and engineering applicability of semi-physical simulations for satellite attitude and orbit control.
[0064] Second Embodiment In this embodiment, a computer device is provided, including a memory and one or more processors. The memory stores computer code. When the computer code is executed by one or more processors, it causes the one or more processors to perform the steps of a real-time semi-physical simulation method for satellite attitude and orbit control in the first embodiment.
[0065] In some embodiments of this application, a computer-readable storage medium is also provided, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors perform the steps of a real-time semi-physical simulation method for satellite attitude and orbit control as described in any one of the first embodiments.
[0066] It is understood that, for the aforementioned real-time semi-physical simulation method for satellite attitude and orbit control, if all components are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer server or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this invention. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0067] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0068] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A real-time semi-physical simulation method for satellite attitude and orbit control, characterized in that, Includes the following steps: S1: Establish a satellite attitude and orbit dynamics model, and define the input signal port and output signal port between the satellite attitude and orbit dynamics model and the external real-time control platform; S2: Generate a model running entity from the satellite attitude and orbit dynamics model that can be periodically called by the real-time control platform; S3: Load the model runtime into the real-time control platform, read the model sampling period, model input length, model output length and input / output port information, and establish the mapping relationship between external interface data, platform internal variables and the input signal port and the output signal port; S4: Adapt the external input data collected in the current cycle according to the mapping relationship to form a target input array with the same length as the model input, and write the target input array into the model running body; S5: In the deterministic real-time loop of the real-time control platform, the single-step advancement interface is called according to the model sampling period to perform state update calculations in order to obtain the model output array for the current period; S6: According to the mapping relationship, the model output array is unpacked and distributed. A portion of the output data is used for display, recording or status monitoring, and another portion of the output data is sent to an external device. The feedback data returned by the external device is received as part of the model input for the next cycle to form a closed-loop semi-physical simulation link. S7: Monitor the execution status of each cycle during operation. When an execution timeout, input anomaly, or feedback anomaly is detected, execute a preset stability handling strategy to maintain the stable operation of the satellite attitude and orbit dynamics model on the real-time control platform.
2. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 1, characterized in that, In step S1, a satellite attitude and orbit dynamics model is established, including: Construct an attitude dynamics sub-model to characterize the satellite's attitude motion state and an orbital dynamics sub-model to characterize the satellite's orbital motion state; Based on the requirements of the semi-physical simulation, at least one of the following is introduced into the attitude dynamics sub-model, the orbital dynamics sub-model: an environmental disturbance model, a sensor model, and an actuator model, to form the satellite attitude and orbital dynamics model. Based on the data flow of the internal state variables, control variables, and measurement variables of the satellite attitude and orbit dynamics model, the input signal ports and output signal ports for interaction with the external real-time control platform are defined, and the data categories and arrangement order corresponding to each input signal port and output signal port are determined.
3. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 1, characterized in that, In step S2, the model runtime is generated, including: A consistency check is performed on the input / output port dimensions, data types, discrete sampling settings, and runtime calling methods of the satellite attitude and orbit dynamics model. Based on the periodic calling requirements of the real-time control platform, the satellite attitude and orbit dynamics model is processed by code generation and compilation linking to generate a model runtime that can be called by the real-time control platform; The model runtime encapsulates an initialization interface, an execution parameter reading interface, an input writing interface, a single-step advancement interface, and an output reading interface, so that the real-time control platform can complete model initialization, parameter reading, input writing, state update, and output reading in a preset order.
4. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 1, characterized in that, In step S3, establishing the mapping relationship includes: The model sampling period, model input length, model output length, input signal port arrangement information, and output signal port arrangement information of the model runtime are obtained through the parameter reading interface. Based on the external interface data format and the platform's internal variable organization method, establish the positional and length correspondences between the external interface data and the input signal ports, and establish the data correspondences between the output signal ports and the display module, recording module, status monitoring module, and external devices; If the length of the i-th type of input data segment is The starting index is Then its mapping relationship in the target input array is expressed as: , in, Input array for the model, This is the input data segment of type i; If the length of the output data segment of the j-th type is The starting index is Then its extraction relationship in the model output array is expressed as: , in, For the j-th type of output data segment, Output an array for the model; Based on the arrangement order of each input signal port and output signal port and the data segment length information, index rules are generated for input data packing and output data unpacking.
5. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 4, characterized in that, In step S4, the external input data collected in the current cycle is adapted, including: It collects input data from external real sensors, sensor simulators, actuator simulators, or control interface devices, and converts it into the platform's internal data format. Based on the position correspondence, length correspondence, and indexing rules, the input data is subjected to at least one of the following processing methods: truncation, zero padding, default value padding, preservation of data from the previous period, sorting, and concatenation. Wherein, when the actual length of a certain input data segment in the k-th sampling period is... The expected length is At that time, construct the adapted input data segment. Satisfy: When hour, ;when hour, ,in, To pad a vector with zeros or default values, the length is... ;when hour, When input data is missing, the hold strategy from the previous cycle is used: ; A target input array with the same length as the model input is formed, and the target input array is written into the model runtime so that the single-step advancement interface can be called in the current cycle to perform state update operations.
6. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 1, characterized in that, In step S5, a state update operation is performed in the deterministic timing loop of the real-time control platform, including: Establish a fixed-step timed loop that matches the model sampling period, and set each loop period as one discrete model update period; At the beginning of each cycle, the target input array corresponding to the current cycle is written into the model runtime. The single-step propulsion interface is invoked to perform a state update operation, so that the satellite attitude and orbit dynamics model completes the state iteration within the current sampling period and generates the corresponding model output array. After completing the state update calculation for the current cycle, the model output array is read through the output reading interface, and the next cycle is entered to realize the continuous real-time operation of the satellite attitude and orbit dynamics model.
7. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 1, characterized in that, In step S6, the model output array is unpacked and distributed, including: Based on the mapping relationship and indexing rules, data segments with different functions are split from the model output array; Identify at least one of the following in the data segments of the different functions: attitude angle data, angular velocity data, orbital position data, orbital velocity data, control command data, actuator drive data, and status monitoring data; Data used for human-machine display and operation analysis is sent to the display module, recording module or status monitoring module, and data used for external device driving or interaction is sent to the external device communication module; The external device communication module encapsulates the corresponding output data into a data format recognizable by the external device and sends it to the external device.
8. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 7, characterized in that, In step S6, the feedback data returned by the external device is received as part of the model input for the next cycle. Receive feedback data from external real sensors, sensor simulators, actuator simulators, or control interface devices; The feedback data is format-converted, length-validated, and validity-determined, and then written into the corresponding data segment of the target input array for the next cycle according to the mapping relationship. Let the output of the current cycle model be External device feedback data is The input vector for the next cycle is The closed-loop input construction relation is then expressed as: , in, This is the internal mapping matrix from output to input. This is the mapping matrix from feedback data to input. This is to provide supplementary input from the external interface for the next cycle; This creates a continuous feedback path between the model output of the current cycle, the response of the external device, and the model input of the next cycle, thus forming a closed-loop semi-physical simulation link.
9. The real-time semi-physical simulation method for satellite attitude and orbit control according to claim 1, characterized in that, In step S7, the preset stability processing strategy is executed, including: The execution time of the single-step advancement interface, the integrity of the target input array, and the validity of the feedback data are monitored within each cycle. When the execution time exceeds the model sampling period, or when input data is missing, input length is mismatched, feedback is missing or abnormal, an alarm message is output. Depending on the type of anomaly, at least one of the following actions is performed: maintain the input from the previous cycle, switch to default parameter input, pause writing to non-critical external interfaces, reduce the data refresh frequency, or terminate the current simulation, in order to maintain the stable operation of the satellite attitude and orbit dynamics model on the real-time control platform.
10. A computer device comprising a memory and one or more processors, the memory storing computer code that, when executed by the one or more processors, causes the one or more processors to perform the steps of the real-time semi-physical simulation method for satellite attitude and orbit control as described in any one of claims 1-9.