A Python-based telemetry page format conversion system
The Python-based telemetry page format conversion system solves the problem of inconsistent telemetry page formats between different systems, enabling efficient conversion and flow of telemetry pages between different systems and reducing the workload of designers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2026-03-10
AI Technical Summary
The inconsistent telemetry page formats across different systems force designers to repeatedly design telemetry pages for both the testing and operation management systems, increasing their workload.
Develop a Python-based telemetry page format conversion system, including a data preparation module, a JSON to XML conversion module, an XML to JSON conversion module, and an Excel to XML conversion module. By establishing a telemetry parameter attribute relationship mapping dictionary, the system enables the conversion of telemetry pages between different formats.
It reduces the burden on telemetry page designers, improves design, editing and usage efficiency, and allows a single telemetry page to flow between different systems, saving manpower.
Smart Images

Figure CN116257656B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information processing technology, and more specifically to a telemetry page format conversion system based on Python. Background Technology
[0002] During the satellite integrated testing and operation management phase, testing and operation management personnel need to use various satellite telemetry to judge the satellite status and carry out various satellite missions. To facilitate monitoring by ground personnel, various telemetry methods are often combined according to the needs of each subsystem, and telemetry pages are drawn in the system to display the status of each telemetry in real time.
[0003] During the integrated testing phase, as the overall satellite status gradually becomes complete and the functions of each subsystem are gradually improved, the telemetry pages are also gradually solidified and perfected. After entering the operation and management phase, it is often necessary to refer to or even directly use the telemetry pages formed in the testing phase to monitor the satellite status. However, there are differences between the two systems in the way the telemetry pages are recorded. The testing system uses JSON format files while the operation and management system uses XML format files, and the object attributes are also quite different. Therefore, it is impossible to achieve interconnection and interoperability of telemetry page files between the two systems. Designers need to repeatedly design the same telemetry page in both systems, which brings a great workload. Summary of the Invention
[0004] In view of this, the present invention provides a telemetry page format conversion system based on Python, which can solve the technical problem of inconsistent telemetry page formats between different systems in the prior art, requiring repeated page design.
[0005] To solve the above-mentioned technical problems, the present invention is implemented as follows.
[0006] A Python-based telemetry page format conversion system includes:
[0007] Data preparation module, JSON to XML module, XML to JSON module, Excel to XML module.
[0008] The data preparation module is used to establish a mapping dictionary of telemetry parameter attributes between the test system and the operation and management system for the satellite model, based on the satellite model, the telemetry parameter attributes corresponding to the satellite model in the test system, and the telemetry parameter attributes corresponding to the satellite model in the operation and management system; obtain the telemetry page to be converted, parse the telemetry parameter attributes in the telemetry page, and determine the code format and conversion mode of the telemetry parameter attributes;
[0009] Based on the conversion mode, one of the following modules is triggered: Json to XML, XML to Json, or Excel to XML, to convert the telemetry page to be converted.
[0010] Preferably, the JSON to XML module is used to find all telemetry nodes in the telemetry page to be converted when the conversion mode is JSON to XML. Each telemetry node is a JSON node, and each telemetry node is used as the first object to be processed. For each telemetry node, the following operations are performed: based on the relational mapping dictionary, determine the XML telemetry code corresponding to the first object to be processed; based on the XML telemetry code, determine the telemetry parameter attributes to be converted for the first object to be processed; perform conversion processing on the telemetry parameter attributes to be converted; after conversion, the first object to be processed calls the conversion function to obtain the XML telemetry tag; adds tag attributes to the XML telemetry tag to obtain the converted node; and mounts the converted node to the XML tree structure. The telemetry parameter attributes include font size, background color, position, border, and font style. The telemetry parameter attributes to be converted are a subset of the telemetry parameter attributes.
[0011] Preferably, the XML to JSON module is used to query each leaf node based on the tree structure of the XML tree when the conversion mode is XML to JSON. Each leaf node serves as a second object to be processed. For each second object to be processed, the following operations are performed: extracting the tag attributes, telemetry code, and related attributes of the second object to be processed; determining the JSON telemetry code corresponding to the second object to be processed based on the relational mapping dictionary; determining the telemetry parameter attributes to be converted based on the JSON telemetry code; performing conversion processing on the telemetry parameter attributes to be converted; calling the conversion function to obtain a JSON telemetry structure after conversion; adding tag attributes to the JSON telemetry structure to obtain a JSON telemetry node; and writing the JSON telemetry node into a JSON file. The telemetry parameter attributes include font size, background color, and position, and the telemetry parameter attributes to be converted are a subset of the telemetry parameter attributes.
[0012] Preferably, the Excel to XML module is used to, when the conversion mode is Excel to XML, search for the telemetry code and telemetry name in the Excel telemetry page document, take the entire page template in the sheet as the third conversion object to be processed, and determine the conversion target as a Label page or a Chart page based on the sheet name of the third conversion object to be processed; and perform the conversion from Excel format to XML format based on the page layout of the Excel document and the conversion target.
[0013] Preferably, the JSON to XML conversion module includes a text node processing submodule, a curve node processing submodule, and a first conversion submodule;
[0014] The text node processing submodule is used to obtain JSON nodes with text attributes. For JSON nodes with bordered graphic areas, it obtains the position, size, background color, font, font size, and border color attributes of the JSON node, and converts the JSON node into a Label node in an XML file. The Label node is the converted node. For JSON nodes with background images, it sets the Type attribute of the corresponding converted node to "text", obtains the position, size, background color, font color, font, and font size attributes of the JSON node, and converts the JSON node into a Label node in an XML file. The Label node is the converted node. For JSON nodes with dynamic text attributes, it obtains the position, size, background color, font color, font, and border color attributes of the JSON node, sets the Type attribute of the corresponding converted node to "tm", and converts the JSON node into a corresponding Label node. The Label node is the converted node.
[0015] The curve node processing submodule is used to obtain JSON nodes with the attribute of curve type, obtain the curve image position and image size of the JSON node, and convert the curve image position and image size from the center point coordinates to the top left corner coordinates; then, obtain each curve telemetry associated in the dynamic attribute of the curve type JSON node, and based on the curve color attribute of the curve type JSON node, convert the name and color attributes of the curve type JSON node into the corresponding TmPara node in XML; based on the relation mapping dictionary, determine the XML telemetry code corresponding to the curve type JSON node, and mark the Name attribute of the curve type JSON node with the telemetry code, thereby realizing the conversion of the curve type JSON node into a Chart tag node in XML;
[0016] The first conversion submodule is used to traverse the entire JSON document, perform corresponding processing according to the type of telemetry nodes in the JSON document, and complete the node conversion; mount the converted Label nodes and / or Chart nodes to the Page nodes of the XML tree, mount the Page nodes to the Satellite nodes of the XML tree, and write the XML tree to a file to form an XML telemetry page document.
[0017] Preferably, the XML to JSON module includes a tag to text node submodule, a tag to curve node submodule, and a second conversion submodule;
[0018] The tag-to-text node submodule is used to extract Label tags from XML documents. For each Label tag, the following operations are performed: A JSON text node corresponding to the Label tag is created; the position information in the Label tag is converted from the top-left corner coordinates to the center point coordinates, and then converted into the position attribute of the corresponding JSON text node in the JSON document; the size information in the Label tag is converted into a string, with `width` as the width attribute and `height` as the height attribute of the corresponding JSON text node in the JSON document; the font color, background color, text information, and font size in the Label tag are converted into node attributes of the corresponding JSON text node after string processing; based on the relational mapping dictionary, the telemetry code of the JSON document corresponding to the Label tag is determined, and the `value` attribute of the corresponding JSON text node is marked with the telemetry code;
[0019] The tag-to-curve node submodule is used to extract Chart tags from XML documents. For each Chart tag, the following operations are performed: A corresponding JSON text node is created; the position information in the Chart tag is converted from the top-left corner coordinates to the center point coordinates, and then converted into the position attribute of the corresponding JSON text node; the size information in the Chart tag is split into strings, with width used as the width attribute and height used as the height attribute of the corresponding JSON text node; the font color, background color, text information, and font size in the Chart tag are processed into the node attributes of the corresponding JSON text node; the child tags TmPara of the Chart tag are traversed, and the name attribute of each TmPara tag is extracted to form the dynamic attribute of the corresponding JSON text node; and based on the relational mapping dictionary, the telemetry code of the JSON document corresponding to each TmPara is determined, and the value attribute in the dynamic attribute is marked as the telemetry code.
[0020] The second conversion submodule is used to traverse the entire XML document, process the tag types of each child node under the Page node according to the XML tree structure, and add the converted nodes to the JSON document to form a JSON telemetry page document.
[0021] Preferably, the Excel to XML module includes a conversion target determination submodule, a Label conversion submodule, and a Chart conversion submodule;
[0022] The conversion target determination submodule is used to read the Excel file to be processed and determine the conversion target as a Label page or a Chart page based on the name of each sheet in the Excel file. The sheet name is either to be converted to an XML page with Label as the main body or to be converted to an XML page with Chart as the main body.
[0023] The Label conversion submodule is used to read the length of each line of string data in the Excel file, determine whether the line is a title line or a data line, combine the data lines, merge the telemetry name and telemetry code, generate an XmlLabel tag from the combined data lines and assign default values to the relevant attributes; convert all the titles and combined data lines in the Excel file into corresponding Label tags and mount them in the XML tree to generate an XML document;
[0024] The Chart conversion submodule creates an array, where each element stores all curves in each image; it determines the telemetry code for each curve, assigns a color value to each curve, converts the entire image into a Chart tag, converts each curve into a TmPara tag, and attaches the TmPara tags under the Chart tag, which in turn attaches the Chart tag under the Page tag to generate an XML document.
[0025] Beneficial effects:
[0026] This invention uses the XML format telemetry page protocol as its core, and develops a program based on the Python language to convert between JSON format telemetry pages and XML format page files. It also develops a program to convert Excel files to XML format files. Using the XML format telemetry page file as a medium, it realizes the mutual conversion between Excel files, JSON files and XML files, and establishes a page transmission channel between designers, testing systems and operation and management systems. A single telemetry page can be designed and previewed and edited in multiple systems.
[0027] It has the following technical effects:
[0028] (1) This invention greatly reduces the design burden of telemetry page users, improves the efficiency of telemetry page design, editing and use, and enables a telemetry page to be transferred and flow between different systems.
[0029] (2) This invention enables telemetry page designers to lay out basic telemetry page layouts using Excel files, eliminating the need for prior design in each system. A large number of basic telemetry page layout files can be generated simply by editing Excel files.
[0030] (3) This invention enables designers to design, preview and modify telemetry pages in one system and then generate telemetry page files applicable to other systems through a page conversion tool, without having to perform the same design and modification again in other systems.
[0031] (4) The present invention is simple to implement and has high conversion efficiency.
[0032] (5) This invention saves manpower. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the structure of the Python-based telemetry page format conversion system provided by the present invention.
[0034] Figure 2 This is a schematic diagram illustrating the conversion of text nodes in a JSON file into Label tags, as provided by the present invention.
[0035] Figure 3 This is a schematic diagram illustrating the conversion of curve nodes in a JSON file into Chart tags, provided by the present invention.
[0036] Figure 4 This is a schematic diagram illustrating the conversion of a JSON file to an XML file, as provided by the present invention.
[0037] Figure 5 This is a schematic diagram illustrating the conversion of Label tags in an XML file into text nodes, as provided in this invention.
[0038] Figure 6 This is a schematic diagram illustrating the conversion of Chart tags into curve nodes in an XML file provided by the present invention.
[0039] Figure 7 This is a schematic diagram illustrating the conversion of an XML file to a JSON file as provided by the present invention.
[0040] Figure 8 This is a schematic diagram illustrating the conversion of an Excel file to an XML file as provided by the present invention. Detailed Implementation
[0041] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0042] like Figure 1 As shown, this invention proposes a telemetry page format conversion system based on Python, including: a data preparation module, a JSON to XML module, an XML to JSON module, and an Excel to XML module.
[0043] The data preparation module is used to establish a mapping dictionary of telemetry parameter attributes between the test system and the operation and management system for the satellite model, based on the satellite model, the telemetry parameter attributes corresponding to the satellite model in the test system, and the telemetry parameter attributes corresponding to the satellite model in the operation and management system; obtain the telemetry page to be converted, parse the telemetry parameter attributes in the telemetry page, and determine the code format and conversion mode of the telemetry parameter attributes;
[0044] Based on the conversion mode, one of the following modules is triggered: Json to XML, XML to Json, or Excel to XML, to convert the telemetry page to be converted.
[0045] The JSON to XML conversion module is used to find all telemetry nodes in the telemetry page to be converted when the conversion mode is JSON to XML. Each telemetry node is a JSON node, and each telemetry node is used as the first object to be processed. For each telemetry node, the following operations are performed: based on the relational mapping dictionary, the XML telemetry code corresponding to the first object to be processed is determined; based on the XML telemetry code, the telemetry parameter attributes to be converted of the first object to be processed are determined; the telemetry parameter attributes to be converted are converted; the first object to be processed after conversion calls the conversion function to obtain the XML telemetry tag; tag attributes are added to the XML telemetry tag to obtain the converted node; and the converted node is mounted into the XML tree structure. The telemetry parameter attributes include font size, background color, position, border, and font style. The telemetry parameter attributes to be converted are a subset of the telemetry parameter attributes.
[0046] The XML to JSON module is used to query each leaf node based on the tree structure of the XML tree when the conversion mode is XML to JSON. Each leaf node serves as a second object to be processed. For each second object to be processed, the following operations are performed: extracting the tag attributes, telemetry code, and related attributes of the second object to be processed; determining the JSON telemetry code corresponding to the second object to be processed based on the relational mapping dictionary; determining the telemetry parameter attributes to be converted based on the JSON telemetry code; performing conversion processing on the telemetry parameter attributes to be converted; calling the conversion function to obtain a JSON telemetry structure after conversion; adding tag attributes to the JSON telemetry structure to obtain JSON telemetry nodes; and writing the JSON telemetry nodes into a JSON file. The telemetry parameter attributes include font size, background color, and position, and the telemetry parameter attributes to be converted are a subset of the telemetry parameter attributes.
[0047] The Excel to XML module is used to find the telemetry code and telemetry name in the Excel telemetry page document when the conversion mode is Excel to XML. The entire page template in the sheet is used as the third conversion object to be processed. Based on the sheet name of the third conversion object, the conversion target is determined to be a Label page or a Chart page. Based on the page layout of the Excel document and the conversion target, the Excel format is converted to XML format.
[0048] Furthermore, the JSON to XML conversion module includes a text node processing submodule, a curve node processing submodule, and a first conversion submodule.
[0049] The text node processing submodule is used to obtain JSON nodes with text attributes. For JSON nodes with bordered graphic areas, it obtains the position, size, background color, font, font size, and border color attributes of the JSON node, and converts the JSON node into a Label node in an XML file. The Label node is the converted node. For JSON nodes with background images, it sets the Type attribute of the corresponding converted node to "text", obtains the position, size, background color, font color, font, and font size attributes of the JSON node, and converts the JSON node into a Label node in an XML file. The Label node is the converted node. For JSON nodes with dynamic text attributes, it obtains the position, size, background color, font color, font, and border color attributes of the JSON node, sets the Type attribute of the corresponding converted node to "tm", and converts the JSON node into a corresponding Label node. The Label node is the converted node.
[0050] The curve node processing submodule is used to obtain JSON nodes with the attribute of curve type, obtain the curve image position and image size of the JSON node, and convert the curve image position and image size from the center point coordinates to the top left corner coordinates; then, obtain each curve telemetry associated in the dynamic attribute of the curve type JSON node, and based on the curve color attribute of the curve type JSON node, convert the name and color attributes of the curve type JSON node into the corresponding TmPara node in XML; based on the relation mapping dictionary, determine the XML telemetry code corresponding to the curve type JSON node, and mark the Name attribute of the curve type JSON node with the telemetry code, thereby realizing the conversion of the curve type JSON node into a Chart tag node in XML.
[0051] In this embodiment, the curve is a curve describing the change of telemetry parameters over time in the aerospace system.
[0052] The first conversion submodule is used to traverse the entire JSON document, perform corresponding processing according to the type of telemetry nodes in the JSON document, and complete the node conversion; mount the converted Label nodes and / or Chart nodes to the Page nodes of the XML tree, mount the Page nodes to the Satellite nodes of the XML tree, and write the XML tree to a file to form an XML telemetry page document.
[0053] This invention determines whether to convert a JSON node to an XML tag based on its attributes. It then converts the JSON node attribute format to the XML tag attribute format through steps such as font format conversion, color format conversion, coordinate position conversion, and telemetry code query and replacement, thus realizing the conversion from node to tag. After that, it iterates through the JSON nodes and converts them to XML tags without error, thus realizing the conversion of JSON format files to XML format files.
[0054] Furthermore, the XML to JSON module includes a tag to text node submodule, a tag to curve node submodule, and a second conversion submodule.
[0055] The tag-to-text node submodule is used to extract Label tags from XML documents. For each Label tag, the following operations are performed: A JSON text node corresponding to the Label tag is created; the position information in the Label tag is converted from the top-left corner coordinates to the center point coordinates, and then converted into the position attribute of the corresponding JSON text node in the JSON document; the size information in the Label tag is converted into a string, with `width` as the width attribute and `height` as the height attribute of the corresponding JSON text node in the JSON document; the font color, background color, text information, and font size in the Label tag are converted into node attributes of the corresponding JSON text node after string processing; based on the relational mapping dictionary, the telemetry code of the JSON document corresponding to the Label tag is determined, and the `value` attribute of the corresponding JSON text node is marked with the telemetry code.
[0056] The tag-to-curve node submodule is used to extract Chart tags from XML documents. For each Chart tag, the following operations are performed: A corresponding JSON text node is created; the position information in the Chart tag is converted from the top-left corner coordinates to the center point coordinates, and then converted into the position attribute of the corresponding JSON text node; the size information in the Chart tag is split into strings, with `width` used as the width attribute and `height` used as the height attribute of the corresponding JSON text node; the font color, background color, text information, and font size in the Chart tag are processed into the node attributes of the corresponding JSON text node; the child tags TmPara of the Chart tag are traversed, and the `name` attribute of each TmPara tag is extracted to form the `dynamic` attribute of the corresponding JSON text node; and based on the relational mapping dictionary, the telemetry code of the JSON document corresponding to each TmPara is determined, and the `value` attribute in the `dynamic` attribute is marked as the telemetry code.
[0057] The second conversion submodule is used to traverse the entire XML document, process the tag types of each child node under the Page node according to the XML tree structure, and add the converted nodes to the JSON document to form a JSON telemetry page document.
[0058] This invention converts XML format files into JSON format files based on tag attributes through reverse conversion of font, color, and coordinates, as well as steps such as querying and replacing telemetry codes and bound parameters.
[0059] The Excel to XML module includes a conversion target determination submodule, a Label conversion submodule, and a Chart conversion submodule.
[0060] The conversion target determination submodule is used to read the Excel file to be processed and determine the conversion target as a Label page or a Chart page based on the name of each sheet in the Excel file. The sheet name is either to be converted to an XML page with Label as the main body or to be converted to an XML page with Chart as the main body.
[0061] The Convert Label submodule is used to read the length of each row of string data in the Excel file, determine whether the row is a title row or a data row, combine the data rows, merge the telemetry name and telemetry code, generate an XmlLabel tag from the combined data row and assign default values to the relevant attributes; convert all the titles and combined data rows in the Excel file into corresponding Label tags and mount them in the XML tree to generate an XML document.
[0062] The Chart conversion submodule creates an array, where each element stores all curves in each image; it determines the telemetry code for each curve, assigns a color value to each curve, converts the entire image into a Chart tag, converts each curve into a TmPara tag, and attaches the TmPara tags under the Chart tag, which in turn attaches the Chart tag under the Page tag to generate an XML document.
[0063] In this invention, the Pandas library is used to read Excel files. First, the names of each worksheet in the entire workbook are obtained. Based on the names, a processing function is selected to generate the corresponding Label page file or Chart page.
[0064] If the page needs to be converted into a Label page, due to the format layout, the length of the Pandas data array corresponding to the page title row is smaller than that of other data rows. This invention removes the automatically padded NaN after the data is read, thereby changing the length of the read data row. Based on the length of each row, it is possible to quickly determine whether the attribute of the row is a title row or a data row. Default attributes can be assigned to the length of each data row to generate the corresponding "Label" tag, and further generate an XML file.
[0065] If this page needs to be converted into a Chart page, the entire Array needs to be traversed. The number of images and the number of curves in each image are determined by the "curve name" identifier. The layout is then determined based on the number of images. Next, the colors of each curve in each image are determined sequentially according to the color dictionary, generating a new Array. Each image is itself an Array containing several dictionaries. Each dictionary uses "Code" as the key and the curve telemetry code as the value, and "lineColor" as the key and the curve color as the value, recording the code and color of each curve in the image. This generates the corresponding "Chart" and "TmPara" tags, which are then used to generate an XML file.
[0066] In this invention, the Excel to XML converter uses the page layout designed in the Excel file, combined with different styles of header rows, data rows, free rows and curves, to determine the label position and other attributes according to the layout, and sets other attributes to default values, thereby converting the Excel file into an XML file.
[0067] The inputs to this invention are a telemetry list file and a telemetry page file to be converted. The data preparation module processes the data to generate a relational mapping dictionary. Based on the telemetry page file to be converted, the corresponding processing module is called according to the file type, and the relational mapping dictionary and... Figure 2-8The processing flow generates corresponding output files. This invention converts input JSON files into XML files, XML files into JSON files, and Excel spreadsheet files into XML files.
[0068] The specific embodiments described above only illustrate the design principles of the present invention. The shapes and names of the components in this description may differ and are not limited. Therefore, those skilled in the art can modify or make equivalent substitutions to the technical solutions described in the foregoing embodiments; and these modifications and substitutions do not depart from the inventive spirit and technical solutions of the present invention, and should all fall within the protection scope of the present invention.
Claims
1. A Python-based telemetry page format conversion system, comprising: The system comprises: a data preparation module, a Json-to-Xml module, an Xml-to-Json module, and an Excel-to-Xml module; The data preparation module is configured to establish a telemetry parameter attribute relationship mapping dictionary of a test system and an operation and management system for a satellite model based on the satellite model, telemetry parameter attributes corresponding to the satellite model in the test system, and telemetry parameter attributes corresponding to the satellite model in the operation and management system; obtain a telemetry page to be converted; parse telemetry parameter attributes in the telemetry page; determine a code format and a conversion mode of the telemetry parameter attributes; trigger one of the Json-to-Xml module, the Xml-to-Json module, and the Excel-to-Xml module based on the conversion mode; and convert the telemetry page to be converted. The Json-to-Xml module comprises a curve node processing submodule and a first conversion submodule. The curve node processing submodule is configured to obtain a Json node of a curve type; obtain a curve image position and an image size of the Json node; convert the curve image position and the image size from a center point coordinate to a top-left corner coordinate; obtain each curve telemetry associated in a dynamic attribute of the Json node of the curve type; convert a name and a color attribute of the Json node of the curve type into a TmPara node in corresponding Xml based on a curve color attribute of the Json node of the curve type; determine an Xml telemetry code corresponding to the Json node of the curve type based on the relationship mapping dictionary; mark a Name attribute of the Json node of the curve type as the telemetry code; and convert the Json node of the curve type into a Chart label node in the Xml. The first conversion submodule is configured to traverse an entire Json document; perform corresponding processing according to a type of a telemetry node of the Json document; complete conversion of the node; mount a converted Label node and / or Chart node to a Page node of an Xml tree; mount the Page node to a Satellite node of the Xml tree; write the Xml tree into a file; and form an Xml telemetry page document. 2. The system of claim 1, wherein, The Json-to-Xml module is configured to, when the conversion mode is Json-to-Xml, find all telemetry nodes in the telemetry page to be converted, each of which is a Json node, and each of which is taken as a first to-be-processed conversion object. For each telemetry node, the following operations are performed: based on the relationship mapping dictionary, an Xml telemetry code corresponding to the first to-be-processed conversion object is determined, based on the Xml telemetry code, a telemetry parameter attribute that needs to be converted and processed by the first to-be-processed conversion object is determined, and the telemetry parameter attribute is converted and processed; the first to-be-processed conversion object after conversion processing calls a conversion function to obtain an Xml telemetry label, a label attribute is added to the Xml telemetry label to obtain a converted node, and the converted node is mounted into an Xml tree structure; the telemetry parameter attribute includes font size, background color, position, border, and font shape, and the telemetry parameter attribute that needs to be converted and processed is a subset of the telemetry parameter attribute.
3. The system of claim 1, wherein, The Xml-to-Json module is configured to, when the conversion mode is Xml-to-Json, query each leaf node based on the tree structure of the Xml tree. Each leaf node is taken as a second to-be-processed conversion object. For each second to-be-processed conversion object, the following operations are performed: the label attribute, telemetry code, and related attribute of the second to-be-processed conversion object are extracted, based on the relationship mapping dictionary, a Json telemetry code corresponding to the second to-be-processed conversion object is determined, based on the Json telemetry code, a telemetry parameter attribute that needs to be converted and processed by the second to-be-processed conversion object is determined, and the telemetry parameter attribute is converted and processed; the to-be-processed conversion object after conversion processing calls a conversion function to obtain a Json telemetry structure, a label attribute is added to the Json telemetry structure to obtain a Json telemetry node, and the Json telemetry node is written into a Json file; the telemetry parameter attribute includes font size, background color, and position, and the telemetry parameter attribute that needs to be converted and processed is a subset of the telemetry parameter attribute.
4. The system of claim 1, wherein, The Excel-to-Xml module is configured to, when the conversion mode is Excel-to-Xml, find telemetry codes and telemetry names in an Excel telemetry page document, take a page template in an entire sheet as a third to-be-processed conversion object, determine a conversion target to be a Label page or a Chart page based on a sheet name of the third to-be-processed conversion object, and perform conversion from an Excel format to an Xml format based on a page layout of the Excel telemetry page document and the conversion target.
5. The system of any one of claims 1-4, wherein, The Json-to-Xml module further includes a text node processing submodule. The text node processing submodule is configured to obtain a Json node with a text type attribute, and for a text type Json node with a border picture area, obtain a position, a size, a background color, a font, a font size, and a border color attribute of the Json node, convert the Json node into a Label node in an Xml file, and the Label node is a converted node; for a text type Json node with a background picture, set a Type attribute of a converted node corresponding to the Json node to text, obtain a position, a size, a background color, a font color, a font, and a font size attribute of the Json node, convert the Json node into a Label node in an Xml file, and the Label node is a converted node; for a dynamic text type Json node, obtain a position, a size, a background color, a font color, a font, and a border color attribute of the Json node, set a Type attribute of a converted node corresponding to the Json node to tm, and convert the Json node into a corresponding Label node, and the Label node is a converted node.
6. The system of any one of claims 1-4, wherein, The Xml conversion Json module includes a label conversion text node submodule, a label conversion curve node submodule, and a second conversion submodule; The label conversion text node submodule is configured to extract a Label tag in an Xml document, and for each Label tag, the following operations are performed: establishing a Json text node corresponding to the Label tag, converting position information in the Label tag into a center point coordinate through a top-left corner coordinate, and converting the position information into a position attribute of the corresponding Json text node in a Json document; converting size information in the Label tag into a string, taking width as a width attribute of the corresponding Json text node in the Json document, and taking height as a height attribute of the corresponding Json text node in the Json document; converting font color, background color, text information, and font size in the Label tag into a string, and converting the font color, the background color, the text information, and the font size into node attributes of the Json text node corresponding to the Label tag; Based on the relationship mapping dictionary, a telemetry code of a Json document corresponding to the Label tag is determined, and a value attribute of the corresponding Json text node is marked as the telemetry code; and The second conversion submodule is configured to obtain a Label tag in an Xml document, and for each Label tag, the following operations are performed: establishing a Json curve node corresponding to the Label tag, converting position information in the Label tag into a center point coordinate through a top-left corner coordinate, and converting the position information into a position attribute of the corresponding Json curve node in a Json document; converting size information in the Label tag into a string, taking width as a width attribute of the corresponding Json curve node in the Json document, and taking height as a height attribute of the corresponding Json curve node in the Json document; converting font color, background color, text information, and font size in the Label tag into a string, and converting the font color, the background color, the text information, and the font size into node attributes of the Json curve node corresponding to the Label tag; and based on the relationship mapping dictionary, a telemetry code of a Json document corresponding to the Label tag is determined, and a value attribute of the corresponding Json curve node is marked as the telemetry code. The label conversion curve node submodule is configured to extract Chart labels in an Xml document, and for each Chart label, the following operations are performed: a Json text node corresponding to the Chart label is established, position information in the Chart label is converted from upper-left corner coordinates to center point coordinates and processed to be a position attribute of the corresponding Json text node; size information in the Chart label is processed by splitting a string, width is taken as a width attribute of the corresponding Json text node, and height is taken as a height attribute of the corresponding Json text node; font color, background color, text information, and font size in the Chart label are processed by string processing and converted to node attributes of the corresponding Json text node; sub-labels TmPara of the Chart label are iterated, a name attribute of each TmPara label is extracted, and the name attribute is combined to form a dynamic attribute of the corresponding Json text node; and based on a relationship mapping dictionary, a telemetry code of a Json document corresponding to each TmPara is determined, and a value attribute in the dynamic attribute is marked as the telemetry code; The second conversion submodule is configured to traverse the entire Xml document, and according to an Xml tree structure, the label types of the subnodes under a Page node are processed correspondingly; the converted nodes are added to a Json document to form a Json telemetry page document.
7. The system of any one of claims 1-4, wherein, The Excel conversion Xml module includes a conversion target determination submodule, a Label conversion submodule, and a Chart conversion submodule. The conversion target determination submodule is configured to read an Excel file to be processed, and determine a conversion target as a Label page or a Chart page based on the names of sheets in the Excel file, wherein a sheet name is used to determine whether to convert an Xml page mainly including Label or an Xml page mainly including Chart; The Label conversion submodule is configured to read the length of each row of string data in the Excel file, determine whether the row is a title row or a data row, combine the data rows, merge a telemetry name and a telemetry code, generate an Xml Label label from the combined data row, and assign a default value to a related attribute; all the title rows and the combined data rows in the Excel file are converted into corresponding Label labels, and are mounted in an Xml tree to generate an Xml document; The Chart conversion submodule establishes an array, each element in the array is configured to store all curves in each image, determines a telemetry code of each curve, assigns a color to each curve, converts the entire image into a Chart label, converts each curve into a TmPara label, and mounts the TmPara labels under the Chart label and the Chart label under a Page label to generate an Xml document.
Citation Information
Patent Citations
File format conversion method and device, computer equipment and storage medium
CN111858472A
Network communication encoding and decoding engine method for satellite receiving system based on XML and JSON
CN112612535A