CN116257656A - Python-based telemetry page format conversion system - Google Patents

Python-based telemetry page format conversion system Download PDF

Info

Publication number
CN116257656A
CN116257656A CN202211496303.8A CN202211496303A CN116257656A CN 116257656 A CN116257656 A CN 116257656A CN 202211496303 A CN202211496303 A CN 202211496303A CN 116257656 A CN116257656 A CN 116257656A
Authority
CN
China
Prior art keywords
json
node
telemetry
xml
label
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211496303.8A
Other languages
Chinese (zh)
Inventor
曲晓宇
丁意桐
梁健
李硕
矫轲
张田青
何林璐
许凯航
邓玥
周希睿
成明辉
吴萍萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Academy of Space Technology CAST
Original Assignee
China Academy of Space Technology CAST
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Academy of Space Technology CAST filed Critical China Academy of Space Technology CAST
Priority to CN202211496303.8A priority Critical patent/CN116257656A/en
Publication of CN116257656A publication Critical patent/CN116257656A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/83Querying
    • G06F16/835Query processing
    • G06F16/8358Query translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a telemetry page format conversion system based on Python, which comprises: data preparation module, json to Xml module, xml to Json module, excel to Xml module. The data preparation module is used for establishing a telemetry parameter attribute relation mapping dictionary of the test system and the fortune pipe system on the basis of the satellite model, based on telemetry parameter attributes corresponding to the satellite model in the test system and telemetry parameter attributes corresponding to the satellite model in the fortune pipe system; acquiring a telemetry page to be converted, analyzing telemetry parameter attributes in the telemetry page, and determining a code format and a conversion mode of the telemetry parameter attributes; and based on the conversion mode, triggering one of a Json-to-Xml module, an Xml-to-Json module and an Excel-to-Xml module, and converting the telemetry page to be converted. The conversion system greatly reduces the design burden of the telemetry page user and improves the design, editing and using efficiency of the telemetry page.

Description

Python-based telemetry page format conversion system
Technical Field
The invention relates to the technical field of information processing, in particular to a telemetry page format conversion system based on Python.
Background
In the comprehensive satellite testing and operation management stage, testing and management personnel need to judge satellite states and develop various satellite tasks by means of various telemetry of satellites, so as to facilitate monitoring of ground personnel, various telemetry is usually combined according to the needs of various subsystems at present, and telemetry pages are drawn in the system to display various telemetry conditions in real time.
In the comprehensive test stage, as the whole satellite state is gradually provided, the functions of each subsystem are gradually perfected, and the telemetry page is gradually cured and completed; after entering the pipe transporting stage, the satellite state is often required to be monitored by using telemetry pages formed in the testing stage, but the two systems are different in the mode of recording the telemetry pages, the Json format file is used by the testing system, the Xml format file is used by the pipe transporting system, and the object attribute is also greatly different, so that the interconnection and intercommunication of the telemetry pages between the two systems cannot be realized, and a designer needs to repeatedly design the same telemetry page in the two systems, so that great workload is brought.
Disclosure of Invention
In view of the above, the invention provides a telemetry page format conversion system based on Python, which can solve the technical problem that telemetry page formats among different systems in the prior art are not uniform and a page needs to be repeatedly designed for a plurality of times.
The present invention is so implemented as to solve the above-mentioned technical problems.
A Python-based telemetry page format conversion system, comprising:
data preparation module, json to Xml module, xml to Json module, excel to Xml module.
The data preparation module is used for establishing a telemetry parameter attribute relation mapping dictionary of the test system and the fortune pipe system on the basis of the satellite model, based on telemetry parameter attributes corresponding to the satellite model in the test system and telemetry parameter attributes corresponding to the satellite model in the fortune pipe system; acquiring a telemetry page to be converted, analyzing telemetry parameter attributes in the telemetry page, and determining a code format and a conversion mode of the telemetry parameter attributes;
and based on the conversion mode, triggering one of a Json-to-Xml module, an Xml-to-Json module and an Excel-to-Xml module, and converting the telemetry page to be converted.
Preferably, the Json-to-Xml module is configured to find all telemetry nodes in the telemetry page to be converted when the conversion mode is Json format-to-Xml format, where each telemetry node is a Json node, each telemetry node is a first conversion object to be processed, and perform the following operations on each telemetry node: determining an Xml telemetry code number corresponding to the first to-be-processed conversion object based on the relation mapping dictionary, determining telemetry parameter attributes of the first to-be-processed conversion object to be converted based on the Xml telemetry code number, and converting the telemetry parameter attributes to be converted; transferring a conversion function by the first to-be-processed conversion object after conversion processing to obtain an Xml telemetry label, adding a label attribute to the Xml telemetry label to obtain a converted node, and mounting the converted node into an Xml tree structure; the telemetry parameter attributes comprise word sizes, base colors, positions, frames and fonts, and the telemetry parameter attributes to be converted are subsets of the telemetry parameter attributes.
Preferably, the Xml-to-Json module is configured to query each leaf node based on the tree structure of the Xml tree when the conversion mode is Xml format to Json format; each leaf node is used as a second to-be-processed conversion object, and the following operations are executed on each second to-be-processed conversion object: extracting a label attribute, a telemetry code and a related attribute of the second to-be-processed conversion object, determining a Json telemetry code corresponding to the second to-be-processed conversion object based on the relation mapping dictionary, determining a telemetry parameter attribute of the second to-be-processed conversion object to be converted based on the Json telemetry code, and converting the telemetry parameter attribute to be converted; calling a conversion function by the converted object to be processed after conversion processing to obtain a Json telemetry structure, adding a tag attribute 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 comprise word size, ground color and position, and the telemetry parameter attributes to be converted are subsets of the telemetry parameter attributes.
Preferably, the Excel-to-Xml module is configured to search for a telemetry code and a telemetry name in an Excel telemetry page document when the conversion mode is an Excel format-to-Xml format, take a page template in the entire Sheet as a third to-be-processed conversion object, and determine that the conversion target is a Label page or a Chart page based on the Sheet name of the third to-be-processed conversion object; and converting the Excel format into the Xml format based on the page layout of the Excel document and the conversion target.
Preferably, the Json-to-Xml module comprises a text node processing sub-module, a curve node processing sub-module and a first conversion sub-module;
the text node processing submodule is used for acquiring Json nodes with the attribute of text type, acquiring the color attribute of the positions, the sizes, the background colors, the fonts and the word sizes of the Json nodes for the Json nodes with the text type of the graphic area with the frame, converting the Json nodes into Label nodes in an Xml file, wherein the Label nodes are converted nodes; setting the Type attribute of a converted node corresponding to a Json node as text for the Json node of the text Type with the base map, acquiring the position, size, background color, font shape and font size attribute of the Json node, converting the Json node into a Label node in an Xml file, wherein the Label node is the converted node; for a Json node of a dynamic text Type, acquiring the position, the size, the background color, the font shape and the frame color attribute of the Json node, setting the Type attribute of the converted node corresponding to the Json node as tm, converting the Json node into a corresponding Label node, wherein the Label node is the converted node;
the curve node processing submodule is used for acquiring a Json node with a curve type attribute, acquiring a curve image position and an image size of the Json node, and converting the curve image position and the image size from a center point coordinate to an upper left corner coordinate; acquiring each curve telemetry associated with the dynamic attribute of the Json node of the curve type, and converting the name and the color attribute of the Json node of the curve type into a TmPa node in corresponding Xml based on the curve color attribute of the Json node of the curve type; based on the relation mapping dictionary, determining an Xml telemetry code number corresponding to the Json node of the curve type, and marking the Name attribute of the Json node of the curve type as the telemetry code number to realize the conversion of the Json node of the curve type into a Chart label node in the Xml;
the first conversion sub-module is used for traversing the whole Json document, carrying out corresponding processing according to the type of the telemetry node of the Json document, and completing the conversion of the node; and mounting the converted Label node and/or Chart node under the Page node of the Xml tree, mounting the Page node under the Satellite node of the Xml tree, and writing the Xml tree into a file to form an Xml telemetry Page document.
Preferably, the Xml-to-Json module includes a label-to-text node sub-module, a label-to-curve node sub-module, and a second conversion sub-module;
the Label-to-text node sub-module is used for extracting Label labels in an Xml document, and for each Label, the following operations are executed: establishing a Json text node corresponding to the Label Label, converting the position information in the Label Label into a central point coordinate through upper left corner coordinates, and converting the central point coordinate into a position attribute of the corresponding Json text node in the Json document; converting the size information in the Label Label into character strings for processing, wherein width is used as the wide attribute of the corresponding Json text node in the Json document, and height is used as the high attribute of the corresponding Json text node in the Json document; processing the font color, background color, text information and font size in the Label Label by character strings, and converting the font color, background color, text information and font size into node attributes of the Json text nodes corresponding to the Label Label; determining a telemetry code number of the Json document corresponding to the Label tag based on the relation mapping dictionary, and marking the value attribute of the corresponding Json text node as the telemetry code number;
the label transfer curve node submodule is used for extracting Chart labels in the Xml document, and for each Chart label, the following operations are executed: establishing a Json text node corresponding to the Chart label, converting the position information in the Chart label into a central point coordinate through upper left corner coordinates, and converting the central point coordinate into the position attribute of the corresponding Json text node; the size information in the Chart label is subjected to splitting character string processing, width is used as the wide attribute of the corresponding Json text node, and height is used as the high attribute of the corresponding Json text node; converting the font color, background color, text information and font size in the Chart label into node attributes of the corresponding Json text nodes through character string processing; traversing sub-tags TmPara of the Chart tags, extracting a name attribute of each TmPara tag, and forming a corresponding Json text node dynamic attribute; determining a telemetry code number of the Json document corresponding to each TmPa based on the relation mapping dictionary, and marking a value attribute in the dynamic attribute as the telemetry code number;
the second conversion sub-module is used for traversing the whole Xml document, and carrying out corresponding processing on the label types of all sub-nodes under the Page node according to the Xml tree structure; and adding the converted nodes to a Json document to form a Json telemetry page document.
Preferably, the Excel-to-Xml module comprises a conversion target determination sub-module, a conversion Label sub-module and a conversion Chart sub-module;
the conversion target determining submodule is used for reading the Excel file to be processed, determining that a conversion target is a Label page or a Chart page based on the names of sheets in the Excel file, and converting the names of sheets into an Xml page taking Label as a main body or an Xml page taking Chart as a main body;
the Label conversion submodule is used for reading the length of each row of character string data in the Excel file, determining the row of the row title or the row of the data, combining the data lines, combining the telemetry names and telemetry codes, generating an XmlLabel tag by the combined data lines, and assigning a default value to the related attribute; all the titles and the combined data lines in the Excel file are converted into corresponding Label tags, and the corresponding Label tags are mounted in an Xml tree to generate an Xml document;
the Chart conversion sub-module establishes an array, and each element in the array is used for storing all curves in each image respectively; determining a telemetry code of each curve, assigning a value to the color of each curve, converting the whole image into Chart labels, converting each curve into TmPa labels, and mounting the TmPa labels under the Chart labels, wherein the Chart labels are mounted under Page labels to generate the Xml document.
The beneficial effects are that:
according to the invention, an Xml format telemetry page protocol is taken as a core, a mutual conversion program between a Json format telemetry page and an Xml format page file is developed based on a Python language, an Excel file to Xml format file conversion program is developed, the mutual conversion of the Excel file, the Json file and the Xml file is realized by taking the Xml format telemetry page file as a medium, a page transmission channel among a designer, a testing system and a transportation system is established, and one telemetry page is designed to be used for previewing and editing in a plurality of systems.
The method has the following technical effects:
(1) The invention greatly reduces the design burden of telemetry page users, improves the design, editing and using efficiency of telemetry pages, and realizes the transmission flow of one telemetry page among different systems.
(2) The invention enables telemetry page designers to lay out basic telemetry page boards through Excel files without prior design in each system. The base plate telemetry page file can be generated in large quantity by simply editing the Excel file.
(3) After a designer designs, previews and modifies the telemetry page in a certain system, the telemetry page file applicable to other systems can be generated through the page conversion tool without the need of carrying out the same design and modification in other systems again.
(4) The invention has simple realization and high conversion efficiency.
(5) The invention saves labor.
Drawings
Fig. 1 is a schematic diagram of a telemetry page format conversion system based on Python according to the present invention.
Fig. 2 is a schematic diagram of converting text nodes in a Json file into Label tags according to the present invention.
Fig. 3 is a schematic diagram of converting a curve node in a Json file into a Chart label according to the present invention.
Fig. 4 is a schematic diagram of the conversion of Json file into Xml file according to the present invention.
Fig. 5 is a schematic diagram of conversion of Label tags in Xml files provided by the present invention into text nodes.
Fig. 6 is a schematic diagram of converting a Chart tag in an Xml file provided by the present invention into a curve node.
Fig. 7 is a schematic diagram of the conversion of Xml files into Json files provided by the present invention.
Fig. 8 is a schematic diagram of conversion of an Excel file provided by the present invention into an Xml file.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings and examples.
As shown in fig. 1, the present invention proposes a telemetry page format conversion system based on Python, comprising: data preparation module, json to Xml module, xml to Json module, excel to Xml module.
The data preparation module is used for establishing a telemetry parameter attribute relation mapping dictionary of the test system and the fortune pipe system on the basis of the satellite model, based on telemetry parameter attributes corresponding to the satellite model in the test system and telemetry parameter attributes corresponding to the satellite model in the fortune pipe system; acquiring a telemetry page to be converted, analyzing telemetry parameter attributes in the telemetry page, and determining a code format and a conversion mode of the telemetry parameter attributes;
and based on the conversion mode, triggering one of a Json-to-Xml module, an Xml-to-Json module and an Excel-to-Xml module, and converting the telemetry page to be converted.
The Json-to-Xml module is used for searching all telemetry nodes in the telemetry page to be converted when the conversion mode is Json format-to-Xml format, each telemetry node is a Json node, each telemetry node is used as a first conversion object to be processed, and the following operations are executed for each telemetry node: determining an Xml telemetry code number corresponding to the first to-be-processed conversion object based on the relation mapping dictionary, determining telemetry parameter attributes of the first to-be-processed conversion object to be converted based on the Xml telemetry code number, and converting the telemetry parameter attributes to be converted; transferring a conversion function by the first to-be-processed conversion object after conversion processing to obtain an Xml telemetry label, adding a label attribute to the Xml telemetry label to obtain a converted node, and mounting the converted node into an Xml tree structure; the telemetry parameter attributes comprise word sizes, base colors, positions, frames and fonts, and the telemetry parameter attributes to be converted are subsets of the telemetry parameter attributes.
The Xml-to-Json module is used for inquiring each leaf node based on the tree structure of the Xml tree when the conversion mode is that the Xml format is converted into the Json format; each leaf node is used as a second to-be-processed conversion object, and the following operations are executed on each second to-be-processed conversion object: extracting a label attribute, a telemetry code and a related attribute of the second to-be-processed conversion object, determining a Json telemetry code corresponding to the second to-be-processed conversion object based on the relation mapping dictionary, determining a telemetry parameter attribute of the second to-be-processed conversion object to be converted based on the Json telemetry code, and converting the telemetry parameter attribute to be converted; calling a conversion function by the converted object to be processed after conversion processing to obtain a Json telemetry structure, adding a tag attribute 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 comprise word size, ground color and position, and the telemetry parameter attributes to be converted are subsets of the telemetry parameter attributes.
The Excel-to-Xml module is used for searching a telemetry code and a telemetry name in an Excel telemetry page document when the conversion mode is that an Excel format is converted into an Xml format, taking a page template in the whole Sheet as a third to-be-processed conversion object, and determining that a conversion target is a Label page or a Chart page based on the Sheet name of the third to-be-processed conversion object; and converting the Excel format into the Xml format based on the page layout of the Excel document and the conversion target.
Further, the Json-to-Xml module comprises a text node processing sub-module, a curve node processing sub-module and a first conversion sub-module.
The text node processing submodule is used for acquiring Json nodes with the attribute of text type, acquiring the color attribute of the positions, the sizes, the background colors, the fonts and the word sizes of the Json nodes for the Json nodes with the text type of the graphic area with the frame, converting the Json nodes into Label nodes in an Xml file, wherein the Label nodes are converted nodes; setting the Type attribute of a converted node corresponding to a Json node as text for the Json node of the text Type with the base map, acquiring the position, size, background color, font shape and font size attribute of the Json node, converting the Json node into a Label node in an Xml file, wherein the Label node is the converted node; and for the Json node of the dynamic text Type, acquiring the position, the size, the background color, the font shape and the frame color attribute of the Json node, setting the Type attribute of the converted node corresponding to the Json node as tm, converting the Json node into a corresponding Label node, wherein the Label node is the converted node.
The curve node processing submodule is used for acquiring a Json node with a curve type attribute, acquiring a curve image position and an image size of the Json node, and converting the curve image position and the image size from a center point coordinate to an upper left corner coordinate; acquiring each curve telemetry associated with the dynamic attribute of the Json node of the curve type, and converting the name and the color attribute of the Json node of the curve type into a TmPa node in corresponding Xml based on the curve color attribute of the Json node of the curve type; based on the relation mapping dictionary, determining an Xml telemetry code number corresponding to the Json node of the curve type, and marking the Name attribute of the Json node of the curve type as the telemetry code number to realize conversion of the Json node of the curve type into a Chart label node in the Xml.
In this embodiment, the curve is a curve formed by a time-dependent change of a description telemetry parameter in an aerospace system.
The first conversion sub-module is used for traversing the whole Json document, carrying out corresponding processing according to the type of the telemetry node of the Json document, and completing the conversion of the node; and mounting the converted Label node and/or Chart node under the Page node of the Xml tree, mounting the Page node under the Satellite node of the Xml tree, and writing the Xml tree into a file to form an Xml telemetry Page document.
According to the method, whether the Json node attribute is converted into an Xml label is judged according to the Json node attribute, the Json node attribute format is converted into the Xml label attribute format through the steps of font format conversion, color format conversion, coordinate position conversion, remote measurement code query substitution and the like, so that the conversion of the node into the label is realized, and then the Json node is traversed to be converted into the Xml label without difference, so that the Json format file is converted into the Xml format file.
Further, the Xml-to-Json module includes a label-to-text node sub-module, a label-to-curve node sub-module, and a second conversion sub-module.
The Label-to-text node sub-module is used for extracting Label labels in an Xml document, and for each Label, the following operations are executed: establishing a Json text node corresponding to the Label Label, converting the position information in the Label Label into a central point coordinate through upper left corner coordinates, and converting the central point coordinate into a position attribute of the corresponding Json text node in the Json document; converting the size information in the Label Label into character strings for processing, wherein width is used as the wide attribute of the corresponding Json text node in the Json document, and height is used as the high attribute of the corresponding Json text node in the Json document; processing the font color, background color, text information and font size in the Label Label by character strings, and converting the font color, background color, text information and font size into node attributes of the Json text nodes corresponding to the Label Label; and determining a telemetry code number of the Json document corresponding to the Label tag based on the relation mapping dictionary, and marking the value attribute of the corresponding Json text node as the telemetry code number.
The label transfer curve node submodule is used for extracting Chart labels in the Xml document, and for each Chart label, the following operations are executed: establishing a Json text node corresponding to the Chart label, converting the position information in the Chart label into a central point coordinate through upper left corner coordinates, and converting the central point coordinate into the position attribute of the corresponding Json text node; the size information in the Chart label is subjected to splitting character string processing, width is used as the wide attribute of the corresponding Json text node, and height is used as the high attribute of the corresponding Json text node; converting the font color, background color, text information and font size in the Chart label into node attributes of the corresponding Json text nodes through character string processing; traversing sub-tags TmPara of the Chart tags, extracting a name attribute of each TmPara tag, and forming a corresponding Json text node dynamic attribute; and determining the telemetry code number of the Json document corresponding to each TmPa based on the relation mapping dictionary, and marking the value attribute in the dynamic attribute as the telemetry code number.
The second conversion sub-module is used for traversing the whole Xml document, and carrying out corresponding processing on the label types of all sub-nodes under the Page node according to the Xml tree structure; and adding the converted nodes to a Json document to form a Json telemetry page document.
According to the label attribute, the Xml format file is converted into the Json format file through the steps of reverse conversion of the font, the color and the coordinates, inquiring the replacement telemetry code, the binding parameters and the like.
The Excel-to-Xml module comprises a conversion target determination sub-module, a conversion Label sub-module and a conversion Chart sub-module.
The conversion target determining submodule is used for reading the Excel file to be processed, determining that the conversion target is Label page or Chart page based on the names of the sheets in the Excel file, and converting the names of the sheets into Xml pages taking Label as a main body or into Xml pages taking Chart as a main body.
The Label conversion submodule is used for reading the length of each row of character string data in the Excel file, determining the row of the row title or the row of the data, combining the data lines, combining the telemetry names and telemetry codes, generating an XmlLabel tag by the combined data lines, and assigning a default value to the related attribute; and converting all the titles and the combined data lines in the Excel file into corresponding Label tags, and mounting the corresponding Label tags in an Xml tree to generate an Xml document.
The Chart conversion sub-module establishes an array, and each element in the array is used for storing all curves in each image respectively; determining a telemetry code of each curve, assigning a value to the color of each curve, converting the whole image into Chart labels, converting each curve into TmPa labels, and mounting the TmPa labels under the Chart labels, wherein the Chart labels are mounted under Page labels to generate the Xml document.
In the invention, an Excel file is read by using a Pandas library, names of worksheets of the whole workbook are firstly obtained, a processing function is selected according to the names, and a corresponding Label page file or Chart page is generated.
If the page needs to be converted into a Label page, and the Pandas data Array length corresponding to the page header line is smaller than other data lines due to the format layout.
If the page is required to be converted into a Chart page, the whole Array is required to be traversed, the number of page images and the number of curves in each picture are determined by dividing according to the mark of the curve name, the layout mode is determined according to the number of images, and then the colors of the curves in each picture are sequentially determined according to the color sequence in the color dictionary, so that a new Array is generated. Each image is an Array, and comprises a plurality of dictionaries, each dictionary takes a Code as a Key, a curve telemetry Code number as a value, a lineColor as a Key, and a curve color as a value, and the Code number and the color of each curve in the image are recorded, so that a corresponding Chart label and a corresponding TmPaa label are generated, and an Xml file is further generated.
According to the invention, the Excel-to-Xml module determines the label position and other attributes according to typesetting forms by combining different styles of a header line, a data line, an idle line and a curve according to a page plate designed in an Excel file, and sets other attributes as default values, so that the Excel file is converted into the Xml file.
The input of the invention is a telemetry list file and a telemetry page file to be converted, and a relation mapping dictionary is generated through the processing of a data preparation module; based on the telemetry page file to be converted, a corresponding processing module is called according to the file type, and a corresponding output file is generated based on the relation mapping dictionary and the processing flows of fig. 2-8. The invention converts the input Json file into an Xml file, converts the Xml file into a Json file, and converts the Excel table file into an Xml file.
The above specific embodiments merely describe the design principle of the present invention, and the shapes of the components in the description may be different, and the names are not limited. Therefore, the technical scheme described in the foregoing embodiments can be modified or replaced equivalently by those skilled in the art; such modifications and substitutions do not depart from the spirit and technical scope of the invention, and all of them should be considered to fall within the scope of the invention.

Claims (7)

1. A Python-based telemetry page format conversion system, the system comprising:
data preparation module, json to Xml module, xml to Json module, excel to Xml module.
The data preparation module is used for establishing a telemetry parameter attribute relation mapping dictionary of the test system and the fortune pipe system on the basis of the satellite model, based on telemetry parameter attributes corresponding to the satellite model in the test system and telemetry parameter attributes corresponding to the satellite model in the fortune pipe system; acquiring a telemetry page to be converted, analyzing telemetry parameter attributes in the telemetry page, and determining a code format and a conversion mode of the telemetry parameter attributes;
and based on the conversion mode, triggering one of a Json-to-Xml module, an Xml-to-Json module and an Excel-to-Xml module, and converting the telemetry page to be converted.
2. The system of claim 1, wherein the Json-to-Xml module is configured to find all telemetry nodes in the telemetry page to be converted when the conversion mode is Json-to-Xml, each telemetry node being a Json node, each telemetry node being a first object to be converted, and to perform the following operations for each telemetry node: determining an Xml telemetry code number corresponding to the first to-be-processed conversion object based on the relation mapping dictionary, determining telemetry parameter attributes of the first to-be-processed conversion object to be converted based on the Xml telemetry code number, and converting the telemetry parameter attributes to be converted; transferring a conversion function by the first to-be-processed conversion object after conversion processing to obtain an Xml telemetry label, adding a label attribute to the Xml telemetry label to obtain a converted node, and mounting the converted node into an Xml tree structure; the telemetry parameter attributes comprise word sizes, base colors, positions, frames and fonts, and the telemetry parameter attributes to be converted are subsets of the telemetry parameter attributes.
3. The system of claim 1, wherein the Xml to Json module is configured to query each leaf node based on a tree structure of an Xml tree when the conversion schema is Xml format to Json format; each leaf node is used as a second to-be-processed conversion object, and the following operations are executed on each second to-be-processed conversion object: extracting a label attribute, a telemetry code and a related attribute of the second to-be-processed conversion object, determining a Json telemetry code corresponding to the second to-be-processed conversion object based on the relation mapping dictionary, determining a telemetry parameter attribute of the second to-be-processed conversion object to be converted based on the Json telemetry code, and converting the telemetry parameter attribute to be converted; calling a conversion function by the converted object to be processed after conversion processing to obtain a Json telemetry structure, adding a tag attribute 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 comprise word size, ground color and position, and the telemetry parameter attributes to be converted are subsets of the telemetry parameter attributes.
4. The system of claim 1, wherein the Excel-to-Xml module is configured to search for a telemetry number and a telemetry name in an Excel telemetry page document when the conversion mode is Excel format-to-Xml format, take a page template in the entire Sheet as a third to-be-processed conversion object, and determine that the conversion target is a Label page or a Chart page based on the Sheet name of the third to-be-processed conversion object; and converting the Excel format into the Xml format based on the page layout of the Excel document and the conversion target.
5. The system of any one of claims 1-4, wherein the Json-to-Xml module comprises a text node processing sub-module, a curve node processing sub-module, a first conversion sub-module;
the text node processing submodule is used for acquiring Json nodes with the attribute of text type, acquiring the color attribute of the positions, the sizes, the background colors, the fonts and the word sizes of the Json nodes for the Json nodes with the text type of the graphic area with the frame, converting the Json nodes into Label nodes in an Xml file, wherein the Label nodes are converted nodes; setting the Type attribute of a converted node corresponding to a Json node as text for the Json node of the text Type with the base map, acquiring the position, size, background color, font shape and font size attribute of the Json node, converting the Json node into a Label node in an Xml file, wherein the Label node is the converted node; for a Json node of a dynamic text Type, acquiring the position, the size, the background color, the font shape and the frame color attribute of the Json node, setting the Type attribute of the converted node corresponding to the Json node as tm, converting the Json node into a corresponding Label node, wherein the Label node is the converted node;
the curve node processing submodule is used for acquiring a Json node with a curve type attribute, acquiring a curve image position and an image size of the Json node, and converting the curve image position and the image size from a center point coordinate to an upper left corner coordinate; acquiring each curve telemetry associated with the dynamic attribute of the Json node of the curve type, and converting the name and the color attribute of the Json node of the curve type into a TmPa node in corresponding Xml based on the curve color attribute of the Json node of the curve type; based on the relation mapping dictionary, determining an Xml telemetry code number corresponding to the Json node of the curve type, and marking the Name attribute of the Json node of the curve type as the telemetry code number to realize the conversion of the Json node of the curve type into a Chart label node in the Xml;
the first conversion sub-module is used for traversing the whole Json document, carrying out corresponding processing according to the type of the telemetry node of the Json document, and completing the conversion of the node; and mounting the converted Label node and/or Chart node under the Page node of the Xml tree, mounting the Page node under the Satellite node of the Xml tree, and writing the Xml tree into a file to form an Xml telemetry Page document.
6. The system of any one of claims 1-4, wherein the Xml-to-Json module comprises a label-to-text node sub-module, a label-to-curve node sub-module, and a second conversion sub-module;
the Label-to-text node sub-module is used for extracting Label labels in an Xml document, and for each Label, the following operations are executed: establishing a Json text node corresponding to the Label Label, converting the position information in the Label Label into a central point coordinate through upper left corner coordinates, and converting the central point coordinate into a position attribute of the corresponding Json text node in the Json document; converting the size information in the Label Label into character strings for processing, wherein width is used as the wide attribute of the corresponding Json text node in the Json document, and height is used as the high attribute of the corresponding Json text node in the Json document; processing the font color, background color, text information and font size in the Label Label by character strings, and converting the font color, background color, text information and font size into node attributes of the Json text nodes corresponding to the Label Label; determining a telemetry code number of the Json document corresponding to the Label tag based on the relation mapping dictionary, and marking the value attribute of the corresponding Json text node as the telemetry code number;
the label transfer curve node submodule is used for extracting Chart labels in the Xml document, and for each Chart label, the following operations are executed: establishing a Json text node corresponding to the Chart label, converting the position information in the Chart label into a central point coordinate through upper left corner coordinates, and converting the central point coordinate into the position attribute of the corresponding Json text node; the size information in the Chart label is subjected to splitting character string processing, width is used as the wide attribute of the corresponding Json text node, and height is used as the high attribute of the corresponding Json text node; converting the font color, background color, text information and font size in the Chart label into node attributes of the corresponding Json text nodes through character string processing; traversing sub-tags TmPara of the Chart tags, extracting a name attribute of each TmPara tag, and forming a corresponding Json text node dynamic attribute; determining a telemetry code number of the Json document corresponding to each TmPa based on the relation mapping dictionary, and marking a value attribute in the dynamic attribute as the telemetry code number;
the second conversion sub-module is used for traversing the whole Xml document, and carrying out corresponding processing on the label types of all sub-nodes under the Page node according to the Xml tree structure; and adding the converted nodes to a Json document to form a Json telemetry page document.
7. The system of any one of claims 1-4, wherein the Excel-to-Xml module comprises a conversion target determination sub-module, a conversion Label sub-module, and a conversion Chart sub-module;
the conversion target determining submodule is used for reading the Excel file to be processed, determining that a conversion target is a Label page or a Chart page based on the names of sheets in the Excel file, and converting the names of sheets into an Xml page taking Label as a main body or an Xml page taking Chart as a main body;
the Label conversion submodule is used for reading the length of each row of character string data in the Excel file, determining the row of the row title or the row of the data, combining the data lines, combining the telemetry names and telemetry codes, generating an XmlLabel tag by the combined data lines, and assigning a default value to the related attribute; all the titles and the combined data lines in the Excel file are converted into corresponding Label tags, and the corresponding Label tags are mounted in an Xml tree to generate an Xml document;
the Chart conversion sub-module establishes an array, and each element in the array is used for storing all curves in each image respectively; determining a telemetry code of each curve, assigning a value to the color of each curve, converting the whole image into Chart labels, converting each curve into TmPa labels, and mounting the TmPa labels under the Chart labels, wherein the Chart labels are mounted under Page labels to generate the Xml document.
CN202211496303.8A 2022-11-24 2022-11-24 Python-based telemetry page format conversion system Pending CN116257656A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211496303.8A CN116257656A (en) 2022-11-24 2022-11-24 Python-based telemetry page format conversion system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211496303.8A CN116257656A (en) 2022-11-24 2022-11-24 Python-based telemetry page format conversion system

Publications (1)

Publication Number Publication Date
CN116257656A true CN116257656A (en) 2023-06-13

Family

ID=86685182

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211496303.8A Pending CN116257656A (en) 2022-11-24 2022-11-24 Python-based telemetry page format conversion system

Country Status (1)

Country Link
CN (1) CN116257656A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719986A (en) * 2023-08-10 2023-09-08 深圳传趣网络技术有限公司 Python-based data grabbing method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719986A (en) * 2023-08-10 2023-09-08 深圳传趣网络技术有限公司 Python-based data grabbing method, device, equipment and storage medium
CN116719986B (en) * 2023-08-10 2023-12-26 深圳传趣网络技术有限公司 Python-based data grabbing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US10067931B2 (en) Analysis of documents using rules
CN108763171B (en) Automatic document generation method based on format template
JP4343213B2 (en) Document processing apparatus and document processing method
JP3425408B2 (en) Document reading device
US20030210428A1 (en) Non-OCR method for capture of computer filled-in forms
JPH11250041A (en) Document processor and document processing method
CN103399857B (en) General method for extracting document structural information
CN109977383A (en) A kind of form information extracting method based on Excel
CN116257656A (en) Python-based telemetry page format conversion system
JP4185175B2 (en) How to display structured documents
CN106815181B (en) Method and device for converting Indesign typesetted ind files into Office files
US20050125724A1 (en) PPML to PDF conversion
CN114417012A (en) Method for generating knowledge graph and electronic equipment
TWI793432B (en) Document management method and system for engineering project
CN102110108B (en) Method and device for processing galley proof file
CN113033162A (en) Electronic document conversion method capable of controlling editing rule
CN113095044A (en) File conversion method, device and equipment
CN112597410A (en) Method and device for performing structured extraction on webpage content based on rule configuration library
CN109582928B (en) PDF report data extraction method and device
CN113590115B (en) Automatic generation method and device for service system codes
CN115510834A (en) Laboratory data digital management system and method
CN108563616A (en) A kind of ship electronic base map management method
CN113515926B (en) Automatic file publishing method for plug-in development system model information based on Office Word
US8335984B2 (en) Information processing for generating print data for variable-data printing
CN115035044A (en) Be applied to intelligent AI platform of industry quality inspection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination