Cross-platform operation method for simulation model of satellite communication system

By defining abstract base classes and cross-platform API interfaces and combining cross-platform compilation scripts, the satellite communication simulation model is implemented across platforms between different operating systems, solving the problem that the simulation model cannot run across platforms in the existing technology, and improving the flexibility and portability of the system.

CN119847593APending Publication Date: 2025-04-18CHINA ACADEMY OF SPACE TECHNOLOGY
View PDF 3 Cites -1 Cited by

Patent Information

Application Number
CN202411708559.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The prior art is difficult to realize the cross-platform operation of satellite communication simulation models between different operating systems, resulting in increased difficulty in system integration and interoperability.

Method used

By defining abstract base classes and cross-platform API interfaces, system functions of different operating systems are established and conditional compilation is performed during the compilation stage. Use cross-platform compilation scripts to configure compilation toolchains and third-party dependency libraries for different platforms to realize cross-platform operation of simulation models.

Benefits of technology

It realizes the seamless operation of satellite communication simulation models between Windows, Ubuntu and Galaxy Kirin operating systems, improves the flexibility and portability of simulation models and simulation systems, and reduces the difficulty and cost of software development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847593A_ABST
    Figure CN119847593A_ABST
Patent Text Reader

Abstract

A satellite communication system simulation model cross-platform operation method belongs to the technical field of simulation, and comprises the following steps: defining an abstract base class, respectively establishing cross-platform APIs (Application Program Interface) of system functions of different operating systems, and performing conditional compiling according to an actual operating system in a compiling stage; establishing cross-platform header files used by different operating systems; the cross-platform header file comprises a plurality of header files, a macro definition and a type alias, and the macro definition and the type alias are respectively used for abstracting keywords and data types with the same function on different operating systems; a cross-platform compiling script is used for configuring compiling tool chains and third-party dependency libraries of different platforms, the cross-platform API interface and the cross-platform header file are compiled, and cross-platform operation of the simulation model is achieved; the cross-platform compiling script uses conditional statements to configure compilers, compiling options and library links of different platforms, and dynamically processes compiling of different operating systems. The problem that simulation models cannot run across platforms among different operating systems is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a cross-platform operation method for a satellite communication system simulation model, belonging to the technical field of simulation. Background Art

[0002] The increasingly complex communication environment and diverse application scenarios have brought huge challenges to the design, deployment and operation of satellite systems. For example, different satellites need to effectively share data and work together to ensure responsiveness in emergencies or complex tasks. In addition, the technical standards, operating mechanisms and data processing methods of various types of satellites are also different, which increases the difficulty of system integration and interoperability.

[0003] Satellite communication simulation systems play a vital role in the design, analysis and optimization of modern communication systems. They allow engineers and researchers to simulate different satellite communication scenarios, evaluate system performance, analyze channel characteristics, perform link budgets, and verify the effectiveness of new algorithms and technologies. The widespread use of these simulation systems not only improves the efficiency of satellite system research and development, but also reduces risks and costs before actual deployment.

[0004] With the widespread application of satellite communication simulation systems in the fields of national defense, public services, etc., users' demand for cross-platform is increasing. This trend is mainly reflected in the following aspects. First, the application scenarios are diversified. Satellite communication technology is increasingly widely used in different fields. These applications often involve different operating systems and device environments. Therefore, users need a simulation system that can run on multiple platforms to ensure applicability and flexibility in different scenarios. Secondly, the cost-effectiveness is low. The cross-platform compatibility of the simulation system helps to reduce the dependence on specific hardware and operating systems, and reduce the investment and operating costs of enterprises in software and hardware. In addition, different teams and projects may use different operating systems and devices. Cross-platform tools can reduce repeated development and save resources and time. Finally, and most importantly, the momentum of localization is high. Against the background of complex and changing international situations, the country attaches more and more importance to the independent controllable capabilities of core technologies. The localized satellite communication simulation system can reduce dependence on external technologies and products, enhance the country's independent innovation capabilities in key technology fields, and enhance national security. In the context of the current mainstream operating system or Windows system, compatibility with domestic operating systems such as Kylin is particularly important. Therefore, the satellite communication simulation system needs to have good cross-platform capabilities and be able to switch seamlessly between operating systems such as Windows and domestic operating systems.

[0005] Currently, there are some general simulation systems that support cross-platform, such as DWK from HP Shenzhou, ISIM from Advanced Intelligence Technology, and XSIM from Huaru Technology. However, in terms of system simulation for satellite-ground integrated systems, only patent CN118331083A proposes a lightweight satellite communication system performance simulation system. However, this simulation system is only compatible with Windows systems and has not yet been deployed across platforms. Summary of the invention

[0006] The technical problem solved by the present invention is: to overcome the deficiencies of the prior art, to provide a cross-platform operation method for a satellite communication system simulation model, and to solve the problem that the simulation model cannot be operated across platforms between different operating systems.

[0007] The technical solution of the present invention is: a cross-platform operation method of a satellite communication system simulation model, comprising:

[0008] By defining abstract base classes, we can establish cross-platform API interfaces for system functions of different operating systems, and perform conditional compilation according to the actual operating system during the compilation phase.

[0009] Establishing a cross-platform header file used by different operating systems; the cross-platform header file includes a plurality of header files, macro definitions and type aliases, wherein the macro definitions and type aliases are respectively used to abstract keywords and data types having the same functions on different operating systems;

[0010] A cross-platform compilation script is used to configure the compilation tool chains and third-party dependent libraries of different platforms, and the cross-platform API interface and cross-platform header file are compiled to realize cross-platform operation of the simulation model; the cross-platform compilation script uses conditional statements to configure the compilers, compilation options, and library links of different platforms, and dynamically handles the compilation of different operating systems.

[0011] Furthermore, the definition of the abstract base class includes:

[0012] An abstract base class is defined for each system function, and a series of pure virtual functions are defined in the abstract base class, wherein the pure virtual functions are cross-platform API interfaces for system function operations;

[0013] For the abstract base class representing system functions, a subclass is defined for each operating system to inherit the abstract base class, and each pure virtual function is implemented in the subclass according to the platform characteristics.

[0014] Furthermore, add #ifdef and #endif preprocessing commands before and after each subclass implementation:

[0015] For Windows systems, use #ifdef_WIN32;

[0016] For Ubuntu, use #ifdef__linux__;

[0017] For the Kylin operating system, use #ifdef__KYLINUX__ and use the add_definitions command in cmake to add different macro definitions _WIN32 / __linux__ / __KYLINUX__ for the three operating systems according to the operating system.

[0018] Furthermore, the implementation of each pure virtual function in the subclass according to the platform characteristics includes:

[0019] A factory function is implemented for each system function, and its return value is the std::unique_ptr smart pointer of the corresponding abstract base class; in the function implementation, according to the macro definition representing the operating system type, the #ifdef, #elif, and #endif preprocessing commands are used to return the subclass pointer corresponding to the operating system; and std::make_unique is used to create the subclass object.

[0020] Furthermore, the conditional compilation includes:

[0021] Use standard predefined macros WIN32 and UNIX to distinguish between Windows and Ubuntu systems;

[0022] Distinguish the Ubuntu system and the Kylin operating system by checking whether the file path / etc / kylin-release exists.

[0023] Furthermore, according to the operating system type, the set command of the cmake tool is used to assign different values ​​to the variable CMAKE_CXX_FLAGS and set different compilation options.

[0024] Furthermore, the cross-platform compilation script includes: for third-party dependent libraries and library paths, using the set command to assign the specific path of the library to the variable LIBRARY_PATH, and assigning the third-party dependent library name to the variable LIBS, or using the find_library command to find the library and its path.

[0025] Furthermore, the cross-platform compilation script includes: for a library header file, using the target_include_directories command to add the path where the library header file is located.

[0026] Furthermore, the cross-platform compilation script includes: using the target_link_libraries command to link the target file to a specified library on a specified path.

[0027] Furthermore, the cross-platform compilation script is a cmake compilation script.

[0028] The advantages of the present invention compared with the prior art are:

[0029] (1) Aiming at the cross-platform development of simulation models and simulation systems of satellite communication systems, the present invention proposes a cross-platform compatibility design method, that is, developing a cross-platform compatibility framework, which provides a unified cross-platform CMake compilation script, a cross-platform API interface, a cross-platform header file, etc. The developers of the simulation model and the simulation system use the framework for development, which can realize a set of codes running seamlessly on multiple platforms, significantly improving the flexibility and portability of the simulation model and the simulation system, and greatly improving the efficiency of software development.

[0030] (2) The present invention can be used for satellite communication system simulation in large-scale and complex application scenarios such as system simulation, training and exercise, and simulation training, to achieve cross-platform operation of simulation models and simulation systems, thereby achieving complete independent control of software and hardware. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0032] Figure 1 This is a cross-platform cmake compilation script flow chart of the present invention;

[0033] Figure 2 This is a schematic diagram of the class inheritance relationship of the lock processing of the present invention. DETAILED DESCRIPTION

[0034] In order to better understand the above technical scheme, the technical scheme of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical scheme of the present invention, rather than limitations on the technical scheme of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0035] The following is a further detailed description of a cross-platform operation method of a satellite communication system simulation model provided by an embodiment of the present invention in conjunction with the accompanying drawings. The specific implementation method may include:

[0036] By defining abstract base classes, we can establish cross-platform API interfaces for system functions of different operating systems, and perform conditional compilation according to the actual operating system during the compilation phase.

[0037] Establishing a cross-platform header file used by different operating systems; the cross-platform header file includes a plurality of header files, macro definitions and type aliases, wherein the macro definitions and type aliases are respectively used to abstract keywords and data types having the same functions on different operating systems;

[0038] A cross-platform compilation script is used to configure the compilation tool chains and third-party dependent libraries of different platforms, and the cross-platform API interface and cross-platform header file are compiled to realize cross-platform operation of the simulation model; the cross-platform compilation script uses conditional statements to configure the compilers, compilation options, and library links of different platforms, and dynamically handles the compilation of different operating systems.

[0039] In the solution provided in the embodiment of the present invention, the operating systems specifically include the Windows system of the X86 architecture, the Linux system of the X86 architecture, and the Kylin operating system of the ARM architecture. The Kylin operating system is a domestic operating system based on the Linux kernel.

[0040] The differences between these three operating systems are mainly reflected in the following aspects. First, there are system functions. There are significant differences in the system functions and application programming interfaces provided by different operating systems. The Windows system uses the programming interface WinAPI provided by Microsoft, while the programming interfaces of the Linux system and the Kylin operating system follow the POSIX standard, resulting in compilation errors for programs successfully compiled on the Windows system on the Linux system and the Kylin operating system. Secondly, the compilation tool chain. Different operating systems use different compilation tool chains and build systems. The Windows system uses the MSVC compiler of Visual Studio, while the Linux system and the Kylin operating system use the GNU tool chain, resulting in the need to recompile programs compiled on the Windows system on the Linux system and the Kylin operating system before they can run. Then there are third-party dependent libraries. Third-party dependent libraries are generally not universal for different operating systems. Finally, header files, keywords, and data types with the same functions on different operating systems may also be different.

[0041] The present invention specifically discusses the Windows system of X86 architecture, the Linux distribution Ubuntu system of X86 architecture, and the Kylin operating system of ARM architecture as examples, and the programming language is C++. The method includes the following aspects:

[0042] (1) Provide a unified cross-platform cmake compilation script and use cmake tools to solve the problems of different compilation tool chains and third-party dependency libraries on different platforms

[0043] When using the cmake tool to build a cross-platform project, you can use conditional statements to configure platform-specific compilers, compilation options, and library links to dynamically handle compilation issues for Windows, Ubuntu, and Kylin operating systems. The specific steps include the following three steps:

[0044] 1. Use platform detection conditions

[0045] The variables and conditional statements provided by cmake can detect different operating systems. Specifically, Windows and Ubuntu systems can be distinguished using the standard predefined macros WIN32 and UNIX, while Kylin operating system, as a version branch of Linux system, can be distinguished by determining whether there is a file path / etc / kylin-release unique to Kylin operating system.

[0046] 2. Set the compiler and compilation options

[0047] Different operating systems may have different compilers and compilation options. Cmake can be set according to the operating system type. Specifically, for the compiler, Cmake will automatically identify the compiler used on the current operating system and use the variable CMAKE_CXX_COMPILER_ID to indicate the compiler type. On Ubuntu and Kylin operating systems, the compiler usually uses g++, and on Windows systems, the compiler usually uses Visual Studio's MSVC. For compilation options, you can use the set command to assign different values ​​to the variable CMAKE_CXX_FLAGS according to the operating system type, thereby setting different compilation options.

[0048] 3. Handle third-party dependent libraries, library paths, and library header files

[0049] Different operating systems may use different third-party dependent libraries, library paths, and library header files. Cmake can also be set according to the operating system type. Specifically, for third-party dependent libraries and library paths, you can use the set command to assign the specific path of the library to the variable LIBRARY_PATH, and assign the third-party dependent library name to the variable LIBS. You can also use the find_library command to find the library and its path. For library header files, you can use the target_include_directories command to add the path where the library header files are located. Finally, use the target_link_libraries command to link the target file to the specified library on the specified path.

[0050] (2) Abstract and encapsulate system functions with platform characteristics and provide a unified cross-platform API interface to the outside world

[0051] In cross-platform software development, system functions usually vary depending on the operating system, such as process control, thread management, network communication, etc. In order to deal with these differences, system functions with platform characteristics are usually abstracted and encapsulated, and a unified cross-platform API interface is provided to the outside world. Applications can access functions on different platforms through the same API interface, thus achieving the purpose of cross-platform development.

[0052] The specific steps include the following three steps:

[0053] 1. Identify functional points with platform characteristics and define a unified cross-platform API interface

[0054] First, determine the system functions that need to be abstracted and encapsulated, such as process operations, thread operations, network interfaces, etc. These functions may have different implementations in different operating systems, and define a unified cross-platform API interface for each of these system functions. Specifically, define abstract base classes for each of these system functions, and define a series of pure virtual functions in the abstract base classes. These pure virtual functions are the unified cross-platform API interface for all related operations of the system function.

[0055] 2. Implement specific functions for each platform based on the unified cross-platform API interface

[0056] Write specific implementation code for each operating system, and conditionally compile according to the actual operating system in the preprocessing stage. Specifically, for the abstract base class representing the system function, define a subclass for each operating system to inherit the abstract base class, and implement each pure virtual function in the subclass according to the platform characteristics. In addition, add #ifdef and #endif preprocessing commands before and after each subclass implementation. For Windows system, use #ifdef_WIN32, for Ubuntu system, use #ifdef__linux__, for Kylin operating system, use #ifdef__KYLINUX__, and in cmake, use the add_definitions command to add different macro definitions (_WIN32 / __linux__ / __KYLINUX__) according to the operating system, so that in the preprocessing stage, different subclass implementations can be conditionally compiled according to the operating system type.

[0057] 3. The unified cross-platform API interface uses factory functions to select different specific functions according to the platform type.

[0058] When calling a unified cross-platform API interface, you can use factory functions and platform detection to select different function implementations according to the operating system type. Specifically, for each system function with platform characteristics, implement a factory function, whose return value is the std::unique_ptr smart pointer of the corresponding abstract base class. In the function implementation, according to the macro definition (_WIN32 / __linux__ / __KYLINUX__) defined by cmake to represent the operating system type, use the #ifdef, #elif, and #endif preprocessing commands to return the subclass pointer corresponding to the operating system (use std::make_unique to create a subclass object).

[0059] (3) Provide unified cross-platform header files and unified support for header files, keywords, and data types with platform characteristics

[0060] In cross-platform development, header files, keywords, and data types with the same functions on different operating systems may be different. In order to handle these differences, a unified cross-platform header file is written. In the unified cross-platform header file, conditional compilation is used to provide unified support for header files, keywords, and data types with platform characteristics. Specifically, in the unified cross-platform header file, conditional compilation is used to encapsulate header files with platform characteristics; the #define preprocessing instruction is used to use unified macro definitions to abstract keywords with the same functions on different operating systems; the typedef keyword is used to use a unified type alias to abstract data types with the same functions on different operating systems.

[0061] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0062] Taking the distributed communication satellite system performance simulation system proposed by patent CN118331083A as a preferred example, the simulation system includes components such as a model running container, a time management unit, a simulation running management tool, etc., among which the model running container is a core component, and its function is to provide the necessary running environment for the simulation model. The simulation models running on the model running container include satellite models, terminal models, data distribution models, etc. As long as the model running container can achieve seamless cross-platform operation, the simulation model running on it can achieve cross-platform operation. Therefore, taking the model running container as a preferred example for detailed discussion, the specific implementation process of cross-platform cmake compilation scripts, cross-platform API interfaces, and cross-platform header files is given.

[0063] 1.Cross-platform cmake compilation script

[0064] The third-party libraries that the model running container depends on include the Redis client library cpp_redis, the high-performance network communication library tacopie, and the engine basic dependency library AppSim. On Windows systems, the specific implementations of these three libraries are cpp_redis.lib, tacopie.lib, and AppSim.dll; on Ubuntu systems and Kylin operating systems, the specific implementations of these three libraries are libcpp_redis.a, libtacopie.a, and libAppSim.so. In cmake, you can use the find_library command to find the path where the library is located, and use target_include_directories to add the relative path of the header file.

[0065] On Windows, the compiler is usually MSVC from Visual Studio, and on Ubuntu and Kylin OS, the compiler is usually g++. cmake will automatically identify the compiler used on the current OS.

[0066] See the cmake compilation script flowchart for Figure 1 , including the following steps:

[0067] S1: Use the set command to set the C++ language standard to C++14;

[0068] S2: Use the add_executable command to create the executable file SimCee.out, which contains three source files: Main.cpp, NewRedisAPI.cpp, and pystring.cpp;

[0069] S3: Use the target_include_directories command to add the path of the header files, and the header files are placed in the includes folder;

[0070] S4: Use the find_library command to find the cpp_redis library, tacopie library, and AppSim library respectively. The complete paths are stored in the variables CPP_REDIS_LIB, TACOPIE_LIB, and APPSIM_LIB respectively.

[0071] S5: Use the target_link_libraries command to link the found cpp_redis library, tacopie library, and AppSim library to the target file SimCee.out created in S2.

[0072] 2. Cross-platform API interface

[0073] The system functions with platform characteristics used by the model running container include: lock processing, dynamic library processing, thread processing, and event processing. Among them, lock processing includes four specific operations: initializing locks, locking, unlocking, and destroying locks. For these four specific operations, different operating systems provide different programming interfaces, as shown in Table 1 below:

[0074] Table 1 Differences in programming interfaces for lock handling in different operating systems

[0075]

[0076] Similarly, dynamic library processing includes four operations: loading dynamic libraries, obtaining function addresses, error handling, and unloading dynamic libraries. For these four specific operations, different operating systems provide different programming interfaces, as shown in Table 2 below:

[0077] Table 2 Differences in programming interface of dynamic library processing in different operating systems

[0078]

[0079] Similarly, thread processing includes two operations: creating a thread and destroying a thread. For these two specific operations, different operating systems provide different programming interfaces, as shown in Table 3 below:

[0080] Table 3 Differences in programming interfaces for thread processing in different operating systems

[0081]

[0082] Similarly, event processing includes three operations: creating event objects, waiting for events, and sending signals. For these three specific operations, different operating systems provide different programming interfaces, as shown in Table 4 below:

[0083] Table 4 Differences in programming interfaces for event processing in different operating systems

[0084]

[0085] Since the cross-platform API interface implementation process of the four system functions is consistent, lock processing is used as an example for detailed description. First, a unified cross-platform API interface is defined for lock processing, and then specific functions are implemented for each operating system. Finally, a factory function is implemented. The cross-platform API interface selects the corresponding specific implementation according to the operating system type. It specifically includes the following four steps. The class inheritance relationship of steps S1, S2, and S3 can be found in Figure 2 .

[0086] S1: Define an abstract base class Lock representing lock processing. It has two pure virtual functions, namely addLock for locking and unlock for unlocking. Its constructor initializes the lock and its virtual destructor destroys the lock. These four functions are a unified cross-platform API interface.

[0087] S2: Define a subclass WinLock that represents the Windows system and inherits the base class Lock. Its constructor is implemented using the CreateEvent system function of the Windows system, its destructor is implemented using the CloseHandle system function of the Windows system, its addLock function is implemented using the WaitForSingleObject system function of the Windows system, and its unlock function is implemented using the SetEvent system function of the Windows system.

[0088] S3: Because the Kylin operating system and the Ubuntu system are both version branches of the Linux system, the two use the same programming interface for lock processing related operations, so they are processed uniformly and a subclass LinuxLock representing the Ubuntu system and the Kylin operating system is defined to inherit the base class Lock. Its constructor is implemented using the pthread_mutex_init system function of the Linux system, its destructor is implemented using the pthread_mutex_destroy system function of the Linux system, its addLock function is implemented using the pthread_mutex_lock system function of the Linux system, and its unlock function is implemented using the pthread_mutex_unlock system function of the Linux system.

[0089] S4: Define a class LockFactory that represents a set of factory functions, define a static member function createLock in the class to represent lock processing, and use #ifdef_WIN32 and #else commands in the function body to distinguish whether the current operating system is a Windows system. If it is a Windows system, return a smart pointer to the WinLock class object; otherwise, return a smart pointer to the LinuxLock class object. The macro definition _WIN32 is defined in the cmake compilation script.

[0090] 3. Unified cross-platform header files

[0091] The header files, keywords, and data types with the same functions on different operating systems may be different. It is necessary to encapsulate a unified cross-platform header file. In the cross-platform header file, use the #ifdef, #elif, and #endif commands to perform conditional compilation based on the operating system type to provide unified support.

[0092] As for header files, as mentioned in the previous section, the model running container uses four types of system functions with platform characteristics, namely: lock processing, dynamic library processing, thread processing, and event processing. They have different programming interfaces and different header files to be referenced, as shown in Table 5 below:

[0093] Table 5 Differences in header file references for the same system function in different operating systems

[0094]

[0095] For keywords, the model running container uses 6 platform-specific keywords, namely: thread local storage, dynamic library import, dynamic library export, calling convention, data alignment, and exception handling. In the unified cross-platform header file, the #define preprocessing command is used to abstract them into a unified macro definition, as shown in Table 6 below:

[0096] Table 6 Differences in the definition of keywords in different operating systems

[0097]

[0098]

[0099] For data types, the model running container uses three data types with platform characteristics, namely: integer type, handle type, and file descriptor. In the unified cross-platform header file, the typedef keyword is used to abstract them into a unified type alias, as shown in Table 7 below:

[0100] Table 7 Differences in the definition of data types in different operating systems

[0101]

[0102] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

[0103] The contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.

Claims

1. A cross-platform operation method for a satellite communication system simulation model, characterized in that: include: By defining abstract base classes, we can establish cross-platform API interfaces for system functions of different operating systems, and perform conditional compilation according to the actual operating system during the compilation phase. Establishing a cross-platform header file used by different operating systems; the cross-platform header file includes a plurality of header files, macro definitions and type aliases, wherein the macro definitions and type aliases are respectively used to abstract keywords and data types having the same functions on different operating systems; A cross-platform compilation script is used to configure the compilation tool chains and third-party dependent libraries of different platforms, and the cross-platform API interface and cross-platform header file are compiled to realize cross-platform operation of the simulation model; the cross-platform compilation script uses conditional statements to configure the compilers, compilation options, and library links of different platforms, and dynamically handles the compilation of different operating systems.

2. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: The definition of the abstract base class includes: An abstract base class is defined for each system function, and a series of pure virtual functions are defined in the abstract base class, wherein the pure virtual functions are cross-platform API interfaces for system function operations; For the abstract base class representing system functions, a subclass is defined for each operating system to inherit the abstract base class, and each pure virtual function is implemented in the subclass according to the platform characteristics.

3. A satellite communication system simulation model cross-platform operation method according to claim 2, characterized in that: Add #ifdef and #endif preprocessing commands before and after each subclass implementation: For Windows systems, use #ifdef_WIN32; For Ubuntu, use #ifdef__linux__; For the Kylin operating system, use #ifdef__KYLINUX__ and use the add_definitions command in cmake to add different macro definitions _WIN32 / __linux__ / __KYLINUX__ for the three operating systems according to the operating system.

4. A satellite communication system simulation model cross-platform operation method according to claim 2, characterized in that: The implementation of each pure virtual function in the subclass according to the platform characteristics includes: A factory function is implemented for each system function, and its return value is the std::unique_ptr smart pointer of the corresponding abstract base class; in the function implementation, according to the macro definition representing the operating system type, the #ifdef, #elif, and #endif preprocessing commands are used to return the subclass pointer corresponding to the operating system; and std::make_unique is used to create the subclass object.

5. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: The conditional compilation includes: Use standard predefined macros WIN32 and UNIX to distinguish between Windows and Ubuntu systems; Distinguish the Ubuntu system and the Kylin operating system by checking whether the file path / etc / kylin-release exists.

6. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: Depending on the operating system type, use the set command of the cmake tool to assign different values ​​to the variable CMAKE_CXX_FLAGS and set different compilation options.

7. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: The cross-platform compilation script includes: for third-party dependent libraries and library paths, using the set command to assign the specific path of the library to the variable LIBRARY_PATH, and assigning the third-party dependent library name to the variable LIBS, or using the find_library command to find the library and its path.

8. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: The cross-platform compilation script includes: for a library header file, using the target_include_directories command to add the path where the library header file is located.

9. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: The cross-platform compilation script includes: using the target_link_libraries command to link a specified library on a specified path for a target file.

10. A satellite communication system simulation model cross-platform operation method according to claim 1, characterized in that: The cross-platform compilation script is a cmake compilation script.

Citation Information

Patent Citations

  • Vpp-STK satellite simulation development and operation platform system

    CN102841966A

  • Embedded aviation communication middleware supporting multi-operating system platform and an application thereof

    CN111488142A

  • Component parameterized digital satellite system oriented to application simulation and virtual-real interaction

    CN118551546A