CN103399528A - Automatic generation method for Modbus slave-station simulator system - Google Patents
Automatic generation method for Modbus slave-station simulator system Download PDFInfo
- Publication number
- CN103399528A CN103399528A CN2013102376876A CN201310237687A CN103399528A CN 103399528 A CN103399528 A CN 103399528A CN 2013102376876 A CN2013102376876 A CN 2013102376876A CN 201310237687 A CN201310237687 A CN 201310237687A CN 103399528 A CN103399528 A CN 103399528A
- Authority
- CN
- China
- Prior art keywords
- source code
- behavior
- slave station
- generate
- modbus
- 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.)
- Granted
Links
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides an automatic generation method for a Modbus slave-station simulator system. The slave-station simulator system is customized from the aspects including external behavior description, Modbus slave-station information description and external characteristic description. The slave-station simulator system possess excellent equipment similarity, which can substitute equipment for consistency and interoperability tests before and after production. The method can not only customize operation program of the slave-station simulator system but also generate source codes, wherein the source codes can be directly applied to development of a protocol device. The automatic generation method of the invention can reduce the complexity of protocol engineering, and has great significance in automation of the protocol engineering.
Description
Technical field
The invention belongs to the communication protocol technical field of automation, be specifically related to a kind of automatic generation method of Modbus slave station simulation system.
Background technology
The Modbus agreement is a kind of puppy parc that is applied on electronic controller.Modbus can support multiple electric interfaces,, as RS232, RS485 etc., can also transmit on various media, as twisted-pair feeder, optical fiber, wireless etc.; The frame format of Modbus is simple, compact, and is easy-to-understand, and the user uses easily, and manufacturer's exploitation is simple, and it has become a universal industrial standard that receives praises from customers.
Along with the development of industrial automation technology, industrial communication equipment (abbreviation device) quantity that meets the Modbus agreement is on the increase.In order to make various communication facilitiess can realize interconnecting, protocol conformance and interoperability are had higher requirement.The testing protocol consistency of this device is the essential link before device comes into operation.For to device before producing and can carry out easily consistance and HIST afterwards, the simulator that research and development meet this device communication protocol is very significant, can reduce to a great extent the development risk of device, the shortening construction cycle.
The simulator of present most Modbus agreement industry communication facilitiess (device) is custom-designed for corresponding specific device, and its simulation softward is the various characteristics of analogue means preferably, but does not possess versatility, and the workload of being transplanted on other device is very large.Although some simulator possesses versatility to a certain degree, open customized parameter is few, and the surface of analogue means, be of limited application well.Therefore the simulator of developing the Modbus protocol apparatus that can freely customize and have versatility is significant.
At present, it is that test job facilitates that Modbus protocol apparatus Simulator design target mostly is replacement existing protocol device, and only provides working procedure, can not provide the source code support for device development.
Summary of the invention
In order to overcome above-mentioned the deficiencies in the prior art, the invention provides a kind of automatic generation method of Modbus slave station simulation system, describing many aspects from external behavior description, the description of Modbus slave station information and surface customizes the slave station simulation system that generates, the slave station simulation system that generates has good unit affinity, can replace device to carry out consistance and HIST work before device is produced and after producing.The method not only can also generate source code by generating custom slave station simulation system working procedure, source code can directly apply to the exploitation of protocol apparatus itself, therefore the present invention, to reducing the complexity of protocol engineering, realizes that the protocol engineering robotization is significant.
In order to realize the foregoing invention purpose, the present invention takes following technical scheme:
A kind of automatic generation method of Modbus slave station simulation system is provided, said method comprising the steps of:
Step 1: definition XML format file;
Step 2: generate RS232.CS source code, SEQ.CS source code and NOSEQ.CS source code;
Step 3: generate CH_RECEIVE.CS source code, CRC_RIGHT.CS source code, CMD_EXPLAIN.CS source code, DO_CMD.CS source code, ORG_DATA.CS source code and SEND_DATA.CS source code;
Step 4: generate Modbus SLAVE.CS source code;
Step 5: generate Modbus slave station simulation system.
Comprise the following steps in described step 1:
Step 1-1: set up the external behavior model of Modbus slave station, and the XML format file of external behavior is described in definition;
Step 1-2: set up the Modbus slave station information model of Modbus slave station, and the XML format file of Modbus slave station information is described in definition;
Step 1-3: set up the surface model of Modbus slave station, and the XML format file of surface is described in definition.
Described step 1-1 comprises the following steps:
Step 1-1-1: set up the external behavior model of Modbus slave station, specifically comprise the following steps:
Steps A: the external behavior of Modbus slave station is divided into Receive behavior and Send behavior, and it is the necessary condition that the Send behavior is triggered that described Receive behavior is successfully completed;
Step B: the delay parameter that defines each sub-behavior of the sub-behavior of described Receive behavior and Receive behavior;
The sub-behavior of described Receive behavior comprises CH_RECEIVE, CRC_RIGHT and CMD_EXPLAIN, wherein, CH_RECEIVE checks whether be subject to the data that the Modbus main website sends by RS-232 interface, whether the data CRC check that the CRC_RIGHT verification is sent is correct, CMD_EXPLAIN checks whether message meets the Modbus command format, and explains the command type of receiving;
Step C: the delay parameter of the sub-behavior of definition Send behavior and each sub-behavior of Send behavior;
The sub-behavior of described Send behavior comprises DO_CMD, ORG_DATA and SEND_DATA, and wherein DO_CMD carries out the order that the Modbus main website carries out, and the ORG_DATA packing needs the data message that sends, and SEND_DATA sends the response message of having packed;
Step 1-1-2: according to the external behavior model of described Modbus slave station, the XML format file of external behavior is described in definition; The sub-behavior delay parameter of described Receive behavior and the sub-behavior delay parameter of Send behavior all can be changed customization.
Described step 1-2 comprises the following steps:
Step 1-2-1: the Modbus slave station information model of setting up the Modbus slave station;
Modbus slave station information comprises COILS, INSTATUS, HOLDREG and INREG, represents respectively coil, input state, holding register and input register, and COILS, INSTATUS, HOLDREG and INREG all describe with start address and quantity;
Step 1-2-2: the XML format file of describing Modbus slave station information according to the Modbus slave station information model definition of Modbus slave station; The start address of described COILS, INSTATUS, HOLDREG and INREG and quantity parameter all can be changed customization.
In described step 1-3, set up the surface model of Modbus slave station, and describe the XML format file of surface according to the surface model definition of Modbus slave station;
Described surface comprises Modbus tributary address, Modbus response timeout time and RS232 interface configuration parameter, and the three all can change customization.
Described step 2 comprises the following steps:
Step 2-1: generate the RS232.CS source code;
Step 2-2: genesis sequence structure base class SEQ, output SEQ.CS source code;
Step 2-3: generate non-order atom behavior base class NOSEQ, output NOSEQ.CS source code.
Described step 2-1 comprises the following steps:
Step 2-1-1: generate the RS232 interface and control the head source code of class, comprise the statement part of quoting part and RS232 interface control class;
Step 2-1-2: generate the RS232 interface and control the RUN operation of class, and generate RS232 serial ports class example, start the RS232 interface;
Step 2-1-3: generate the RS232 interface and control the STOP operation of class, make the RS232 interface close;
Step 2-1-4: generate the RS232 interface and control the READ operation of class, make the RS232 interface receive and read buffered data;
Step 2-1-5: generate the RS232 interface and control the WRITE operation of class, the data that send are write the transmission buffer zone of RS232 interface;
Step 2-1-6: generate the RS232 interface and control the afterbody source code of class, output RS232.CS source code.
Step 2-2 comprises the following steps:
Step 2-2-1: the head source code of genesis sequence structure base class SEQ comprises the statement part of quoting part and sequential organization base class SEQ;
Step 2-2-2: the RUN operation of genesis sequence structure base class SEQ, call its all child nodes in the RUN operation, all child nodes are returned very, and the RUN operation is returned very, otherwise vacation is returned in the RUN operation;
Step 2-2-3: the afterbody source code of genesis sequence structure base class SEQ, output SEQ.CS source code.
Described step 2-3 comprises the following steps:
Step 2-3-1: generate the head source code of non-order atom behavior base class NOSEQ, comprise the statement part of quoting part and non-order atom behavior base class NOSEQ;
Step 2-3-2: generate the abstract RUN operation of non-order atom behavior base class NOSEQ, the return type of RUN operation is defined as bool type, body of laws not properly;
Step 2-3-3: generate the afterbody source code of non-order atom behavior base class NOSEQ, output NOSEQ.CS source code.
Described step 3 comprises the following steps:
Step 3-1: the subclass of genesis sequence structure base class SEQ, output source code; Specifically comprise:
Step 3-1-1: the subclass Receive of genesis sequence structure base class SEQ, output Receive.CS source code;
Step 3-1-2: the subclass Send of genesis sequence structure base class SEQ, output Send.CS source code;
Step 3-2: generate the subclass of non-order atom behavior base class NOSEQ, the output source code; Specifically comprise:
Step 3-2-1: generate the subclasses C H_RECEIVE.CS of non-order atom behavior base class NOSEQ, output CH_RECEIVE.CS source code;
Step 3-2-2: generate the subclasses C RC_RIGHT of non-order atom behavior base class NOSEQ, output CRC_RIGHT.CS source code;
Step 3-2-3: generate the subclasses C MD_EXPLAIN of non-order atom behavior base class NOSEQ, output CMD_EXPLAIN.CS source code;
Step 3-2-4: generate the subclass DO_CMD of non-order atom behavior base class NOSEQ, output DO_CMD.CS source code;
Step 3-2-5: generate the subclass ORG_DATA of non-order atom behavior base class NOSEQ, output ORG_DATA.CS source code;
Step 3-2-6: generate the subclass SEND_DATA of non-order atom behavior base class NOSEQ, output SEND_DATA.CS source code.
In described step 4, according to the XML format file of the description Modbus slave station information that defines and the XML format file of description surface, generate Modbus SLAVE.CS source code, specifically comprise the following steps:
Step 4-1: the head source code that generates Modbus SLAVE class;
Step 4-2: will describe COILS, INSTATUS, HOLDREG and INREG in the XML format file of Modbus slave station information and be mapped to the array of bool class and Int16 class, and generate the array source code;
Step 4-3: will describe Modbus tributary address, Modbus response timeout time and RS232 interface configuration parameter in the XML format file of surface and be mapped to respectively three publicly-owned variablees of program language;
Step 4-4: generate the MAIN operation, initialization also triggers the operation of Modbus slave station simulation system;
Step 4-5: generate the afterbody source code of Modbus SLAVE class, output Modbus SLAVE.CS source code.
In described step 5, merge and compile the source code of all outputs, generate Modbus slave station simulation system.
Compared with prior art, beneficial effect of the present invention is:
The present invention customizes the slave station simulation system that generates from many aspects such as external behavior description, the description of Modbus slave station information and surface descriptions, the slave station simulation system that generates has good unit affinity, overcome the problem that existing simulator can not carry out degree of depth customization etc., can carry out consistance and HIST work by the replacement device before device is produced and after producing.The method not only can also generate source code by generating custom slave station simulation system working procedure, and source code can directly apply to the exploitation of protocol apparatus itself, has overcome existing simulator and can not be used for instructing the problem of slave station device development.The present invention, to reducing the complexity of protocol engineering, realizes that the protocol engineering robotization is significant.
Description of drawings
Fig. 1 is the connection diagram of Modbus slave station and Modbus main website;
Fig. 2 is the connection diagram of Modbus slave station simulation system and Modbus main website.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in further detail.
The invention provides a kind of automatic generation method of Modbus slave station simulation system, the problem that coordinates simulation software simulation Modbus to communicate from station equipment and Modbus main website to solve computing machine RS232 interface.As shown in Figure 1, the Modbus main website communicates from station arrangement by RS232 interface or RS485 interface and Modbus communication modes while not using the Modbus simulation system.Use after the Modbus simulation system communication modes as shown in Figure 2, the Modbus main website communicates with the Modbus slave station simulation system that RS232 interface by computer software and computing machine forms.
Task of the present invention is to provide a kind of automatic generation method of Modbus slave station simulation system, the problem that coordinates simulation software simulation Modbus to communicate from station equipment and Modbus main website to solve computing machine RS232 interface, and it is poor and the problem of source code support can not be provided for installing exploitation itself to solve in the past MODBUS slave station unit simulator customization capability.For completing above-mentioned task, at first the present invention provides a kind of XML document form that Modbus is described from the station arrangement external characteristic, the document is described from external behavior, the description of Modbus slave station information and surface are described three aspects Modbus are described from station arrangement, and the user can utilize the document structure to carry out free customization to Modbus from station arrangement.Then system generates each program class of Modbus slave station simulator program according to user's customization document, and the needed common program class of generation Modbus slave station simulator program that provides some and customization to have nothing to do, all source codes and the compiling generation Modbus slave station dry run program that finally generate Modbus slave station simulation system are utilized computing machine RS232 Interface realization Modbus slave station simulation system.The method that this invention provides is significant for the robotization of Modbus protocol engineering.
A kind of automatic generation method of Modbus slave station simulation system is provided, said method comprising the steps of:
Step 1: definition XML format file;
Step 2: generate RS232.CS source code, SEQ.CS source code and NOSEQ.CS source code;
Step 3: generate CH_RECEIVE.CS source code, CRC_RIGHT.CS source code, CMD_EXPLAIN.CS source code, DO_CMD.CS source code, ORG_DATA.CS source code and SEND_DATA.CS source code;
Step 4: generate Modbus SLAVE.CS source code;
Step 5: generate Modbus slave station simulation system.
Comprise the following steps in described step 1:
Step 1-1: set up the external behavior model of Modbus slave station, and the XML format file of external behavior is described in definition;
Step 1-2: set up the Modbus slave station information model of Modbus slave station, and the XML format file of definition description Modbus slave station information, form is as follows:
Step 1-3: set up the surface model of Modbus slave station, and the XML format file of definition description surface, form is as follows:
Described step 1-1 comprises the following steps:
Step 1-1-1: set up the external behavior model of Modbus slave station, specifically comprise the following steps:
Steps A: the external behavior of Modbus slave station is divided into Receive behavior and Send behavior, and it is the necessary condition that the Send behavior is triggered that described Receive behavior is successfully completed;
Step B: the delay parameter that defines each sub-behavior of the sub-behavior of described Receive behavior and Receive behavior;
The sub-behavior of described Receive behavior comprises CH_RECEIVE, CRC_RIGHT and CMD_EXPLAIN, wherein, CH_RECEIVE checks whether be subject to the data that the Modbus main website sends by RS-232 interface, whether the data CRC check that the CRC_RIGHT verification is sent is correct, CMD_EXPLAIN checks whether message meets the Modbus command format, and explains the command type of receiving;
Step C: the delay parameter of the sub-behavior of definition Send behavior and each sub-behavior of Send behavior;
The sub-behavior of described Send behavior comprises DO_CMD, ORG_DATA and SEND_DATA, and wherein DO_CMD carries out the order that the Modbus main website carries out, and the ORG_DATA packing needs the data message that sends, and SEND_DATA sends the response message of having packed;
Step 1-1-2: according to the external behavior model of described Modbus slave station, the XML format file of external behavior is described in definition; The sub-behavior delay parameter of described Receive behavior and the sub-behavior delay parameter of Send behavior all can be changed customization.
Described step 1-2 comprises the following steps:
Step 1-2-1: the Modbus slave station information model of setting up the Modbus slave station;
Modbus slave station information comprises COILS, INSTATUS, HOLDREG and INREG, represents respectively coil, input state, holding register and input register, and COILS, INSTATUS, HOLDREG and INREG all describe with start address and quantity;
Step 1-2-2: the XML format file of describing Modbus slave station information according to the Modbus slave station information model definition of Modbus slave station; The start address of described COILS, INSTATUS, HOLDREG and INREG and quantity parameter all can be changed customization.
In described step 1-3, set up the surface model of Modbus slave station, and describe the XML format file of surface according to the surface model definition of Modbus slave station, form is as follows:
1~255), the Modbus response timeout time, (span: 10ms~2000ms) and RS232 interface configuration parameter, the three all can change customization described surface comprises Modbus tributary address (span:.
Described step 2 comprises the following steps:
Step 2-1: generate the RS232.CS source code;
Step 2-2: genesis sequence structure base class SEQ, output SEQ.CS source code;
Step 2-3: generate non-order atom behavior base class NOSEQ, output NOSEQ.CS source code.
Described step 2-1 comprises the following steps:
Step 2-1-1: generate the RS232 interface and control the head source code of class, comprise the statement part of quoting part and RS232 interface control class;
Step 2-1-2: generate the RS232 interface and control the RUN operation of class, and generate RS232 serial ports class example, start the RS232 interface;
Step 2-1-3: generate the RS232 interface and control the STOP operation of class, make the RS232 interface close;
Step 2-1-4: generate the RS232 interface and control the READ operation of class, make the RS232 interface receive and read buffered data;
Step 2-1-5: generate the RS232 interface and control the WRITE operation of class, the data that send are write the transmission buffer zone of RS232 interface;
Step 2-1-6: generate the RS232 interface and control the afterbody source code of class, output RS232.CS source code.
Step 2-2 comprises the following steps:
Step 2-2-1: the head source code of genesis sequence structure base class SEQ comprises the statement part of quoting part and sequential organization base class SEQ;
Step 2-2-2: the RUN operation of genesis sequence structure base class SEQ, call its all child nodes in the RUN operation, all child nodes are returned very, and the RUN operation is returned very, otherwise vacation is returned in the RUN operation;
Step 2-2-3: the afterbody source code of genesis sequence structure base class SEQ, output SEQ.CS source code.
Described step 2-3 comprises the following steps:
Step 2-3-1: generate the head source code of non-order atom behavior base class NOSEQ, comprise the statement part of quoting part and non-order atom behavior base class NOSEQ;
Step 2-3-2: generate the abstract RUN operation of non-order atom behavior base class NOSEQ, the return type of RUN operation is defined as bool type, body of laws not properly;
Step 2-3-3: generate the afterbody source code of non-order atom behavior base class NOSEQ, output NOSEQ.CS source code.
Described step 3 comprises the following steps:
Step 3-1: the subclass of genesis sequence structure base class SEQ, output source code; Specifically comprise:
Step 3-1-1: the subclass Receive of genesis sequence structure base class SEQ, output Receive.CS source code;
Step 3-1-2: the subclass Send of genesis sequence structure base class SEQ, output Send.CS source code;
Step 3-2: generate the subclass of non-order atom behavior base class NOSEQ, the output source code; Specifically comprise:
Step 3-2-1: generate the subclasses C H_RECEIVE.CS of non-order atom behavior base class NOSEQ, output CH_RECEIVE.CS source code;
Step 3-2-2: generate the subclasses C RC_RIGHT of non-order atom behavior base class NOSEQ, output CRC_RIGHT.CS source code;
Step 3-2-3: generate the subclasses C MD_EXPLAIN of non-order atom behavior base class NOSEQ, output CMD_EXPLAIN.CS source code;
Step 3-2-4: generate the subclass DO_CMD of non-order atom behavior base class NOSEQ, output DO_CMD.CS source code;
Step 3-2-5: generate the subclass ORG_DATA of non-order atom behavior base class NOSEQ, output ORG_DATA.CS source code;
Step 3-2-6: generate the subclass SEND_DATA of non-order atom behavior base class NOSEQ, output SEND_DATA.CS source code.
In described step 4, according to the XML format file of the description Modbus slave station information that defines and the XML format file of description surface, generate Modbus SLAVE.CS source code, specifically comprise the following steps:
Step 4-1: the head source code that generates Modbus SLAVE class;
Step 4-2: will describe COILS, INSTATUS, HOLDREG and INREG in the XML format file of Modbus slave station information and be mapped to the array of bool class and Int16 class, and generate the array source code;
Step 4-3: will describe Modbus tributary address, Modbus response timeout time and RS232 interface configuration parameter in the XML format file of surface and be mapped to respectively three publicly-owned variablees of program language;
Step 4-4: generate the MAIN operation, initialization also triggers the operation of Modbus slave station simulation system;
Step 4-5: generate the afterbody source code of Modbus SLAVE class, output Modbus SLAVE.CS source code.
In described step 5, merge and compile the source code of all outputs, generate Modbus slave station simulation system.
Should be noted that finally: above embodiment is only in order to illustrate that technical scheme of the present invention is not intended to limit, although with reference to above-described embodiment, the present invention is had been described in detail, those of ordinary skill in the field are to be understood that: still can modify or be equal to replacement the specific embodiment of the present invention, and do not break away from any modification of spirit and scope of the invention or be equal to replacement, it all should be encompassed in the middle of claim scope of the present invention.
Claims (12)
1. the automatic generation method of a Modbus slave station simulation system is characterized in that: said method comprising the steps of:
Step 1: definition XML format file;
Step 2: generate RS232.CS source code, SEQ.CS source code and NOSEQ.CS source code;
Step 3: generate CH_RECEIVE.CS source code, CRC_RIGHT.CS source code, CMD_EXPLAIN.CS source code, DO_CMD.CS source code, ORG_DATA.CS source code and SEND_DATA.CS source code;
Step 4: generate Modbus SLAVE.CS source code;
Step 5: generate Modbus slave station simulation system.
2. the automatic generation method of Modbus slave station simulation system according to claim 1 is characterized in that: comprise the following steps in described step 1:
Step 1-1: set up the external behavior model of Modbus slave station, and the XML format file of external behavior is described in definition;
Step 1-2: set up the Modbus slave station information model of Modbus slave station, and the XML format file of Modbus slave station information is described in definition;
Step 1-3: set up the surface model of Modbus slave station, and the XML format file of surface is described in definition.
3. the automatic generation method of Modbus slave station simulation system according to claim 2, it is characterized in that: described step 1-1 comprises the following steps:
Step 1-1-1: set up the external behavior model of Modbus slave station, specifically comprise the following steps:
Steps A: the external behavior of Modbus slave station is divided into Receive behavior and Send behavior, and it is the necessary condition that the Send behavior is triggered that described Receive behavior is successfully completed;
Step B: the delay parameter that defines each sub-behavior of the sub-behavior of described Receive behavior and Receive behavior;
The sub-behavior of described Receive behavior comprises CH_RECEIVE, CRC_RIGHT and CMD_EXPLAIN, wherein, CH_RECEIVE checks whether be subject to the data that the Modbus main website sends by RS-232 interface, whether the data CRC check that the CRC_RIGHT verification is sent is correct, CMD_EXPLAIN checks whether message meets the Modbus command format, and explains the command type of receiving;
Step C: the delay parameter of the sub-behavior of definition Send behavior and each sub-behavior of Send behavior;
The sub-behavior of described Send behavior comprises DO_CMD, ORG_DATA and SEND_DATA, and wherein DO_CMD carries out the order that the Modbus main website carries out, and the ORG_DATA packing needs the data message that sends, and SEND_DATA sends the response message of having packed;
Step 1-1-2: according to the external behavior model of described Modbus slave station, the XML format file of external behavior is described in definition; The sub-behavior delay parameter of described Receive behavior and the sub-behavior delay parameter of Send behavior all can be changed customization.
4. the automatic generation method of Modbus slave station simulation system according to claim 2, it is characterized in that: described step 1-2 comprises the following steps:
Step 1-2-1: the Modbus slave station information model of setting up the Modbus slave station;
Modbus slave station information comprises COILS, INSTATUS, HOLDREG and INREG, represents respectively coil, input state, holding register and input register, and COILS, INSTATUS, HOLDREG and INREG all describe with start address and quantity;
Step 1-2-2: the XML format file of describing Modbus slave station information according to the Modbus slave station information model definition of Modbus slave station; The start address of described COILS, INSTATUS, HOLDREG and INREG and quantity parameter all can be changed customization.
5. the automatic generation method of Modbus slave station simulation system according to claim 2, it is characterized in that: in described step 1-3, set up the surface model of Modbus slave station, and describe the XML format file of surface according to the surface model definition of Modbus slave station;
Described surface comprises Modbus tributary address, Modbus response timeout time and RS232 interface configuration parameter, and the three all can change customization.
6. the automatic generation method of Modbus slave station simulation system according to claim 1, it is characterized in that: described step 2 comprises the following steps:
Step 2-1: generate the RS232.CS source code;
Step 2-2: genesis sequence structure base class SEQ, output SEQ.CS source code;
Step 2-3: generate non-order atom behavior base class NOSEQ, output NOSEQ.CS source code.
7. the automatic generation method of Modbus slave station simulation system according to claim 6, it is characterized in that: described step 2-1 comprises the following steps:
Step 2-1-1: generate the RS232 interface and control the head source code of class, comprise the statement part of quoting part and RS232 interface control class;
Step 2-1-2: generate the RS232 interface and control the RUN operation of class, and generate RS232 serial ports class example, start the RS232 interface;
Step 2-1-3: generate the RS232 interface and control the STOP operation of class, make the RS232 interface close;
Step 2-1-4: generate the RS232 interface and control the READ operation of class, make the RS232 interface receive and read buffered data;
Step 2-1-5: generate the RS232 interface and control the WRITE operation of class, the data that send are write the transmission buffer zone of RS232 interface;
Step 2-1-6: generate the RS232 interface and control the afterbody source code of class, output RS232.CS source code.
8. the automatic generation method of Modbus slave station simulation system according to claim 6, it is characterized in that: step 2-2 comprises the following steps:
Step 2-2-1: the head source code of genesis sequence structure base class SEQ comprises the statement part of quoting part and sequential organization base class SEQ;
Step 2-2-2: the RUN operation of genesis sequence structure base class SEQ, call its all child nodes in the RUN operation, all child nodes are returned very, and the RUN operation is returned very, otherwise vacation is returned in the RUN operation;
Step 2-2-3: the afterbody source code of genesis sequence structure base class SEQ, output SEQ.CS source code.
9. the automatic generation method of Modbus slave station simulation system according to claim 6, it is characterized in that: described step 2-3 comprises the following steps:
Step 2-3-1: generate the head source code of non-order atom behavior base class NOSEQ, comprise the statement part of quoting part and non-order atom behavior base class NOSEQ;
Step 2-3-2: generate the abstract RUN operation of non-order atom behavior base class NOSEQ, the return type of RUN operation is defined as bool type, body of laws not properly;
Step 2-3-3: generate the afterbody source code of non-order atom behavior base class NOSEQ, output NOSEQ.CS source code.
10. the automatic generation method of Modbus slave station simulation system according to claim 1, it is characterized in that: described step 3 comprises the following steps:
Step 3-1: the subclass of genesis sequence structure base class SEQ, output source code; Specifically comprise:
Step 3-1-1: the subclass Receive of genesis sequence structure base class SEQ, output Receive.CS source code;
Step 3-1-2: the subclass Send of genesis sequence structure base class SEQ, output Send.CS source code;
Step 3-2: generate the subclass of non-order atom behavior base class NOSEQ, the output source code; Specifically comprise:
Step 3-2-1: generate the subclasses C H_RECEIVE.CS of non-order atom behavior base class NOSEQ, output CH_RECEIVE.CS source code;
Step 3-2-2: generate the subclasses C RC_RIGHT of non-order atom behavior base class NOSEQ, output CRC_RIGHT.CS source code;
Step 3-2-3: generate the subclasses C MD_EXPLAIN of non-order atom behavior base class NOSEQ, output CMD_EXPLAIN.CS source code;
Step 3-2-4: generate the subclass DO_CMD of non-order atom behavior base class NOSEQ, output DO_CMD.CS source code;
Step 3-2-5: generate the subclass ORG_DATA of non-order atom behavior base class NOSEQ, output ORG_DATA.CS source code;
Step 3-2-6: generate the subclass SEND_DATA of non-order atom behavior base class NOSEQ, output SEND_DATA.CS source code.
11. the automatic generation method of Modbus slave station simulation system according to claim 1, it is characterized in that: in described step 4, generate Modbus SLAVE.CS source code according to the XML format file of the description Modbus slave station information that defines and the XML format file of description surface, specifically comprise the following steps:
Step 4-1: the head source code that generates Modbus SLAVE class;
Step 4-2: will describe COILS, INSTATUS, HOLDREG and INREG in the XML format file of Modbus slave station information and be mapped to the array of bool class and Int16 class, and generate the array source code;
Step 4-3: will describe Modbus tributary address, Modbus response timeout time and RS232 interface configuration parameter in the XML format file of surface and be mapped to respectively three publicly-owned variablees of program language;
Step 4-4: generate the MAIN operation, initialization also triggers the operation of Modbus slave station simulation system;
Step 4-5: generate the afterbody source code of Modbus SLAVE class, output Modbus SLAVE.CS source code.
12. the automatic generation method of Modbus slave station simulation system according to claim 1 is characterized in that: in described step 5, merge and compile the source code of all outputs, generate Modbus slave station simulation system.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310237687.6A CN103399528B (en) | 2013-03-06 | 2013-06-14 | A kind of automatic generation method of Modbus slave station simulation system |
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013100713199 | 2013-03-06 | ||
CN201310071319 | 2013-03-06 | ||
CN201310071319.9 | 2013-03-06 | ||
CN201310237687.6A CN103399528B (en) | 2013-03-06 | 2013-06-14 | A kind of automatic generation method of Modbus slave station simulation system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103399528A true CN103399528A (en) | 2013-11-20 |
CN103399528B CN103399528B (en) | 2016-05-25 |
Family
ID=49563171
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310237687.6A Active CN103399528B (en) | 2013-03-06 | 2013-06-14 | A kind of automatic generation method of Modbus slave station simulation system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103399528B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103984555A (en) * | 2014-05-29 | 2014-08-13 | 四川航天系统工程研究所 | Method for automatically generating specific platform communication protocol source code on basis of tree-table combination drive |
CN105025056A (en) * | 2014-04-25 | 2015-11-04 | 上海迪爱斯通信设备有限公司 | Internet of Things information collection and monitoring system design method |
CN106506187A (en) * | 2015-09-08 | 2017-03-15 | 中兴通讯股份有限公司 | The communication means of equipment simulator and system |
WO2017166267A1 (en) * | 2016-04-01 | 2017-10-05 | Intel Corporation | Consistent generation and customization of simulation firmware and platform in computing environments |
CN109460231A (en) * | 2018-09-25 | 2019-03-12 | 北京通广龙电子科技有限公司 | Upper computer software implementation method based on XML |
CN112311808A (en) * | 2020-11-11 | 2021-02-02 | 上海电器科学研究所(集团)有限公司 | Method for automatically mapping Modbus protocol data to OPCUA address space |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101398755A (en) * | 2008-08-22 | 2009-04-01 | 满延平 | Software auto generating method based on template |
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
CN101464799A (en) * | 2009-01-16 | 2009-06-24 | 天津大学 | MPI parallel programming system based on visual modeling and automatic skeleton code generation method |
CN101776993A (en) * | 2009-01-09 | 2010-07-14 | 鸿富锦精密工业(深圳)有限公司 | System and method automatically generating software interactive interface |
CN102176200A (en) * | 2009-09-25 | 2011-09-07 | 南京航空航天大学 | Software test case automatic generating method |
US8117534B1 (en) * | 2004-06-09 | 2012-02-14 | Oracle America, Inc. | Context translation |
-
2013
- 2013-06-14 CN CN201310237687.6A patent/CN103399528B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8117534B1 (en) * | 2004-06-09 | 2012-02-14 | Oracle America, Inc. | Context translation |
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
CN101398755A (en) * | 2008-08-22 | 2009-04-01 | 满延平 | Software auto generating method based on template |
CN101776993A (en) * | 2009-01-09 | 2010-07-14 | 鸿富锦精密工业(深圳)有限公司 | System and method automatically generating software interactive interface |
CN101464799A (en) * | 2009-01-16 | 2009-06-24 | 天津大学 | MPI parallel programming system based on visual modeling and automatic skeleton code generation method |
CN102176200A (en) * | 2009-09-25 | 2011-09-07 | 南京航空航天大学 | Software test case automatic generating method |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105025056A (en) * | 2014-04-25 | 2015-11-04 | 上海迪爱斯通信设备有限公司 | Internet of Things information collection and monitoring system design method |
CN103984555A (en) * | 2014-05-29 | 2014-08-13 | 四川航天系统工程研究所 | Method for automatically generating specific platform communication protocol source code on basis of tree-table combination drive |
CN103984555B (en) * | 2014-05-29 | 2017-03-15 | 四川航天系统工程研究所 | A kind of tree table is combined and drives Windows/Linux platform communications protocol source profiles methods |
CN106506187A (en) * | 2015-09-08 | 2017-03-15 | 中兴通讯股份有限公司 | The communication means of equipment simulator and system |
WO2017041550A1 (en) * | 2015-09-08 | 2017-03-16 | 中兴通讯股份有限公司 | Device simulator communication method and system |
WO2017166267A1 (en) * | 2016-04-01 | 2017-10-05 | Intel Corporation | Consistent generation and customization of simulation firmware and platform in computing environments |
CN109460231A (en) * | 2018-09-25 | 2019-03-12 | 北京通广龙电子科技有限公司 | Upper computer software implementation method based on XML |
CN109460231B (en) * | 2018-09-25 | 2022-02-22 | 北京通广龙电子科技有限公司 | Upper computer software implementation method based on XML |
CN112311808A (en) * | 2020-11-11 | 2021-02-02 | 上海电器科学研究所(集团)有限公司 | Method for automatically mapping Modbus protocol data to OPCUA address space |
Also Published As
Publication number | Publication date |
---|---|
CN103399528B (en) | 2016-05-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103399528B (en) | A kind of automatic generation method of Modbus slave station simulation system | |
CN100514234C (en) | Open type numerical control system based on PC | |
CN104678778A (en) | Time synchronization of signal transmission intervals for simulating a machine in industrial automation | |
CN101266570B (en) | Software system test method and apparatus | |
CN102117571A (en) | Online teaching processing system for glue dispensing machine | |
CN104698950A (en) | Peripheral device control method, microcontroller, upper computer and system | |
CN105137800A (en) | PLC cooperative control device based on SOPC technology | |
CN102722126A (en) | Four-roll plate bending machine control system based on advanced RISC machine (ARM) and Wince | |
CN103538069A (en) | Robot control method, control device and control system | |
CN101630343B (en) | Simulation method and simulation system | |
CN104635682A (en) | IOT (Internet of Things) embedded MPS (Microprocessor System) measurement and control method and network system device | |
CN105807628A (en) | Robot flexible controller for complex CPS (Cyber Physical System) and implementation method thereof | |
CN102495552A (en) | Real-time simulation system oriented to space-borne electronic system | |
CN105487403A (en) | Establishment of motion control system based on CAN and simulation modeling method | |
CN103605526A (en) | Template componentized code generating method based on chain-of-responsibility pattern | |
CN106445818B (en) | A kind of automatized script adjustment method and device based on model-driven | |
CN101526805A (en) | PLC analog control system and analog control method thereof | |
CN205003526U (en) | PLC cooperative control device based on SOPC technique | |
CN103576667A (en) | Main control panel test method, device and system | |
CN110427260A (en) | Host job scheduling method, apparatus and system | |
CN102135762A (en) | Time trigger type real-time simulation control system | |
CN106354966B (en) | The method of the conversion of chip id E project file and rapid configuration artificial debugging environment | |
CN111526177B (en) | Smart city information-physical fusion-oriented intelligent Internet of things system construction method | |
CN106375284A (en) | STM32F103 based Mitsubishi FX type PLC communication converter and conversion method thereof | |
CN107515587A (en) | System, method, apparatus, equipment and the storage medium of man-machine interactive operation emulation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |