[go: up one dir, main page]

CN104317631A - Statement list to ladder diagram conversion method - Google Patents

Statement list to ladder diagram conversion method Download PDF

Info

Publication number
CN104317631A
CN104317631A CN201410572477.7A CN201410572477A CN104317631A CN 104317631 A CN104317631 A CN 104317631A CN 201410572477 A CN201410572477 A CN 201410572477A CN 104317631 A CN104317631 A CN 104317631A
Authority
CN
China
Prior art keywords
path
node number
stack top
source node
ladder diagram
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
Application number
CN201410572477.7A
Other languages
Chinese (zh)
Other versions
CN104317631B (en
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.)
Hunan Super Information Co Ltd
Original Assignee
Hunan Super Information 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 Hunan Super Information Co Ltd filed Critical Hunan Super Information Co Ltd
Priority to CN201410572477.7A priority Critical patent/CN104317631B/en
Publication of CN104317631A publication Critical patent/CN104317631A/en
Application granted granted Critical
Publication of CN104317631B publication Critical patent/CN104317631B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Programmable Controllers (AREA)

Abstract

The invention discloses a statement list to ladder diagram conversion method. Whether to execute commands or evaluate or not is decided according to values of current logic stack tops by LD/LDN commands, AND/ANDN commands, OR/ORN commands, ALD commands, OLD commands, LPS, LRD/LPP commands and coils and box commands, and extension can be realized optionally according to needs. The statement list to ladder diagram conversion method includes steps of setting up a necessary data structure, creating a route linked list, scanning a statement list to generate a route linked list, generating a new route linked list as the algorithm according the scanned commands, and extracting ladder diagrams from the route linked lists.

Description

Statement list is to the conversion method of ladder diagram
Technical field
The present invention relates to industrial control field, particularly statement list is to the conversion method of ladder diagram.
Background technology
Ladder diagram (Ladder Diagram) is as a kind of graphical programming language originating from early stage relay logical control circuit, because it is simple and easy to use, efficiently can realize complicated logic control function intuitively, the system that obtains from simple PLC to complexity in the middle of industrial control field is as all essential as one Distributed Control System (DCS) (DCS), field bus control system (FCS) and topmost programming language often.Ladder diagram generally can be compiled into as statement list, and in specific implementation, statement list is exactly often the elementary instruction of IEC61131-3 fictitious host computer, from binary program code and the statement list instruction one_to_one corresponding of fictitious host computer.For the reason of debugging maintenance, sometimes need to upload the PLC internal processes run, the binary code uploaded can be converted to statement list very easily, and statement list is text program language after all, do not have ladder diagram to seem directly perceived simple, therefore need statement list to be converted into ladder diagram.
Summary of the invention
The object of this invention is to provide the conversion method of a kind of statement list to ladder diagram.
The present invention is achieved by the following technical programs:
Statement list is to the conversion method of ladder diagram, with the instruction of LD/LDN class, the instruction of AND/ANDN class, the instruction of OR/ORN class, ALD instruction, OLD instruction, LPS, LRD during this five classes instruction of LPP instruction is, and coil (Coil) class and the instruction of function box (Box) class then determine whether performing or assignment according to the value of current logic stack top, can arbitrary extension as required; Concrete steps are as follows:
Step 1: set up necessary data structure;
Step 2: Make Path chained list: 1. create a list structure, stores and is referred to as the object in " path " here, and path objects describes the information of the ladder diagram element in this this path of composition, source node number, destination node number.Path can also comprise subpath, can be serial or parallel connection relation between subpath; 2. set up a kind of node number application mechanism, make all can to apply for a new node number at every turn; 3. the node that sets out (source node) machine setting up path enters node (destination node) storehouse;
Step 3: scanning statement list, generation pass chained list;
Step 4: according to scanned instruction, the algorithm generation pass chained list by below:
(1) LD/LDN class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a contact types;
2.. apply for new node number, press-in source node storehouse;
3.. again apply for new node number, press-in destination node storehouse;
4.. the source node number of new route equals source node storehouse stack top value;
5.. the destination node number of new route equals destination node storehouse stack top value;
6.. newly-generated path is inserted into the front end of chained list;
(2) AND/ANDN class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a contact types;
2.. new route source node number equals destination node storehouse stack top value;
3.. apply for new node number, replace destination node storehouse stack top value;
4.. the source node number of new route equals source node storehouse stack top value;
5.. the destination node number of new route equals destination node storehouse stack top value;
6.. newly-generated path and chained list path foremost merges generation compound path of connecting;
(3) OR/ORN class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a contact types;
2.. new route source node number equals source node storehouse stack top value;
3.. new route destination node number equals destination node storehouse stack top value;
4.. newly-generated path and chained list path foremost merges generation compound path in parallel;
(4) ALD instruction:
1.. generate a new path, do not comprise any element;
2.. new route source node number equals source node storehouse stack top value;
3.. the source node number that linked list head starts the 2nd location paths equals destination node storehouse stack top value;
4.. source node storehouse ejects, and replaces source node storehouse stack top value with new route source node number;
5.. destination node storehouse ejects;
6.. new route destination node number equals destination node storehouse stack top value;
7.. 2 paths started by linked list head in order move to the subpath of new route;
8.. newly-generated path is inserted into the front end of chained list;
(5) OLD instruction:
1.. generate a new path.Do not comprise any element;
2.. source node storehouse ejects;
3.. destination node storehouse ejects;
4.. new route source node number equals source node storehouse stack top value;
5.. new route destination node number equals destination node storehouse stack top value;
6.. linked list head starts the 1st, the source node number of 2 location paths equals source node storehouse stack top value;
7.. linked list head starts the 1st, the destination node number of 2 location paths equals destination node storehouse stack top value;
8.. 2 paths started by linked list head in order move to the subpath of new route;
9.. newly-generated path is inserted into the front end of chained list;
(6) LPS instruction: copy destination node storehouse stack top value and pop down:
(7) LRD instruction: copy the value of destination node storehouse the 2nd position to stack top:
(8) LPP instruction: destination node storehouse ejects:
(9) coil (Coil) class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a coil-type;
2.. new route source node number equals source node storehouse stack top value;
3.. new route destination node number equals new node number;
4.. newly-generated path is inserted into the front end of chained list;
(10) function box (Box) class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of function box (Box) type;
2.. new route source node number equals source node storehouse stack top value;
3.. new route destination node number equals new node number;
4.. newly-generated path is inserted into the front end of chained list;
Step 5: mention ladder diagram from the chained list of path:
Original path, for only having 1 ladder diagram element, does not have the path of subpath; Ladder diagram element in all original paths in the chained list of path is proposed, just can obtain the ladder diagram element corresponding to statement list and connect annexation each other; When extracting ladder diagram element from original path, follow following principle:
1.. be connected to source node number corresponding access point in path on the left of ladder diagram element, on the right side of ladder diagram element, be connected to the access point that path door-plate node number is corresponding;
2.. the order by path in chained list/child list deposits ladder diagram element.
Accompanying drawing explanation
Fig. 1 is ladder diagram of the present invention;
Fig. 2 is the schematic diagram that LD A of the present invention generates respective path;
Fig. 3 is the schematic diagram that LD B of the present invention generates respective path;
Fig. 4 is the schematic diagram that AND C of the present invention generates respective path;
Fig. 5 is the schematic diagram that LD D of the present invention generates respective path;
Fig. 6 is the schematic diagram that AND E of the present invention generates respective path;
Fig. 7 is the schematic diagram that OLD of the present invention sets up relation between path;
Fig. 8 is the schematic diagram that OR F of the present invention generates respective path;
Fig. 9 is the schematic diagram that ALD of the present invention sets up relation between path;
Figure 10 is the schematic diagram that AND G of the present invention generates respective path;
Figure 11 is the schematic diagram of LPS process path node of the present invention;
Figure 12 is the schematic diagram that AND H of the present invention generates respective path;
Figure 13 is the schematic diagram that ADD of the present invention generates respective path;
Figure 14 is the schematic diagram that LRD of the present invention generates respective path.
Embodiment
Below in conjunction with accompanying drawing, embodiments of the invention are described further:
The statement list that ladder diagram is as shown in Figure 1 corresponding is as follows, and it is the ladder diagram shown in Fig. 1 that step below describes statement list decompiling below:
LD A // A is loaded into logic stack top
LD B // logic stack presses down 1 layer, and B is put into stack top
AND C // logic stack top and C phase with, result is put into stack top
LD D // logic stack presses down 1 layer, and B is put into stack top
AND E // logic stack top and C phase with, result is put into stack top
OLD // stack top and its lower one deck phase or, bullet in logic stack, result is placed on stack top
OR F // logic stack top and H phase with
ALD // stack top and its lower one deck phase or, bullet in logic stack, result is placed on stack top
AND G // logic stack top and I phase with, result is put into stack top
LPS // press down logical stack, and keep stack top value constant
AND H // logic stack top and J phase with, result is put into stack top
If ADD // stack top is true, then carry out additive operation
LRD // copy the value of sublevel to stack top
LD I // logic stack presses down 1 layer, and I is put into stack top
LD J // logic stack presses down 1 layer, and J is put into stack top
AND K // logic stack top and K phase with, result is put into stack top
OLD // stack top and its lower one deck phase or, bullet in logic stack, result is placed on stack top
ALD // stack top and its lower one deck phase with, bullet in logic stack, result is placed on stack top
If SUB // stack top is true, then carry out subtraction
Bullet in LPP // logic stack
If MUL // stack top is true, then carry out multiplying.

Claims (3)

1. statement list is to the conversion method of ladder diagram, with the instruction of LD/LDN class, the instruction of AND/ANDN class, the instruction of OR/ORN class, ALD instruction, OLD instruction, LPS, LRD during this five classes instruction of LPP instruction is, and coil (Coil) class and the instruction of function box (Box) class then determine whether performing or assignment according to the value of current logic stack top, can arbitrary extension as required; Concrete steps are as follows:
Step 1: set up necessary data structure;
Step 2: Make Path chained list: 1. create a list structure, stores and is referred to as the object in " path " here, and path objects describes the information of the ladder diagram element in this this path of composition, source node number, destination node number; Path can also comprise subpath, can be serial or parallel connection relation between subpath; 2. set up a kind of node number application mechanism, make all can to apply for a new node number at every turn; 3. the node that sets out (source node) machine setting up path enters node (destination node) storehouse;
Step 3: scanning statement list, generation pass chained list;
Step 4: according to scanned instruction, algorithmically generation pass chained list;
Step 5: mention ladder diagram from the chained list of path.
2. statement list according to claim 1 is to the conversion method of ladder diagram, it is characterized in that, step 4 is by following algorithm generation pass chained list:
(1) LD/LDN class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a contact types;
2.. apply for new node number, press-in source node storehouse;
3.. again apply for new node number, press-in destination node storehouse;
4.. the source node number of new route equals source node storehouse stack top value;
5.. the destination node number of new route equals destination node storehouse stack top value;
6.. newly-generated path is inserted into the front end of chained list;
(2) AND/ANDN class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a contact types;
2.. new route source node number equals destination node storehouse stack top value;
3.. apply for new node number, replace destination node storehouse stack top value;
4.. the source node number of new route equals source node storehouse stack top value;
5.. the destination node number of new route equals destination node storehouse stack top value;
6.. newly-generated path and chained list path foremost merges generation compound path of connecting;
(3) OR/ORN class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a contact types;
2.. new route source node number equals source node storehouse stack top value;
3.. new route destination node number equals destination node storehouse stack top value;
4.. newly-generated path and chained list path foremost merges generation compound path in parallel;
(4) ALD instruction:
1.. generate a new path, do not comprise any element;
2.. new route source node number equals source node storehouse stack top value;
3.. the source node number that linked list head starts the 2nd location paths equals destination node storehouse stack top value;
4.. source node storehouse ejects, and replaces source node storehouse stack top value with new route source node number;
5.. destination node storehouse ejects;
6.. new route destination node number equals destination node storehouse stack top value;
7.. 2 paths started by linked list head in order move to the subpath of new route;
8.. newly-generated path is inserted into the front end of chained list;
(5) OLD instruction:
1.. generate a new path, do not comprise any element;
2.. source node storehouse ejects;
3.. destination node storehouse ejects;
4.. new route source node number equals source node storehouse stack top value;
5.. new route destination node number equals destination node storehouse stack top value;
6.. linked list head starts the 1st, the source node number of 2 location paths equals source node storehouse stack top value;
7.. linked list head starts the 1st, the destination node number of 2 location paths equals destination node storehouse stack top value;
8.. 2 paths started by linked list head in order move to the subpath of new route;
9.. newly-generated path is inserted into the front end of chained list;
(6) LPS instruction: copy destination node storehouse stack top value and pop down:
(7) LRD instruction: copy the value of destination node storehouse the 2nd position to stack top:
(8) LPP instruction: destination node storehouse ejects:
(9) coil class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of a coil-type;
2.. new route source node number equals source node storehouse stack top value;
3.. new route destination node number equals new node number;
4.. newly-generated path is inserted into the front end of chained list;
(10) function box class instruction:
1.. generate a new path, in path, comprise the ladder diagram element of function box (Box) type;
2.. new route source node number equals source node storehouse stack top value;
3.. new route destination node number equals new node number;
4.. newly-generated path is inserted into the front end of chained list.
3. statement list according to claim 1 is to the conversion method of ladder diagram, it is characterized in that, the concrete grammar that step 5 mentions ladder diagram from the chained list of path is as follows:
Original path, for only having 1 ladder diagram element, does not have the path of subpath; Ladder diagram element in all original paths in the chained list of path is proposed, just can obtain the ladder diagram element corresponding to statement list and connect annexation each other; When extracting ladder diagram element from original path, follow following principle:
1.. be connected to source node number corresponding access point in path on the left of ladder diagram element, on the right side of ladder diagram element, be connected to the access point that path door-plate node number is corresponding;
2.. the order by path in chained list/child list deposits ladder diagram element.
CN201410572477.7A 2014-10-24 2014-10-24 Conversion method of the statement list to ladder diagram Active CN104317631B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410572477.7A CN104317631B (en) 2014-10-24 2014-10-24 Conversion method of the statement list to ladder diagram

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410572477.7A CN104317631B (en) 2014-10-24 2014-10-24 Conversion method of the statement list to ladder diagram

Publications (2)

Publication Number Publication Date
CN104317631A true CN104317631A (en) 2015-01-28
CN104317631B CN104317631B (en) 2018-02-09

Family

ID=52372866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410572477.7A Active CN104317631B (en) 2014-10-24 2014-10-24 Conversion method of the statement list to ladder diagram

Country Status (1)

Country Link
CN (1) CN104317631B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107193534A (en) * 2017-05-15 2017-09-22 华南理工大学 A kind of method that PLC ladder diagrams are converted into instruction catalogue and explain execution
CN112287651A (en) * 2020-10-29 2021-01-29 平安普惠企业管理有限公司 Template conversion method and device, storage medium, and computer equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5210837A (en) * 1990-06-15 1993-05-11 Digital Equipment Corporation Methods and apparatus for transforming machine language program control into high-level language constructs by manipulating graphical program representations
CN102508654A (en) * 2011-10-11 2012-06-20 江苏科技大学 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5210837A (en) * 1990-06-15 1993-05-11 Digital Equipment Corporation Methods and apparatus for transforming machine language program control into high-level language constructs by manipulating graphical program representations
CN102508654A (en) * 2011-10-11 2012-06-20 江苏科技大学 Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller)

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吕俊白: "PLC语句表向梯形图自动转换的实现方法", 《华侨大学学报(自然科学版)》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107193534A (en) * 2017-05-15 2017-09-22 华南理工大学 A kind of method that PLC ladder diagrams are converted into instruction catalogue and explain execution
CN107193534B (en) * 2017-05-15 2020-05-22 华南理工大学 A Method of Converting PLC Ladder Diagram into Instruction List and Explaining and Executing
CN112287651A (en) * 2020-10-29 2021-01-29 平安普惠企业管理有限公司 Template conversion method and device, storage medium, and computer equipment

Also Published As

Publication number Publication date
CN104317631B (en) 2018-02-09

Similar Documents

Publication Publication Date Title
US9477578B2 (en) Sequence-program-debugging supporting apparatus
CN102646035A (en) Visualized code generation method based on combination of API (application programming interface) and script definition
US9395710B2 (en) Machine control program generation device, machine control program generation method, and information storage medium
CN104978391A (en) System and method for automated substation design and configuration
EP2557500A2 (en) Embedded multi-processor parallel processing system and operating method for same
CN104317631A (en) Statement list to ladder diagram conversion method
CN104182913B (en) A kind of power network mode figure is into the intelligent arrangement method of figure
JP2016115175A (en) Software test apparatus and software test program
CN104298419A (en) Mobile terminal and method for arranging icons of mobile terminal
WO2023044631A1 (en) A device, system, method and storage medium for ai application deployment
CN103559727B (en) A kind of ladder diagram data structure describes and scanning analytic method
CN114356297A (en) Method for generating PLC (programmable logic controller) program for realizing intelligent start-stop control of various devices on industrial production line
JP2015053022A (en) Programming tool for plc
CN103838935A (en) Drawing system and method for subway signal system designing
CN115016808B (en) Front-end application deployment method and device
CN107423088A (en) Computing device and method of operation thereof
JP2012159868A (en) Programming device of programmable logic controller
KR101566355B1 (en) Master pattern generation method and apparatus for checking normal operation of plc based manufacturing system
CN108829440B (en) Method and system for converting logic configuration array into logic execution command
CN102736551B (en) The soft solution approach of a kind of PLC ladder diagram code
CN104090811A (en) Method for compiling from ladder diagram to statement list
CN104486117A (en) Configuration command interaction method and configuration command interaction system of multi-board card core switch
JP7188198B2 (en) Graph display device, graph display method, and graph display program
JP7183877B2 (en) Graph display device, graph display method, and graph display program
CN109408152B (en) Method and device for generating equipment starting step

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Statement list to ladder diagram conversion method

Effective date of registration: 20190522

Granted publication date: 20180209

Pledgee: Bank of Communications Co.,Ltd. Hunan Branch

Pledgor: HUNAN SUPER INFORMATION Co.,Ltd.

Registration number: 2019430000045

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20201214

Granted publication date: 20180209

Pledgee: Bank of Communications Co.,Ltd. Hunan Branch

Pledgor: HUNAN SUPER INFORMATION Co.,Ltd.

Registration number: 2019430000045

PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Conversion Method from Statement Table to Ladder Diagram

Effective date of registration: 20221101

Granted publication date: 20180209

Pledgee: Huarong Bank of Xiangjiang Limited by Share Ltd. Changsha branch

Pledgor: HUNAN SUPER INFORMATION Co.,Ltd.

Registration number: Y2022430000095

PM01 Change of the registration of the contract for pledge of patent right
PM01 Change of the registration of the contract for pledge of patent right

Change date: 20240726

Registration number: Y2022430000095

Pledgee after: Bank of Hunan Co.,Ltd. Changsha Branch

Pledgee before: Huarong Bank of Xiangjiang Limited by Share Ltd. Changsha branch