CN114697404A - Upper and lower computer communication protocol generation method, system and storage medium of numerical control system - Google Patents
Upper and lower computer communication protocol generation method, system and storage medium of numerical control system Download PDFInfo
- Publication number
- CN114697404A CN114697404A CN202210180245.1A CN202210180245A CN114697404A CN 114697404 A CN114697404 A CN 114697404A CN 202210180245 A CN202210180245 A CN 202210180245A CN 114697404 A CN114697404 A CN 114697404A
- Authority
- CN
- China
- Prior art keywords
- communication
- computer
- file
- communication protocol
- code
- 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
Links
- 238000004891 communication Methods 0.000 title claims abstract description 182
- 238000000034 method Methods 0.000 title claims abstract description 26
- 238000013507 mapping Methods 0.000 claims abstract description 34
- 238000006243 chemical reaction Methods 0.000 claims abstract description 29
- 238000004590 computer program Methods 0.000 claims description 6
- 238000012795 verification Methods 0.000 claims description 2
- 238000011161 development Methods 0.000 abstract description 18
- 238000007689 inspection Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000007493 shaping process Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/06—Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
- Communication Control (AREA)
Abstract
The invention discloses a method, a system and a storage medium for generating a communication protocol of an upper computer and a lower computer of a numerical control system, wherein the method comprises the following steps: s1: compiling upper and lower communication demand files by using specific keywords according to upper and lower communication demands and according to a data field template; s2: loading a corresponding mapping relation according to an upper computer framework required to be used, analyzing keywords in upper and lower communication requirement files and generating a standard communication protocol according to the loaded mapping relation; s3: converting the standard communication protocol into a communication code of a lower computer according to a preset conversion rule; s4: generating a communication file of the upper computer according to a standard communication protocol and a mapping relation; s5: and verifying the consistency of the communication code and the communication file, and outputting a check result to form a report. The method can reduce the development cost, improve the development efficiency and ensure the consistency of the developed upper computer and lower computer communication protocols.
Description
Technical Field
The invention belongs to the technical field of numerical control software, and particularly relates to a method and a system for generating a communication protocol of an upper computer and a lower computer of the numerical control software and a storage medium.
Background
The upper computer monitors the working state of the embedded software (the lower computer) and needs to establish the communication of the upper computer and the lower computer, the upper computer software and the lower computer software respectively and independently run on different platforms, and information interaction is realized through communication media. Generally, the receiving protocol of the upper computer is determined by the sending protocol of the lower computer or the communication codes of the upper and lower bits are respectively developed based on the existing communication protocol. Because FADEC numerical control system software has characteristics such as the security level is high, development cycle is short and software upgrading is frequent, the difference of upper and lower computers brought by respectively developing the upper and lower computers causes certain pressure to software debugging, development efficiency is low, maintainability is poor, and great influence is produced to development progress and product quality. Therefore, a new development mode is needed to be provided, the requirements that high-safety key software quickly realizes communication upper and lower computer codes meeting established rules and can check the consistency of a communication protocol are met, and the purposes that things are paired at one time and the development progress and the product quality are not influenced are achieved.
Disclosure of Invention
The invention aims to: the invention aims to provide a method for generating a communication protocol of an upper computer and a lower computer of a numerical control system, which can establish correct communication of the upper computer and the lower computer at one time and improve software development efficiency and product quality.
Another object of the present invention is to provide a system capable of implementing the above method, and a storage medium storing a computer program instantiated by the above method.
The technical scheme is as follows: the invention relates to a method for generating a communication protocol of an upper computer and a lower computer of a numerical control system, which comprises the following steps:
s1: compiling upper and lower communication demand files by using specific keywords according to upper and lower communication demands and according to a data field template;
s2: loading a corresponding mapping relation according to an upper computer framework required to be used, analyzing keywords in upper and lower communication requirement files and generating a standard communication protocol according to the loaded mapping relation;
s3: converting the standard communication protocol into a communication code of a lower computer according to a preset conversion rule;
s4: generating a communication file of the upper computer according to a standard communication protocol and a mapping relation;
s5: and verifying the consistency of the communication code and the communication file, and outputting a check result to form a report.
Further, the step S5 includes at least one of the following verification items:
verifying the consistency of the communication codes and the id of the communication data in the communication file;
verifying the consistency of the communication code and the communication data length in the communication file;
verifying the consistency of the corresponding relation between the communication codes and the parameters in the communication file;
verifying the consistency of the communication code and the Bit of the analytic word in the communication file;
verifying whether the parameter names in the communication codes and the communication files are repeated;
and verifying whether the matching relation between the communication code and the data type and the maximum value in the communication file is correct or not.
Further, the virtual data register stores high-speed data by using a ring queue.
Further, the conversion rule in step S3 includes a function name, a function parameter, a return value, an exception handling description, a function name length, a variable global local setting rule, a variable type conversion mode, a variable naming rule, a counter type, and a requirement tracing relationship establishment mode.
The invention relates to a system for generating a communication protocol of an upper computer and a lower computer of a numerical control system, which comprises: the mapping relation library stores mapping relations corresponding to a plurality of different upper computer frames; the data field template library stores at least one data field template; the lower computer code template library stores communication code templates which support different communication media and adopt different coding formats; the requirement editing tool is used for loading the data field template and guiding a user to edit an upper communication requirement file and a lower communication requirement file according to the upper communication requirement and the lower communication requirement; the standard communication protocol conversion tool is used for loading the mapping relation corresponding to the used upper computer frame and converting the upper and lower communication requirement files into a standard communication protocol; the lower computer communication code conversion tool is used for converting the standard communication protocol into the communication code of the lower computer according to a set rule; the upper computer communication file conversion tool is used for generating a communication file of the upper computer according to the mapping relation and the standard communication protocol; and the consistency checking tool is used for checking the consistency of the communication code and the communication file.
The storage medium of the invention stores a computer program which is set to realize the upper computer and lower computer communication protocol generation method of the numerical control system when running.
Has the advantages that: compared with the prior art, the invention has the following advantages: 1. a user only needs to understand the requirements and write the requirement files, the use method of the tool is mastered, the development technology requirements are reduced, and the development cost is low. 2. The communication codes of the lower computer and the communication files of the upper computer are automatically generated according to the preset mapping relation and the file standards and the code specifications are guaranteed, the consistency of the upper computer and the lower computer is guaranteed, and the development efficiency and the development quality are improved.
Drawings
FIG. 1 is a flow chart of a method of generation according to an embodiment of the present invention;
fig. 2 is a template of a communication code of the lower computer according to the embodiment of the present invention.
Detailed Description
The technical scheme of the invention is further explained by combining the attached drawings.
Referring to fig. 1, the method for generating a communication protocol between an upper computer and a lower computer of a numerical control system according to an embodiment of the present invention includes the following steps:
s1: compiling upper and lower communication demand files by using specific keywords according to upper and lower communication demands and according to a data field template;
s2: loading a corresponding mapping relation according to an upper computer framework required to be used, analyzing keywords in upper and lower communication requirement files and generating a standard communication protocol according to the loaded mapping relation;
s3: converting the standard communication protocol into a communication code of a lower computer according to a preset conversion rule;
s4: generating a communication file of the upper computer according to the communication code and the mapping relation;
s5: and verifying the consistency of the communication code and the communication file, and outputting a check result to form a report.
Wherein, the keywords in the total data field template of step S2 need to include whether the field is used for the upper computer or the lower computer, whether the meaning of each Bit needs to be analyzed, the sending mode, etc., taking the following as an example:
[ Upper ]: the field is generated to be used by an upper computer;
[ Lower ]: the field generates a lower computer for use;
[ Parse ]: this field needs to resolve the meaning of each Bit;
[ Byte ]: transmitting the field in a byte manner;
[ Word ]: sending the field by word;
[ DWord ]: this field is sent in double words.
The field is used by Upper and Lower computers of the parameter and needs to be analyzed. The minimum value setting key [ Lower ] ParamMin indicates that the minimum value is a Lower computer usage field. In the technical scheme, a user can load a preset data field template by using a requirement editing tool, compile a top-bottom communication requirement file under the guidance of the data field template according to a required communication protocol requirement, analyze keywords by using a standard communication protocol conversion tool, analyze the keywords in the top-bottom communication file according to a corresponding mapping relation, and generate a word standard communication protocol. The standard communication protocol comprises a communication protocol general table and a parsing word sub table, wherein the communication protocol general table is shown in table 1 and comprises parsing of each variable information, and the parsing word sub table is shown in table 2 and comprises definition of each Bit of a parsing word of a parameter variable.
TABLE 1 summary of communication protocols
TABLE 2 analytic word score table
In steps S3 and S4, the standard communication protocol is converted into the nc software communication code of the lower computer according to a specific conversion rule by the lower computer communication code conversion tool, and the upper computer communication file conversion tool converts the standard communication protocol into the communication file of the fixed format used for the upper computer frame recognition according to the mapping relationship. In this embodiment, taking FADEC numerical control software as an example, the encoding rule is as follows:
a) the method comprises a standard annotation head, wherein the annotation head comprises a function name, a function parameter, a return value and an exception handling description;
b) establishing a requirement tracing relation by using an annotation mode;
c) the function name length does not exceed 32 characters;
d) the data variables are coded in a global variable mode;
e) setting of global variable names starts with part names;
f) establishing an explicit type conversion relation when the global variable is transmitted;
g) the type of counter uses signed sixteen bit shaping.
In practice, a specific conversion rule may be stored in the storage medium in a code template manner, as shown in fig. 2, a placeholder corresponding to the keyword is set in the code template, and the lower computer communication code conversion tool replaces the corresponding placeholder with the parameter according to the rule to form a communication code of the lower computer during conversion. The standard communication protocol and the communication file part of the upper computer in the mapping relation are shown in table 3, and a user can call and convert the communication file into the communication file of the upper computer by the upper computer communication file conversion tool according to the self-defined mapping relation of the upper computer framework.
TABLE 3 mapping relationship between standard communication protocol and upper computer communication file
After the communication protocols of the upper computer and the lower computer are generated, the corresponding fields in the communication codes and the communication files are read through a consistency check tool, and whether the corresponding items conform to the mapping relation or not is checked. In this embodiment, the check items include:
a) checking the id consistency of the communication data of the upper computer and the lower computer;
b) checking the length consistency of the communication data of the upper computer and the lower computer;
c) checking the consistency of the corresponding relation of the parameters of the upper computer and the lower computer;
d) checking the consistency of the BIT BITs of the upper and lower computers;
e) and checking the fault tolerance of the communication of the upper computer and the lower computer, such as whether the parameter names are repeated or not and whether the matching relation between the data types and the maximum value is correct or not.
And outputting the test result to a specified path in a report form.
The upper computer and the lower computer of the numerical control system generated by the method are generated according to the preset mapping relation and the standard communication protocol, and consistency rechecked after the generation, so that the clear development process is ensured, the consistency of the upper computer software and the lower computer software development input source is ensured, and the requirements of the FADEC numerical control system software on the conformity and the quick response of external input are met. The communication codes and the communication files are automatically generated in the development process, the development progress cannot be influenced by man-made low-level errors, and the communication protocols of the upper computer and the lower computer which meet requirements and have high consistency can be guaranteed to be obtained only by guaranteeing the understanding of users to communication requirements and the accuracy of mapping relations. In the development process, a user only needs to understand the requirements and learn the operation of the tool, so that the code capability requirement of development is reduced, the development cost is reduced, technical personnel are liberated, and the development efficiency is improved.
The upper computer and lower computer communication protocol generation system of the numerical control system comprises a mapping relation library, a data field template library, a lower computer code template library, a requirement editing tool, a standard communication protocol conversion tool, a lower computer communication code conversion tool, an upper computer communication code conversion tool and a consistency inspection tool. The mapping relation library stores mapping relations corresponding to a plurality of different upper computer frameworks, the data field template library stores at least one data field template, and the lower computer code template library stores communication code templates supporting different communication media and different coding formats, so that a user can select a corresponding template according to an actual communication medium. The requirement editing tool is used for loading the data field template and guiding a user to edit the upper and lower communication requirement files according to the upper and lower communication requirements. The standard communication protocol conversion tool is used for loading the mapping relation corresponding to the upper computer framework and converting the upper and lower communication requirement files into the standard communication protocol. The lower computer communication code conversion tool is used for converting the standard communication protocol into the communication code of the lower computer according to the established rule. The upper computer communication file conversion tool is used for generating a communication file of the upper computer according to the mapping relation and the standard communication protocol, and the consistency inspection tool is used for inspecting consistency of the communication code and the communication file. The storage medium of the embodiment of the invention stores a computer program, and the computer program is set to realize the upper computer and lower computer communication protocol generation method of the numerical control system when running.
Claims (5)
1. A method for generating a communication protocol of an upper computer and a lower computer of a numerical control system is characterized by comprising the following steps:
s1: compiling upper and lower communication demand files by using specific keywords according to upper and lower communication demands and according to a data field template;
s2: loading a corresponding mapping relation according to an upper computer framework required to be used, analyzing keywords in upper and lower communication requirement files and generating a standard communication protocol according to the loaded mapping relation;
s3: converting the standard communication protocol into a communication code of a lower computer according to a preset conversion rule;
s4: generating a communication file of the upper computer according to a standard communication protocol and a mapping relation;
s5: and verifying the consistency of the communication code and the communication file, and outputting a check result to form a report.
2. The method for generating a communication protocol between an upper computer and a lower computer of a numerical control system according to claim 1, wherein the step S5 includes at least one of the following verification items:
verifying the consistency of the communication codes and the id of the communication data in the communication file;
verifying the consistency of the communication code and the communication data length in the communication file;
verifying the consistency of the corresponding relation between the communication codes and the parameters in the communication file;
verifying the consistency of the communication code and the Bit of the analytic word in the communication file;
verifying whether the parameter names in the communication codes and the communication files are repeated;
and verifying whether the matching relation between the communication code and the data type and the maximum value in the communication file is correct or not.
3. The method for generating a communication protocol between an upper computer and a lower computer of a numerical control system according to claim 1, wherein the conversion rule in step S3 includes a function name, a function parameter, a return value, an exception handling description, a function name length, a variable global local setting rule, a variable type conversion method, a variable naming rule, a counter type, and a requirement tracing relationship establishment method.
4. The utility model provides a host computer and lower computer communication protocol generation system of numerical control system which characterized in that includes:
the mapping relation library stores mapping relations corresponding to a plurality of different upper computer frameworks;
the data field template library stores at least one data field template;
the lower computer code template library stores communication code templates which support different communication media and adopt different coding formats;
the requirement editing tool is used for loading the data field template and guiding a user to edit an upper communication requirement file and a lower communication requirement file according to the upper communication requirement and the lower communication requirement;
the standard communication protocol conversion tool is used for loading the mapping relation corresponding to the upper computer framework and converting the upper and lower communication requirement files into a standard communication protocol;
the lower computer communication code conversion tool is used for converting the standard communication protocol into the communication code of the lower computer according to a set rule;
the upper computer communication file conversion tool is used for generating a communication file of the upper computer according to the mapping relation and the standard communication protocol;
and the consistency checking tool is used for checking the consistency of the communication code and the communication file.
5. A storage medium storing a computer program, wherein the computer program is configured to implement the upper and lower computer communication protocol generation method of the numerical control system according to any one of claims 1 to 3 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210180245.1A CN114697404A (en) | 2022-02-25 | 2022-02-25 | Upper and lower computer communication protocol generation method, system and storage medium of numerical control system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210180245.1A CN114697404A (en) | 2022-02-25 | 2022-02-25 | Upper and lower computer communication protocol generation method, system and storage medium of numerical control system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114697404A true CN114697404A (en) | 2022-07-01 |
Family
ID=82136894
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210180245.1A Pending CN114697404A (en) | 2022-02-25 | 2022-02-25 | Upper and lower computer communication protocol generation method, system and storage medium of numerical control system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114697404A (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102736565A (en) * | 2011-04-02 | 2012-10-17 | 成都齐峰科技有限公司 | Communication method of automatic control equipment based on upper and lower computer structures |
CN103631195A (en) * | 2013-12-03 | 2014-03-12 | 苏州镭明激光科技有限公司 | Lab view (laboratory virtual instruments engineering workbench) and PLC (programmable logic controller) based serial port communication control method |
CN104363285A (en) * | 2014-11-18 | 2015-02-18 | 东方网力科技股份有限公司 | Network communication program generating method and device |
CN106412086A (en) * | 2016-10-31 | 2017-02-15 | 武汉斗鱼网络科技有限公司 | Method and system for automatically generating communication codes by employing protocol description file |
CN106603482A (en) * | 2016-05-26 | 2017-04-26 | 欣旺达电子股份有限公司 | Method and device for automatically generating CAN communication protocol code |
CN108040040A (en) * | 2017-11-30 | 2018-05-15 | 北京锐安科技有限公司 | A kind of automation analysis method and device of application protocol message |
CN109639737A (en) * | 2019-01-25 | 2019-04-16 | 浙江大学 | Agreement generating device, the method for converting protocol of data collection station and configuration method |
CN110113196A (en) * | 2019-04-26 | 2019-08-09 | 中车青岛四方机车车辆股份有限公司 | A kind of protocol configuration method, device, equipment and medium |
CN110474896A (en) * | 2019-08-06 | 2019-11-19 | 厦门科灿信息技术有限公司 | Data communications method and relevant device based on Modbus consensus standard |
CN110933059A (en) * | 2019-11-22 | 2020-03-27 | 广州视源电子科技股份有限公司 | Data communication method and device, electronic equipment, upper computer and storage medium |
CN111428462A (en) * | 2020-03-04 | 2020-07-17 | 厦门科灿信息技术有限公司 | Communication protocol template construction method and terminal equipment |
CN112242941A (en) * | 2020-09-29 | 2021-01-19 | 国创新能源汽车智慧能源装备创新中心(江苏)有限公司 | Data transmission method and device for upper computer and lower computer |
-
2022
- 2022-02-25 CN CN202210180245.1A patent/CN114697404A/en active Pending
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102736565A (en) * | 2011-04-02 | 2012-10-17 | 成都齐峰科技有限公司 | Communication method of automatic control equipment based on upper and lower computer structures |
CN103631195A (en) * | 2013-12-03 | 2014-03-12 | 苏州镭明激光科技有限公司 | Lab view (laboratory virtual instruments engineering workbench) and PLC (programmable logic controller) based serial port communication control method |
CN104363285A (en) * | 2014-11-18 | 2015-02-18 | 东方网力科技股份有限公司 | Network communication program generating method and device |
CN106603482A (en) * | 2016-05-26 | 2017-04-26 | 欣旺达电子股份有限公司 | Method and device for automatically generating CAN communication protocol code |
CN106412086A (en) * | 2016-10-31 | 2017-02-15 | 武汉斗鱼网络科技有限公司 | Method and system for automatically generating communication codes by employing protocol description file |
CN108040040A (en) * | 2017-11-30 | 2018-05-15 | 北京锐安科技有限公司 | A kind of automation analysis method and device of application protocol message |
CN109639737A (en) * | 2019-01-25 | 2019-04-16 | 浙江大学 | Agreement generating device, the method for converting protocol of data collection station and configuration method |
CN110113196A (en) * | 2019-04-26 | 2019-08-09 | 中车青岛四方机车车辆股份有限公司 | A kind of protocol configuration method, device, equipment and medium |
CN110474896A (en) * | 2019-08-06 | 2019-11-19 | 厦门科灿信息技术有限公司 | Data communications method and relevant device based on Modbus consensus standard |
CN110933059A (en) * | 2019-11-22 | 2020-03-27 | 广州视源电子科技股份有限公司 | Data communication method and device, electronic equipment, upper computer and storage medium |
CN111428462A (en) * | 2020-03-04 | 2020-07-17 | 厦门科灿信息技术有限公司 | Communication protocol template construction method and terminal equipment |
CN112242941A (en) * | 2020-09-29 | 2021-01-19 | 国创新能源汽车智慧能源装备创新中心(江苏)有限公司 | Data transmission method and device for upper computer and lower computer |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8091071B2 (en) | Method and system for template-based code generation | |
CN112799321B (en) | DBC file rapid creating method following CAN bus communication protocol | |
CN110908890A (en) | Automatic test method and device for interface | |
KR20160063990A (en) | COMPUTER-EXECUTABLE MODEL reverse engineering mETHOD AND APPARATUS PERFORMING THE SAME | |
CN110769002A (en) | LabVIEW-based message analysis method, system, electronic device and medium | |
CN113778449A (en) | Avionics interface data adaptation conversion system | |
CN114546394B (en) | Unified Internet of things peripheral access and control method | |
CN105739481A (en) | Industrial control software testing method, industrial control software testing device, and industrial control software testing system | |
CN113010473B (en) | Method and equipment for editing YAML file | |
CN114697404A (en) | Upper and lower computer communication protocol generation method, system and storage medium of numerical control system | |
CN101201750A (en) | Method of providing data for encoding/decoding using syntax lexical analysis tool | |
US20010051974A1 (en) | Method and apparatus for automatic generation of data interfaces | |
WO2008121598A1 (en) | System and method for providing a replica of a graphic presentation by translating into a neutral format | |
CN114356285B (en) | Paperless design system and design method thereof | |
CN112667202B (en) | Software design method and device combining MDA and BPMN | |
CN1932760B (en) | System and method for execution of application program | |
CN114036055A (en) | System for converting xmind test case and jmeter script | |
CN111610964A (en) | Encoding rule generation method and device | |
CN117874393B (en) | Method and system for constructing SCA model engineering through XML file | |
CN115373655B (en) | Information protocol code automatic generation method based on standardized template | |
CN108628606A (en) | A kind of the WEB webmaster application program generation methods and system of embedded device | |
CN113672239B (en) | Visual algorithm package development method based on language analysis | |
CN111530084A (en) | Planning configuration system and method thereof | |
CN116737175B (en) | Decoding method, file analysis method, analyzer, system and storage medium | |
CN113703769A (en) | CLI command execution method and related device |
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 |