CN117389534A - Communication file generation method, device, computer equipment and storage medium - Google Patents

Communication file generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117389534A
CN117389534A CN202311399389.7A CN202311399389A CN117389534A CN 117389534 A CN117389534 A CN 117389534A CN 202311399389 A CN202311399389 A CN 202311399389A CN 117389534 A CN117389534 A CN 117389534A
Authority
CN
China
Prior art keywords
communication
target
computer
parameters
parameter
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
CN202311399389.7A
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.)
Maiwei Software Technology Zhuhai Co ltd
Original Assignee
Maiwei Software Technology Zhuhai Co ltd
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 Maiwei Software Technology Zhuhai Co ltd filed Critical Maiwei Software Technology Zhuhai Co ltd
Priority to CN202311399389.7A priority Critical patent/CN117389534A/en
Publication of CN117389534A publication Critical patent/CN117389534A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/056Programming the PLC
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The application relates to a method, a device, computer equipment and a storage medium for generating a communication file. The method comprises the following steps: responding to an input instruction of equipment parameters, and acquiring target lower computer and target equipment parameters corresponding to the input instruction; determining a target communication parameter matched with the target equipment parameter based on a preset association relation between the equipment parameter and the communication parameter, wherein the preset association relation is determined based on a relation between lower computer control logic corresponding to the equipment parameter and the communication parameter; and generating a communication file matched with the target communication parameters, wherein the communication file is used for carrying out data transmission between an upper computer and the target lower computer based on the operation parameters of the target lower computer. By adopting the method, the efficiency and the reusability of the communication file can be improved.

Description

Communication file generation method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of device control technologies, and in particular, to a method and apparatus for generating a communication file, a computer device, a storage medium, and a computer program product.
Background
In some equipment control scenes, a lower computer, such as an editable logic controller (PLC), is adopted to perform motion control, and an upper computer (PC) is adopted to perform man-machine integration, calculation, visual integration, laser control and the like. The upper computer and the lower computer can realize data transmission and communication through communication software, and in the traditional technology, a developer can write codes in the communication software according to the electrical standard of the lower computer.
However, the electrical standards may be different depending on equipment, projects, engineer operations, etc., resulting in low code development efficiency and low code reusability.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device, a computer-readable storage medium, and a computer program product for generating a communication file that can improve efficiency and reusability.
In a first aspect, the present application provides a method for generating a communication file, where the method includes:
responding to an input instruction of equipment parameters, and acquiring target lower computer and target equipment parameters corresponding to the input instruction;
determining a target communication parameter matched with the target equipment parameter based on a preset association relation between the equipment parameter and the communication parameter, wherein the preset association relation is determined based on a relation between lower computer control logic corresponding to the equipment parameter and the communication parameter;
and generating a communication file matched with the target communication parameters, wherein the communication file is used for carrying out data transmission between an upper computer and the target lower computer based on the operation parameters of the target lower computer.
In one embodiment, the generating the communication file matched with the target communication parameter includes:
generating a communication text corresponding to the target communication parameters, wherein the communication text is used for providing interface parameters and functions;
and determining the communication file matched with the communication text according to the program type corresponding to the target lower computer.
In one embodiment, the method further comprises:
responding to a triggering instruction of a driving signal, and generating a communication field according to the operation parameters of the target lower computer and the communication file;
and carrying out data transmission between the upper computer and the target lower computer according to the communication field.
In one embodiment, the target communication parameter includes a parameter synchronization period, and the generating a communication field according to the operation parameter of the target lower computer and the communication file includes:
periodically acquiring the operation parameters of the target lower computer according to the parameter synchronization period;
and generating a communication field according to the operation parameters and the communication file.
In one embodiment, the data transmission between the upper computer and the target lower computer according to the communication field includes:
and under the condition that the communication field is marked with a preset label, carrying out data transmission between the upper computer and the target lower computer according to a preset communication confirmation mechanism.
In one embodiment, the method further comprises:
and under the condition that the data transmission between the upper computer and the target lower computer fails, carrying out data transmission according to a preset retry mechanism, and sending alarm information.
In a second aspect, the present application further provides a device for generating a communication file, including:
the acquisition module is used for responding to an input instruction of the equipment parameters and acquiring the target lower computer and the target equipment parameters corresponding to the input instruction;
the determining module is used for determining a target communication parameter matched with the target equipment parameter based on a preset association relation between the equipment parameter and the communication parameter, wherein the preset association relation is determined based on a relation between lower computer control logic corresponding to the equipment parameter and the communication parameter;
the generation module is used for generating a communication file matched with the target communication parameters, and the communication file is used for carrying out data transmission between the upper computer and the target lower computer based on the operation parameters of the target lower computer.
In one embodiment, the generating module includes:
the first generation sub-module is used for generating a communication text corresponding to the target communication parameters, and the communication text is used for providing interface parameters and functions;
and the first determining submodule is used for determining the communication file matched with the communication text according to the program type corresponding to the target lower computer.
In one embodiment, the apparatus further comprises:
the second generation sub-module is used for responding to the triggering instruction of the driving signal and generating a communication field according to the operation parameters of the target lower computer and the communication file;
and the first transmission sub-module is used for carrying out data transmission between the upper computer and the target lower computer according to the communication field.
In one embodiment, the target communication parameter includes a parameter synchronization period, and the second generating sub-module includes:
the acquisition unit is used for periodically acquiring the operation parameters of the target lower computer according to the parameter synchronization period;
and the generating unit is used for generating a communication field according to the operation parameters and the communication file.
In one embodiment, the first transmission sub-module includes:
and the transmission unit is used for carrying out data transmission between the upper computer and the target lower computer according to a preset communication confirmation mechanism under the condition that the communication field is marked with a preset label.
In one embodiment, the apparatus further comprises:
and the second transmission sub-module is used for carrying out data transmission according to a preset retry mechanism and sending alarm information under the condition that the data transmission between the upper computer and the target lower computer fails.
In a third aspect, embodiments of the present disclosure also provide a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of the method of any of the embodiments of the present disclosure when the computer program is executed.
In a fourth aspect, embodiments of the present disclosure also provide a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the embodiments of the present disclosure.
In a fifth aspect, embodiments of the present disclosure also provide a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of the method according to any of the embodiments of the present disclosure.
The embodiment of the disclosure provides a method for generating a communication file, which responds to an input instruction of equipment parameters, acquires corresponding target lower computer and target equipment parameters, determines target communication parameters matched with the target equipment parameters based on a preset association relation between the equipment parameters and the communication parameters, and generates the communication file matched with the target communication parameters, thereby realizing automatic generation of the communication file, and further realizing data transmission between an upper computer and the target lower computer. The preset association relation between the equipment parameters and the communication parameters is determined based on the relation between the control logic of the lower computer and the communication parameters, so that the accuracy of the target communication parameters is improved, and the communication connection between the upper computer and the lower computer is ensured to be established quickly and effectively; through the establishment of the preset association relationship, the communication parameters of the lower computer are uniformly set, so that the reusability is improved, the workload of data processing in different application scenes is reduced, and the method is suitable for more application scenes.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is a flow chart of a method for generating a communication file according to an embodiment;
FIG. 2 is a flow chart of a method for generating a communication file according to an embodiment;
FIG. 3 is a flow chart illustrating a method for generating a communication file according to an embodiment;
FIG. 4 is a flow chart illustrating a method for generating a communication file according to an embodiment;
FIG. 5 is a schematic diagram of a software architecture of a communication component according to an embodiment;
FIG. 6 is a block diagram illustrating an apparatus for generating a communication file according to an embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In an exemplary embodiment, as shown in fig. 1, there is provided a method for generating a communication file, the method including:
step S110, responding to an input instruction of equipment parameters, and acquiring target lower computer and target equipment parameters corresponding to the input instruction;
in the embodiment of the disclosure, in response to an input instruction of a device parameter, a target lower computer and a target device parameter corresponding to the input instruction are obtained, wherein different lower computers can correspond to different device parameters, and the device parameters can be obtained specifically according to actual application scene settings. In one example, a user may input the target device parameter and the target lower computer through a configuration option of a preset configuration page, and when the user sets the configuration option on the preset configuration page, an input instruction of the device parameter is triggered, and the corresponding target lower computer and the target device parameter are obtained in response to the input instruction of the device parameter. In an example, the target device parameters may include, but are not limited to, hardware parameters and function parameters of the target lower computer, for example, the function parameters corresponding to the target lower computer may be input according to the function required to be implemented in the actual application requirement, such as writing, reading, and the like, and may be specifically set according to the actual application scenario.
Step S120, determining a target communication parameter matched with the target equipment parameter based on a preset association relation between the equipment parameter and the communication parameter, wherein the preset association relation is determined based on a relation between lower computer control logic corresponding to the equipment parameter and the communication parameter;
in the embodiment of the disclosure, after the target device parameter is obtained, determining a target communication parameter matched with the target device parameter based on a preset association relationship between the device parameter and the communication parameter. The device parameters and the communication parameters have a preset association relation, and the corresponding communication parameters can be determined through the device parameters. In general, the device parameters correspond to the lower computers, and the lower computers of different types may correspond to different device parameters, where control logic of the lower computers of different device parameters are different, and in one example, different communication protocols may be adopted between the different lower computers and the upper computer for communication. In one example, the communication parameters may include, but are not limited to, communication tags of different functions, synchronization frequencies of communication tags, variable settings, variable definition meanings, preset tags, etc., e.g., data writing, data reading, respectively corresponding to communication tags of different functions. In this embodiment, when the preset association relationship between the device parameters and the communication parameters is set, the relationship between the control logic of the lower computer corresponding to the device parameters and the communication parameters may be determined, and when the data transmission with different functions is implemented by the lower computers corresponding to different device parameters may be based on different communication protocols, so that the communication parameters corresponding to different device parameters may also have differences. In one possible implementation manner, a communication template of an Excel document can be formulated according to an actual application scene, a communication tag, a synchronous frequency of the communication tag, setting of a variable, definition of the variable, presetting of the tag and the like can be set in the Excel, and through the communication template, a target communication parameter matched with a target equipment parameter can be determined, and a corresponding communication file can be automatically generated.
And step S130, generating a communication file matched with the target communication parameters, wherein the communication file is used for carrying out data transmission between an upper computer and the target lower computer based on the operation parameters of the target lower computer.
In the embodiment of the disclosure, according to the target communication parameters, a communication file matched with the target communication parameters is generated, and the communication file is used for carrying out data transmission between the upper computer and the target lower computer based on the operation parameters of the target lower computer. The communication file may be a program file capable of performing communication between the upper computer and the lower computer, where the communication file includes a program text, and in one example, the communication file may be generated directly according to a target communication parameter; in another example, a communication text, such as a communication DLL, may be generated according to the target communication parameters, and a corresponding communication file may be generated according to the communication text. In this embodiment, when the upper computer and the lower computer communicate, corresponding operations are performed according to the communication file and the operation parameters corresponding to the lower computer, and data transmission is performed, where the operation parameters of the target lower computer may be obtained by automatic reading and updating, the operation parameters of the lower computer may be determined according to the input of the user, and in the data transmission process of the upper computer and the lower computer, the operation parameters of the target lower computer may be changed according to the user operation or the actual scene requirement, and in one example, the operation parameters of the lower computer may be determined by periodically reading the operation parameters of the lower computer. In one example, one upper computer may perform data transmission with multiple lower computers, and may be implemented through different communication files when performing data transmission with different lower computers.
In one possible implementation manner, the upper and lower computers perform data transmission in a UDP/IP manner, which is different from the CIP TCP manner in the conventional technology, in this embodiment, the upper and lower computers all need to set communication parameters, for example, when establishing a communication tag, need to distinguish an input tag from an output tag, and perform data transmission in this manner, so that communication efficiency is effectively improved; and the separation of read-write labels is realized, the reliability and the safety of data transmission are improved, and the method is suitable for more application scenes. In one example, the communication tag of the upper computer (PC) may be set as shown in table 1, and the communication tag of the lower computer (PLC) may be set as shown in table 2, where there is a correspondence between the communication tags of the upper and lower computers.
TABLE 1
Label name Type(s) Direction Type(s)
MLK_STATUS PC reading PLC->PC Input device
MLK_AXIS_STATUS PC reading PLC->PC Input device
MLK_DATA PC reading PLC->PC Input device
MLK_CMD PC writing PC->PLC Output of
MLK_AXIS_CMD PC writing PC->PLC Output of
MLK_AXIS_MotionPAR PC writing PC->PLC Output of
FMLK_PARA PC writing PC->PLC Output of
TABLE 2
Label name Type(s) Direction Type(s)
MLK_STATUS PC reading PLC->PC Output of
MLK_AXIS_STATUS PC reading PLC->PC Output of
MLK_DATA PC reading PLC->PC Output of
MLK_CMD PC writing PC->PLC Input device
MLK_AXIS_CMD PC writing PC->PLC Input device
MLK_AXIS_MotionPAR PC writing PC->PLC Input device
FMLK_PARA PC writing PC->PLC Input device
The embodiment of the disclosure provides a method for generating a communication file, which is used for responding to an input instruction of equipment parameters, acquiring corresponding target lower computer and target equipment parameters, determining target communication parameters matched with the target equipment parameters based on a preset association relation between the equipment parameters and the communication parameters, and generating the communication file matched with the target communication parameters, thereby realizing automatic generation of the communication file and realizing data transmission between an upper computer and the target lower computer. In the traditional technology, a developer needs to compare a communication document index or read corresponding communication parameters, the error risk is higher, the running stability of a software program is affected, and when the communication parameters are changed, the developer needs to check and adjust manually, the workload is large, the efficiency is low, through the technical scheme in the embodiment, when the communication of an upper computer and a lower computer is carried out, the determination of the communication parameters and the generation of the communication file can be realized only by inputting the equipment parameters of the lower computer, the developer does not need to write according to different electrical standards, communication protocols and the like of different lower computers, the process is simplified, and the generation efficiency of the communication file is improved; the preset association relation between the equipment parameters and the communication parameters is determined based on the relation between the control logic of the lower computer and the communication parameters, so that the accuracy of the target communication parameters is improved, and the communication connection between the upper computer and the lower computer is ensured to be established quickly and effectively; through the establishment of the preset association relationship, the communication parameters of the lower computer are uniformly set, so that the reusability is improved, the workload of data processing in different application scenes is reduced, and the method is suitable for more application scenes.
In one embodiment, as shown in fig. 2, the generating a communication file matched with the target communication parameter includes:
step S131, generating a communication text corresponding to the target communication parameter, wherein the communication text is used for providing interface parameters and functions;
and step S132, determining a communication file matched with the communication text according to the program type corresponding to the target lower computer.
In the embodiment of the disclosure, when the communication file is generated, a communication text corresponding to the target communication parameter is generated, and the communication text is used for providing the interface parameter and the function. In one example, the communication file may include a DLL file, which functions to provide interface parameters and functions to enable the host program to exchange and communicate data with the lower computer, and which includes functions, data structures and other relevant code necessary for communicating with the lower computer, which may be conveniently called and used by the host program. In an example, the communication text may be obtained after conversion based on the c# code, and the corresponding c# code is automatically generated according to the target communication parameter, and the communication file is automatically generated based on the c# code, so that operations such as reading and writing of variables are not required to be manually written. After the communication text is generated, determining a communication file matched with the communication text according to the program type corresponding to the target lower computer, and in some application scenarios, driving the communication file of different program types by different target lower computers. In one example, the upper computer hosts the generated communication text through the driver, responds to a trigger instruction of the driving signal, firstly converts the communication text into a corresponding communication file, and then generates a communication field according to the operation parameters of the target lower computer and the communication file.
According to the embodiment of the disclosure, the communication text for providing the interface parameters and the functions is generated according to the target communication parameters, and the communication file is determined according to the program types corresponding to the target lower computer, so that the automatic generation from the parameters to the text to the file is realized, the flow is simplified, the accuracy of the generation of the communication file is ensured, the communication file can be generated according to the program types corresponding to the lower computer, the communication file generation method is suitable for the lower computers of different program types, the corresponding communication file can be automatically generated under different scenes, and the communication file generation method is suitable for more application scenes.
In one embodiment, as shown in fig. 3, the method further comprises:
step S310, responding to a triggering instruction of a driving signal, and generating a communication field according to the operation parameters of the target lower computer and the communication file;
step S320, performing data transmission between the upper computer and the target lower computer according to the communication field.
In the embodiment of the disclosure, data transmission is performed between the upper computer and the lower computer through the communication field. Specifically, in response to a trigger instruction of the driving signal, a communication field is generated according to an operation parameter of the target lower computer and a communication file, and data transmission is performed between the upper computer and the target lower computer according to the communication field. Different operation parameters can be combined with the communication file to generate different communication fields, so that data transmission between the upper computer and the lower computer with different functions is realized. In an example, the hosting of the communication file can be realized through a Driver, such as the Driver, and the host computer can host the generated communication file only by starting the Driver, so that the data transmission of the host computer and the lower computer is realized.
According to the embodiment of the disclosure, the communication field is generated in response to the triggering instruction of the driving signal, and the data transmission is performed between the upper computer and the lower computer according to the communication field, and the communication field can be automatically generated to perform the data transmission according to the motion parameters and the communication file only by triggering of the driving signal, so that the communication flow between the upper computer and the lower computer is simplified, the communication efficiency is improved, the communication file can be managed through the setting of the driving signal, the operations such as writing and reading of the data are realized, the workload of developers and operation and maintenance personnel is further reduced, and the method is suitable for more application scenes.
In one embodiment, as shown in fig. 4, the target communication parameters include a parameter synchronization period, and the generating a communication field according to the operation parameters of the target lower computer and the communication file includes:
step S311, periodically acquiring the operation parameters of the target lower computer according to the parameter synchronization period;
step S312, generating a communication field according to the operation parameters and the communication file.
In the embodiment of the disclosure, the target communication parameters include a parameter synchronization period, and in some application scenarios, the operation parameters of the lower computer are changed, so that the changed operation parameters of the lower computer need to be acquired. In one example, setting the parameter synchronization period may be achieved by setting a synchronization frequency of the communication tag, and periodically obtaining the operation parameters corresponding to different communication tags according to the synchronization frequency of the different communication tags. In one example, when the operation parameter of the target lower computer acquired in the current period is the same as the previous period, no new communication field needs to be generated; when the operation parameters of the target lower computer acquired in the current period are different from those of the previous period, a corresponding communication field is generated, so that the synchronous update of the communication field along with the change of the operation parameters of the lower computer is realized.
In the embodiment of the disclosure, the target communication parameters include a parameter synchronization period, and when the communication field is generated, the operation parameters of the target lower computer are periodically acquired according to the parameter synchronization period, and the communication field is generated, so that synchronous update of the operation parameters of the lower computer is realized, the communication field is generated according to the updated operation parameters to perform data transmission, the operation flow of communication between the upper computer and the lower computer is simplified, and the method is suitable for more application scenes.
In one embodiment, the data transmission between the upper computer and the target lower computer according to the communication field includes:
and under the condition that the communication field is marked with a preset label, carrying out data transmission between the upper computer and the target lower computer according to a preset communication confirmation mechanism.
In the embodiment of the disclosure, when data transmission is performed based on the communication field, when the communication field is marked with the preset tag, the data transmission is performed between the upper computer and the target lower computer according to the preset communication confirmation mechanism. Specifically, when a preset association relationship between the equipment parameter and the communication parameter is set, whether the communication parameter is marked by using a preset label can be determined according to an actual application scene, for example, when a function corresponding to the communication parameter needs to be implemented by a pulse mechanism, the communication parameter can be marked by using the preset label; when the importance of the function corresponding to the communication parameter is high, the preset label can be used for marking the communication parameter. When the communication parameters are the communication parameters marked by the preset labels, the communication fields corresponding to the communication parameters are marked with the preset labels when the communication fields are generated. In this embodiment, the preset tag may be implemented by handshake field planning, so that handshake fields are planned for corresponding communication parameters, so that handshake can be performed when data transmission is performed in the corresponding communication fields, that is, data transmission is performed between the upper computer and the lower computer according to a preset communication acknowledgement mechanism, where the preset communication acknowledgement mechanism includes a handshake mechanism, and reliability of data transmission can be ensured through the preset communication acknowledgement mechanism.
According to the embodiment of the disclosure, under the condition that the communication field is marked with the preset label, data transmission is performed between the upper computer and the lower computer according to the preset communication confirmation mechanism, so that the communication confirmation mechanisms such as a handshake mechanism and the like can be automatically realized, the effectiveness, the safety and the reliability of the data transmission are ensured, the communication field is suitable for more application scenes, manual setting of a user is not needed, the communication flow is simplified, and the workload of a developer is reduced.
In one embodiment, the method further comprises:
and under the condition that the data transmission between the upper computer and the target lower computer fails, carrying out data transmission according to a preset retry mechanism, and sending alarm information.
In the embodiment of the disclosure, under the condition that data transmission between the upper computer and the lower computer fails, the data transmission is performed according to a preset retry mechanism, and alarm information is sent. Specifically, when the data transmission between the upper computer and the lower computer fails, a retry mechanism, that is, a preset retry mechanism, can be triggered to automatically retry, perform data transmission again, and send alarm information. In one example, network anomalies, program anomalies, etc. may cause data transmission failures. The alarm information may include, but is not limited to, a communication field corresponding to transmission failure, failure times, failure time, etc., and may be specifically set according to an actual application scenario. In one example, the alarm information may be sent to a corresponding operator, so as to notify the operator in time, thereby improving data transmission security. In one example, the preset retry mechanism may be implemented through a program interface. In one example, when a large number of pulse mechanisms are written in the program, a preset retry mechanism is set, so that the reliability of data transmission is ensured.
According to the embodiment of the disclosure, when communication transmission between the upper computer and the lower computer fails, data transmission is performed according to the preset retry mechanism, and the alarm information is sent, so that the reliability of transmitted data can be ensured under the scenes of network abnormality, program abnormality and the like, the effectiveness of data transmission is improved, operators are prompted through the alarm information, the safety of software is ensured, and the method is suitable for more application scenes.
Fig. 5 is a schematic software architecture diagram of a communication assembly according to an exemplary embodiment, through which the method for generating a communication file and data transmission between the upper computer and the lower computer described in the foregoing embodiments may be implemented. Referring to fig. 5, a software engineer and an electrical engineer together formulate a standard Excel communication template, and a code can be automatically generated by using the communication template to obtain a DLL file. The operation parameters of the lower computer can be written in through the business logic arranged in the application program, the DLL file is updated through writing-in and reading-out operations, and the written data comprises communication labels in one example, the communication labels can be divided into large labels and small labels according to actual application scenes, and the large labels and the small labels are written in the lower computer through different channels respectively. In this embodiment, the operation parameters of the lower computer are read according to the refresh period (i.e., the parameter synchronization period) of the tag set in the communication template, and when the operation parameters of the lower computer are updated, the corresponding synchronization DLL file, the communication field in the WPF UI interface in the application program is updated synchronously, and in one example, the operation parameters of the lower computer may be read by a multi-channel scanning manner. In this embodiment, during the process of automatically generating the code by using the communication template, the event is bound in the application program by notifying the event. In one example, the buffering, updating and data transmission of the communication template can be implemented in a communication component layer, and the communication component layer can also store historical data.
In the embodiment of the disclosure, a communication template of an Excel document capable of generating codes is firstly established, an association relation between equipment parameters and communication parameters is established, and communication parameters such as synchronous frequency, variable setting, meaning definition of variables, communication handshake field planning and the like of communication labels can be set in the Excel. And the development rules of the electric and software are restricted through the communication template, so that the risk of technical deviation of project developers is reduced, the workload is reduced, and the communication efficiency is improved. In this embodiment, the code (i.e., the communication text) is generated by the automatic code generating tool, the tool can set the communication template needed to generate the code, and the DLL file of the communication is automatically generated by the configuration options of the table, so that the software does not need to write the code to realize operations such as reading and writing of variables, and the development efficiency of the software is effectively improved. The upper computer starts the Driver (i.e. the Driver), the generated DLL file can be managed, the direct reading and operation of the data are realized, in the process, the starting is automatically generated through the data of the address field corresponding to the lower computer, wherein the operation parameters of the lower computer are read according to the synchronous frequency configured in the communication template, the communication field is automatically updated, and the software does not need to do additional reading action. In one example, when a change occurs in a lower computer operating parameter, an event is notified to the upper computer. In this embodiment, a retry mechanism is further provided, and when the data transmission such as the communication timeout fails, the retry mechanism is used to perform the data transmission.
In the embodiment, the communication modes of the upper computer and the lower computer are normalized, embodied and unified through an Excel communication template; the unification of the upper computer and the lower computer is realized, and the maintainability and reusability of software in research and development projects are improved; an embedded communication handshake checking mechanism and a retry mechanism are adopted, so that the reliability of data is ensured when a network is abnormal and a program is abnormal, an alarm prompts an operator, and the safety of software is ensured; an automatic code generation mechanism is adopted, so that the development efficiency of software is greatly improved; by adopting a multi-process and single-process simulation mechanism, the simulation lower computer can be performed offline, and the development period and the debugging period of the equipment are shortened.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a communication file generation device for realizing the above related communication file generation method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiment of the device for generating one or more communication files provided below may refer to the limitation of the method for generating a communication file hereinabove, and will not be described herein.
In an exemplary embodiment, as shown in fig. 6, there is provided a communication file generating apparatus 600, including:
an obtaining module 610, configured to respond to an input instruction of an equipment parameter, and obtain a target lower computer and a target equipment parameter corresponding to the input instruction;
a determining module 620, configured to determine a target communication parameter that matches the target device parameter based on a preset association between the device parameter and the communication parameter, where the preset association is determined based on a relationship between a lower computer control logic corresponding to the device parameter and the communication parameter;
the generating module 630 is configured to generate a communication file that matches the target communication parameter, where the communication file is used for performing data transmission between an upper computer and the target lower computer based on the operation parameter of the target lower computer.
In one embodiment, the generating module includes:
the first generation sub-module is used for generating a communication text corresponding to the target communication parameters, and the communication text is used for providing interface parameters and functions;
and the first determining submodule is used for determining the communication file matched with the communication text according to the program type corresponding to the target lower computer.
In one embodiment, the apparatus further comprises:
the second generation sub-module is used for responding to the triggering instruction of the driving signal and generating a communication field according to the operation parameters of the target lower computer and the communication file;
and the first transmission sub-module is used for carrying out data transmission between the upper computer and the target lower computer according to the communication field.
In one embodiment, the target communication parameter includes a parameter synchronization period, and the second generating sub-module includes:
the acquisition unit is used for periodically acquiring the operation parameters of the target lower computer according to the parameter synchronization period;
and the generating unit is used for generating a communication field according to the operation parameters and the communication file.
In one embodiment, the first transmission sub-module includes:
and the transmission unit is used for carrying out data transmission between the upper computer and the target lower computer according to a preset communication confirmation mechanism under the condition that the communication field is marked with a preset label.
In one embodiment, the apparatus further comprises:
and the second transmission sub-module is used for carrying out data transmission according to a preset retry mechanism and sending alarm information under the condition that the data transmission between the upper computer and the target lower computer fails.
All or part of the modules in the communication file generating device can be realized by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one exemplary embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data related to the method in this embodiment, such as the association relationship between the device parameters and the communication parameters. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of generating a communication file.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use, and processing of the related data are required to meet the related regulations.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method for generating a communication file, the method comprising:
responding to an input instruction of equipment parameters, and acquiring target lower computer and target equipment parameters corresponding to the input instruction;
determining a target communication parameter matched with the target equipment parameter based on a preset association relation between the equipment parameter and the communication parameter, wherein the preset association relation is determined based on a relation between lower computer control logic corresponding to the equipment parameter and the communication parameter;
and generating a communication file matched with the target communication parameters, wherein the communication file is used for carrying out data transmission between an upper computer and the target lower computer based on the operation parameters of the target lower computer.
2. The method of claim 1, wherein generating a communication file that matches the target communication parameter comprises:
generating a communication text corresponding to the target communication parameters, wherein the communication text is used for providing interface parameters and functions;
and determining the communication file matched with the communication text according to the program type corresponding to the target lower computer.
3. The method according to claim 1, wherein the method further comprises:
responding to a triggering instruction of a driving signal, and generating a communication field according to the operation parameters of the target lower computer and the communication file;
and carrying out data transmission between the upper computer and the target lower computer according to the communication field.
4. The method of claim 3, wherein the target communication parameters include a parameter synchronization period, and the generating a communication field according to the operation parameters of the target lower computer and the communication file includes:
periodically acquiring the operation parameters of the target lower computer according to the parameter synchronization period;
and generating a communication field according to the operation parameters and the communication file.
5. The method of claim 3, wherein the transmitting data between the host computer and the target lower computer according to the communication field comprises:
and under the condition that the communication field is marked with a preset label, carrying out data transmission between the upper computer and the target lower computer according to a preset communication confirmation mechanism.
6. The method according to claim 1, wherein the method further comprises:
and under the condition that the data transmission between the upper computer and the target lower computer fails, carrying out data transmission according to a preset retry mechanism, and sending alarm information.
7. A device for transmitting a communication file, the device comprising:
the acquisition module is used for responding to an input instruction of the equipment parameters and acquiring the target lower computer and the target equipment parameters corresponding to the input instruction;
the determining module is used for determining a target communication parameter matched with the target equipment parameter based on a preset association relation between the equipment parameter and the communication parameter, wherein the preset association relation is determined based on a relation between lower computer control logic corresponding to the equipment parameter and the communication parameter;
the generation module is used for generating a communication file matched with the target communication parameters, and the communication file is used for carrying out data transmission between the upper computer and the target lower computer based on the operation parameters of the target lower computer.
8. The apparatus of claim 7, wherein the generating module comprises:
the first generation sub-module is used for generating a communication text corresponding to the target communication parameters, and the communication text is used for providing interface parameters and functions;
and the first determining submodule is used for determining the communication file matched with the communication text according to the program type corresponding to the target lower computer.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311399389.7A 2023-10-25 2023-10-25 Communication file generation method, device, computer equipment and storage medium Pending CN117389534A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311399389.7A CN117389534A (en) 2023-10-25 2023-10-25 Communication file generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311399389.7A CN117389534A (en) 2023-10-25 2023-10-25 Communication file generation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117389534A true CN117389534A (en) 2024-01-12

Family

ID=89468135

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311399389.7A Pending CN117389534A (en) 2023-10-25 2023-10-25 Communication file generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117389534A (en)

Similar Documents

Publication Publication Date Title
CN104903884B (en) Field apparatus collocation method, field apparatus configuration verification method and the asset management system
CN108351636B (en) Engineering design tool, system and module
CN102867010B (en) The system and method that taking-up, storage and supply arrangement define fileinfo
TWI608344B (en) Robust hardware fault management system, method and framework for enterprise devices
CN106603281A (en) Configuration file management method and system
JP6822153B2 (en) Improved test manager for industrial automation controllers
US9921569B2 (en) Field device commissioning system and method
JP2016530647A5 (en)
US10452044B2 (en) Operating system and method for identifying and displaying operator accesses to process objects and operator system
CN110716878A (en) Automatic interface testing method, device and system
CN113094125B (en) Business process processing method, device, server and storage medium
US10754748B2 (en) System and method for constructing extensible event log with javascript object notation (JSON) encoded payload data
JP2014217186A (en) Electronic equipment, verification method and verification program
JP2019049802A (en) Failure analysis supporting device, incident managing system, failure analysis supporting method, and program
CN110968456B (en) Method and device for processing fault disk in distributed storage system
CN117389534A (en) Communication file generation method, device, computer equipment and storage medium
EP3723346A1 (en) Selective address space aggregation
CN116431731A (en) Data asynchronous export method, device, equipment and storage medium thereof
CN113467782B (en) Method, device and equipment for determining business process
KR20230117765A (en) Process mining for multi-instance processes
CN114047976A (en) Plug-in loading method and device, electronic equipment and storage medium
CN115858049B (en) RPA flow componentization arrangement method, device, equipment and medium
CN114201240B (en) Method and device for configuring helm chart
EP4328681A1 (en) Method and system for managing technical installation during occurrence of error state in a controller
US20160196136A1 (en) Method and system for monitoring quality control activities during development of a software application

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