CN117221146B - Interface layout system and layout method for ladder diagram logic configuration - Google Patents

Interface layout system and layout method for ladder diagram logic configuration Download PDF

Info

Publication number
CN117221146B
CN117221146B CN202311486162.6A CN202311486162A CN117221146B CN 117221146 B CN117221146 B CN 117221146B CN 202311486162 A CN202311486162 A CN 202311486162A CN 117221146 B CN117221146 B CN 117221146B
Authority
CN
China
Prior art keywords
network
coordinate
value
distance
switch
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.)
Active
Application number
CN202311486162.6A
Other languages
Chinese (zh)
Other versions
CN117221146A (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.)
Chengdu Kejiang Technology Co ltd
Original Assignee
Chengdu Kejiang Technology 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 Chengdu Kejiang Technology Co ltd filed Critical Chengdu Kejiang Technology Co ltd
Priority to CN202311486162.6A priority Critical patent/CN117221146B/en
Publication of CN117221146A publication Critical patent/CN117221146A/en
Application granted granted Critical
Publication of CN117221146B publication Critical patent/CN117221146B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Design And Manufacture Of Integrated Circuits (AREA)

Abstract

The invention discloses an interface layout system and a layout method of ladder diagram logic configuration, comprising a numbering module, a logic configuration module and a logic configuration module, wherein the numbering module is used for numbering all networks in a ladder diagram; the interface control module is used for carrying out inter-network layout and intra-network layout on all networks according to the network numbers and the sequence from top to bottom and from left to right; the processing module is used for calculating the original network length and the original network height of each network after the network is distributed in the network, and outputting the maximum network length and the maximum network height in all the networks; and the adjustment module is used for receiving the information output by the processing module and controlling the interface control module to complete the network interface layout. The invention provides an interface layout system of ladder diagram logic configuration, which can facilitate a user to write a program by using a ladder diagram according to the rules of the ladder diagram, realize own business logic and avoid the problem of the layout of graphics.

Description

Interface layout system and layout method for ladder diagram logic configuration
Technical Field
The invention belongs to the technical field of graphic layout, and particularly relates to an interface layout system and a layout method of ladder diagram logic configuration.
Background
A PLC control program written by a ladder diagram mainly comprises the following two parts: the variables define the zones and the network zones.
The network area is mainly used for writing business logic and consists of a plurality of networks, and one network mainly consists of the following elements:
1. energy source line: is a vertical line;
2. energy joint: for starting from left to right in the ladder diagram;
3. and (3) a switch: there are left and right inputs;
4. a coil: with left input, it is typically used as a network endpoint;
pou: the separation into FUNCTION and function_block;
6. and (3) connecting: for connecting the left output and the right input;
7. and (3) jumping: taking a network as a jump target, and dividing the jump into conditional jump and unconditional jump;
8. returning: the method is divided into conditional return and unconditional return;
9. network annotation: for adding descriptive information to the network;
10. network tag: for jumping.
For the ladder diagram, if a proper automatic layout algorithm is not provided, a user must manually put the position of the diagram, so that the usability of programming software is reduced, and the workload of the user is increased.
Disclosure of Invention
The invention provides an interface layout system and a layout method for ladder diagram logic configuration, which aim to solve the problems.
The invention is realized by an interface layout system of ladder diagram logic configuration, comprising:
the numbering module is used for numbering all networks in the ladder diagram;
the interface control module is used for carrying out inter-network layout and intra-network layout on all networks according to the network numbers and the sequence from top to bottom and from left to right;
the processing module is used for calculating the original network length and the original network height of each network after the network is distributed in the network, and outputting the maximum network length and the maximum network height in all the networks;
and the adjustment module is used for receiving the information output by the processing module and controlling the interface control module to complete the network interface layout.
Further, the interface control module comprises an intra-network control sub-module and an inter-network control sub-module, wherein the inter-network control sub-module is used for carrying out inter-network layout on all networks, and the intra-network control sub-module is used for carrying out intra-network layout on each network.
Further, the control sub-module in the network comprises a layout unit and a searching unit, wherein the searching unit is used for searching all elements in the network, and the layout unit is used for laying out all elements in the network according to the sequence from left to right and setting element coordinates.
The invention also provides an interface layout method of the system, which comprises the following steps:
step S1: numbering all networks, and carrying out inter-network layout on all networks according to the network numbering size and the sequence from top to bottom;
step S2: each network performs intra-network layout, and after the intra-network layout is completed, the original network length and the original network height of the network are calculated;
step S3: and selecting the maximum original network length from the original network lengths and the original network heights of all the networks as the final network length of each network, and selecting the maximum original network height as the final network height of each network to complete the network layout.
Further, in step S2, each network performs intra-network layout, which specifically includes:
step S21: laying out all elements in a network in a left-to-right order, and setting network labels, network comments and coordinates of energy joints;
step S22: starting to search from left to right by taking the energy joint as a starting point, and finding out elements connected with the right of the energy joint; if the element is unconditional jump or unconditional return, ending the layout flow; if the element is a switch, the next step is carried out;
step S23: finding out an element connected with the right of the switch, if the element is any one of a conditional jump, a conditional return or a coil, calculating the current network length and ending the layout flow; if the element is a POU, then find if there is a right connected element in the POU: if not, calculating the current network length and the current network height, ending the layout flow, and if so, performing the next step;
step S24: if the element connected with the right of the POU is any one of conditional jump, conditional return or coil, calculating the current network length and ending the layout flow; if the element connected to the right of the POU is a switch, calculating the current network length and jumping to the step S23; if the element connected to the right of the POU is another POU, the current network length is calculated and step S24 is repeated.
Further, in step S21, the coordinates of the network tag are set to (lbl_x, lbl_y), the coordinates of the network annotation are set to (cm_x, cm_y), the coordinates of the energy connector x=power_line_width, and the coordinates y=cm_high+cm_power_v_distance; the right connection point coordinate x=energy connection point.
Further, in step S22, specifically includes:
when the element is unconditional jump, the value of the unconditional jump coordinate x is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the unconditional jump=unconditional jump;
when the element is unconditionally returned, the value of the unconditionally returned coordinate x is CONN_DISTANCE, and the value of the coordinate Y is RT_WIDTH/2+CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x=unconditional jump, x, coordinate y=rt_head/2+unconditional return;
when the element is switch one, the value of the coordinate x of the switch is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the SWITCH I=switch I.x, the coordinate y=switch_HEIGHT/2+switch I.y, the right connection point coordinate x of the switch=switch I.x+switch_WIDTH, the coordinate y=switch_HEIGHT/2+switch I.y.
Further, in step S23, specifically includes:
when the element is a conditional jump, the value of the conditional jump coordinate x is CONN_DISTANCE+switch one x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the conditional jump = conditional jump; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is a conditional return, the value of the conditional return coordinate x is CONN_DISTANCE+switch one x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x=condition return, x, coordinate y=jm_height2+ condition return; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is coil one, the value of the coordinate x of coil one is CONN_DISTANCE+switch one, x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the COIL I=coil I, x, coordinate y=COIL_HEIGHT/2+coil I; the value TOTAL _ WIDTH of the sum of all element lengths is then calculated,
when the element is a POU without right connection, the value of POU coordinate x is conn_distance 2, and the value of coordinate y is jm_width/2+cm_y+cm_head+min_v_distance+pou_head/2; the value total_width of all element lengths added up is then calculated.
Further, in step S24, specifically includes:
when the element is a conditional jump, the value of the conditional jump coordinate x is conn_distance 2, and the value of the coordinate Y is cm_y+cm_head+min_v_distance; the left connecting point coordinate x of the conditional jump = conditional jump; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is a conditional return, the value of the conditional return coordinate x is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the condition return = condition return; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is coil two, the value of the coordinate x of coil two is CONN_DISTANCE 2, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the second coil=the second COIL, x and the coordinate y=the coil_head/2+the second COIL; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is another POU, the value of POU coordinate x is conn_distance 2, and the value of coordinate Y is cm_y+cm_head+min_v_distance; then calculating the total_width value of the sum of the lengths of all the elements, and repeating the step S24;
when the element is a switch II, the value of a switch II coordinate x is CONN_DISTANCE 2, and the value of a coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point of the second switch is x=the second COIL, x, and y=the second coil_HEIGHT/2+switch; the right connection point coordinate x of switch two = COIL two x + coil_wit, coordinate y = coil_head/2 + switch two y; then, the value total_width of all element lengths added up is calculated, and the process goes to step S23.
Compared with the prior art, the invention has the beneficial effects that: the invention provides an interface layout system of ladder diagram logic configuration, which can facilitate a user to write a program by using a ladder diagram according to the rules of the ladder diagram, realize own business logic and avoid concern about the layout problem of graphics; the algorithm provided by the invention can automatically and reasonably layout the network and various graphs in the network according to the programming rule of the ladder diagram.
Detailed Description
The present invention will be described in further detail with reference to the following examples in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The invention discloses an interface layout system of ladder diagram logic configuration, comprising:
the numbering module is used for numbering all networks in the ladder diagram;
the interface control module is used for carrying out inter-network layout and intra-network layout on all networks according to the network numbers and the sequence from top to bottom and from left to right;
the processing module is used for calculating the original network length and the original network height of each network after the network is distributed in the network, and outputting the maximum network length and the maximum network height in all the networks;
and the adjustment module is used for receiving the information output by the processing module and controlling the interface control module to complete the network interface layout.
Further, the interface control module comprises an intra-network control sub-module and an inter-network control sub-module, wherein the inter-network control sub-module is used for carrying out inter-network layout on all networks, and the intra-network control sub-module is used for carrying out intra-network layout on each network.
The invention also discloses an interface layout method of the system, which comprises the following steps:
step S1: numbering all networks, and carrying out inter-network layout on all networks according to the network numbering size and the sequence from top to bottom;
step S2: each network performs intra-network layout, and after the intra-network layout is completed, the original network length and the original network height of the network are calculated;
step S3: and selecting the maximum original network length from the original network lengths and the original network heights of all the networks as the final network length of each network, and selecting the maximum original network height as the final network height of each network to complete the network layout.
Specifically, in step S2, each network performs intra-network layout, specifically including:
step S21: laying out all elements in a network in a left-to-right order, and setting network labels, network comments and coordinates of energy joints;
step S22: starting to search from left to right by taking the energy joint as a starting point, and finding out elements connected with the right of the energy joint; if the element is unconditional jump or unconditional return, ending the layout flow; if the element is a switch, the next step is carried out;
step S23: finding out an element connected with the right of the switch, if the element is any one of a conditional jump, a conditional return or a coil, calculating the current network length and ending the layout flow; if the element is a POU, then find if there is a right connected element in the POU: if not, calculating the current network length and the current network height, ending the layout flow, and if so, performing the next step;
step S24: if the element connected with the right of the POU is any one of conditional jump, conditional return or coil, calculating the current network length and ending the layout flow; if the element connected to the right of the POU is a switch, calculating the current network length and jumping to the step S23; if the element connected to the right of the POU is another POU, the current network length is calculated and step S24 is repeated.
In step S21, the coordinates of the network tag are set to (lbl_x, lbl_y), the coordinates of the network annotation are set to (cm_x, cm_y), the coordinates x=power_line_width of the energy connector, and the coordinates y=cm_high+cm_power_v_distance; the right connection point coordinate x=energy connection point.
In step S22, specifically, the method includes:
when the element is unconditional jump, the value of the unconditional jump coordinate x is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the unconditional jump=unconditional jump;
when the element is unconditionally returned, the value of the unconditionally returned coordinate x is CONN_DISTANCE, and the value of the coordinate Y is RT_WIDTH/2+CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x=unconditional jump, x, coordinate y=rt_head/2+unconditional return;
when the element is switch one, the value of the coordinate x of the switch is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the SWITCH I=switch I.x, the coordinate y=switch_HEIGHT/2+switch I.y, the right connection point coordinate x of the switch=switch I.x+switch_WIDTH, the coordinate y=switch_HEIGHT/2+switch I.y.
In step S23, specifically, the method includes:
when the element is a conditional jump, the value of the conditional jump coordinate x is CONN_DISTANCE+switch one x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the conditional jump = conditional jump; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is a conditional return, the value of the conditional return coordinate x is CONN_DISTANCE+switch one x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x=condition return, x, coordinate y=jm_height2+ condition return; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is coil one, the value of the coordinate x of coil one is CONN_DISTANCE+switch one, x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the COIL I=coil I, x, coordinate y=COIL_HEIGHT/2+coil I; the value TOTAL _ WIDTH of the sum of all element lengths is then calculated,
when the element is a POU without right connection, the value of POU coordinate x is conn_distance 2, and the value of coordinate y is jm_width/2+cm_y+cm_head+min_v_distance+pou_head/2; the value total_width of all element lengths added up is then calculated.
In step S24, specifically, the method includes:
when the element is a conditional jump, the value of the conditional jump coordinate x is conn_distance 2, and the value of the coordinate Y is cm_y+cm_head+min_v_distance; the left connecting point coordinate x of the conditional jump = conditional jump; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is a conditional return, the value of the conditional return coordinate x is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the condition return = condition return; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is coil two, the value of the coordinate x of coil two is CONN_DISTANCE 2, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the second coil=the second COIL, x and the coordinate y=the coil_head/2+the second COIL; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is another POU, the value of POU coordinate x is conn_distance 2, and the value of coordinate Y is cm_y+cm_head+min_v_distance; then calculating the total_width value of the sum of the lengths of all the elements, and repeating the step S24;
when the element is a switch II, the value of a switch II coordinate x is CONN_DISTANCE 2, and the value of a coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point of the second switch is x=the second COIL, x, and y=the second coil_HEIGHT/2+switch; the right connection point coordinate x of switch two = COIL two x + coil_wit, coordinate y = coil_head/2 + switch two y; then, the value total_width of all element lengths added up is calculated, and the process goes to step S23.
In this embodiment, the present invention is set as follows:
the DISTANCE between NETWORKs is constant NETWORK_DISTANCE;
the DEFAULT HEIGHT of the network is a constant NT_Default_HEIGHT, and the DEFAULT WIDTH of the network is an integer constant NT_Default_WIDTH;
the WIDTH of the energy source LINE is a constant power_line_width;
the minimum height difference between an element closest to the BOTTOM of the network and the BOTTOM is an integer constant MIN_BOTTOM_DISTANCE;
the minimum horizontal DISTANCE difference between an element in the network closest to the RIGHT line of the network is an integer constant MIN_RIGHT_DISTANCE;
the DISTANCE between the starting point and the end point of the connecting line is constant CONN_DISTANCE;
the HEIGHT of the SWITCH is an integer constant switch_high, and the WIDTH of the SWITCH is an integer constant switch_width;
the HEIGHT of the COIL is an integer constant COIL_HEIGHT, and the WIDTH of the switch is an integer constant COIL_WIDTH;
the HEIGHT of the POU is an integer constant POU_HEIGHT, the WIDTH of the POU is an integer constant POU_WIDTH, and the HEIGHT of the POU head is POU_HEADER_HEIGHT;
the INPUT PARAMETER coordinates in the POU are constants (input_x, input_y), the HEIGHT of the PARAMETER is constant parameter_head, and the WIDTH of the PARAMETER is constant parameter_width;
the jump HEIGHT is an integer constant JM_HEIGHT, and the jump WIDTH is an integer constant JM_WIDTH;
the returned HEIGHT is an integer constant RT_HEIGHT, and the returned width is an integer constant RT_WIDHT;
the network annotation HEIGHT is an integer constant CM_HEIGHT, the network annotation WIDTH is an integer constant CM_WIDTH, and the initial coordinates of the annotation in the network are CM_ X, CM _Y;
the vertical DISTANCE between the network annotation and the energy connector is an integer constant cm_power_v_distance;
the network tag is an integer constant lbl_high, and the network tag WIDTH is an integer constant lbl_width. The location of the network tag in the network is fixed and the coordinates of the network tag are constant (lbl_x, lbl_y).
The values of the above constants are all even.
Based on the network numbers, laying out the inside of each network according to the sequence from small to large of the network numbers; after one network completes the internal layout, finding out the graph with the bottommost coordinates and the graph with the bottommost coordinates in the network, and calculating the proper width and height values of the network according to a certain rule; determining whether to adjust the width of other networks according to the final width of the current network; and determining whether to adjust y of other networks according to the final y coordinate value of the current network.
Specifically, automatic placement between networks: according to the size of the network number, the sequence from top to bottom is adopted; after each network has completed its own network topology, it is necessary to calculate the length and height of the network and compare it with the network before it:
(1) If the length of the current network WIDTH < MAX (n 1, n2, n3.. N-1), width=max (n 1, n2, n3.. N-1);
(2) If the length is greater than WIDTH > MAX (n 1, n2, n3.. N-1) at the current network length, then the length of all previous networks is set to the length of the current network;
(3) If the HEIGHT of the current network, HEIGHT < MAX (n 1, n2, n3.. N-1), then height=max (n 1, n2, n3.. N-1);
(4) If the altitude is greater than the current network altitude HEIGHT > MAX (n 1, n2, n3.. N-1), then the altitude of all previous networks is adjusted to the current network altitude value.
Examples
In this embodiment, the automatic layout in the network is as follows:
step S1: the principle of the layout in the network is the sequence from left to right;
step S2: finding out a network tag, and setting coordinates of the network tag to (LBL_X, LBL_Y);
step S3: finding out the network annotation, and setting the coordinates of the network annotation to (CM_X, CM_Y);
step S4: the energy connection is found, the coordinates y=cm_high+cm_power_v_distance, x=power_line_width of the energy connection. The coordinates x=energy joint of the right connection point of the energy joint x, y=energy joint y;
step S5: starting searching from left to right by taking an energy joint as a starting point;
step S6: finding out the element connected with the right of the energy joint:
(1) If the element is an unconditional jump, coordinates (x, Y) are set for it, the value of x is CONN_DISTANCE, and the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) position of the connection point on the left of the unconditional jump is x=unconditional jump. Ending the layout flow;
(2) If the element is unconditionally returned, coordinates (x, Y) are set for it, the value of x is CONN_DISTANCE, and the value of Y is RT_WIDTH/2+CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) position of the left junction point of the unconditional return is x=unconditional jump. Ending the layout flow;
(3) If the element is a switch, coordinates are set for it as (x, Y), the value of x is CONN_DISTANCE, and the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) of the left connection point of the SWITCH is x=switch. X, y=switch_head/2+switch. Y. The right connection point of the SWITCH (x, y) is x=switch. X+switch_width, y=switch_head/2+switch. Y.
Step S7: find the element connected to the right of the switch:
(1) If the element is a conditional jump, coordinates (x, Y) are set for it, the value of x = CONN_DISTANCE+switch. X+SWITCH_WIDTH, the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) position of the connection point on the left of the conditional jump is x=conditional jump. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width.
(2) If the element is a conditional return, coordinates (x, Y) are set for it, the value of x = CONN_DISTANCE+switch. X+SWITCH_WIDTH, the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) of the position of the connection point to the left of the condition return is x=condition return. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width.
(3) If the element is a coil, coordinates (x, Y) are set for it, the value of x = conn_distance + SWITCH x + switch_width, and the value of Y is cm_y + cm_head + min_v_distance. The position of the connection point to the left of the COIL (x, y) is x=coil. X, y is coil_head/2+coil. Y. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width.
(4) If the element is POU, coordinates (x, Y) are set for it, x has a value of CONN_DISTANCE 2, and Y has a value of JM_WIDTH/2+CM_Y+CM_HEIGHT+MIN_V_DISTANCE+POU_HEADER/2. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width.
Step S8: finding out the element connected to the right of the POU
(1) The height of the POU was calculated:
(1) POU HEIGHT = MAX (number of input PARAMETERs, number of output PARAMETERs);
(2) if the POU HEIGHT is greater than NT_DEFAULT_HEIGHT, the current network HEIGHT is adjusted, and the adjusted HEIGHT value is POU HEIGHT +MIN_BOTTOM_DISTANCE.
(2) If the element is a conditional jump, coordinates (x, Y) are set for it, the value of x is CONN_DISTANCE 2, and the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) position of the connection point on the left of the conditional jump is x=conditional jump. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width;
(3) If the element is a conditional return, coordinates (x, Y) are set for it, the value of x is CONN_DISTANCE, and the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. The (x, y) position of the connection point to the left of the condition return is x=condition return. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width;
(4) If the element is a coil, coordinates (x, Y) are set for it, the value of x is CONN_DISTANCE 2, and the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. (x, y) x=coil, x, y is coil_head/2+current COIL. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width;
(5) If the element is POU, coordinates (x, Y) are set for it, x has a value of CONN_DISTANCE 2, and Y has a value of CM_Y+CM_HEIGHT+MIN_V_DISTANCE. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width. Repeating the step 8;
(6) If the element is a switch, coordinates (x, Y) are set for it, the value of x is CONN_DISTANCE 2, and the value of Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE. (x, y) x=coil of the position of the connection point to the left of the switch, x, y is coil_high/2+ current switch. (x, y) x=coil of the position of the connection point to the right of the switch, x+coil_with, y being coil_head/2+current switch. Calculating the total_width value of the sum of the lengths (WIDTHs) of all elements, and if the TOTAL length is larger than the current length of the network, adjusting the length of the network: network length = min_right_distance+total_width. Jump to step 7.
Through the algorithm, the problem of automatic layout of the ladder diagram can be solved.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, and alternatives falling within the spirit and principles of the invention.

Claims (5)

1. An interface layout method of ladder diagram logic configuration is applied to an interface layout system, and is characterized in that the interface layout system comprises:
the numbering module is used for numbering all networks in the ladder diagram;
the interface control module is used for carrying out inter-network layout and intra-network layout on all networks according to the network numbers and the sequence from top to bottom and from left to right;
the processing module is used for calculating the original network length and the original network height of each network after the network is distributed in the network, and outputting the maximum network length and the maximum network height in all the networks;
the adjusting module is used for receiving the information output by the processing module and controlling the interface control module to complete the network interface layout;
the interface control module comprises an intra-network control sub-module and an inter-network control sub-module, wherein the inter-network control sub-module is used for carrying out inter-network layout on all networks, and the intra-network control sub-module is used for carrying out intra-network layout on each network;
the control sub-module in the network comprises a layout unit and a searching unit, wherein the searching unit is used for searching all elements in each network, and the layout unit is used for laying out all elements in each network according to the sequence from left to right and setting element coordinates;
the interface layout method comprises the following steps:
step S1: numbering all networks, and carrying out inter-network layout on all networks according to the network numbering size and the sequence from top to bottom;
step S2: each network performs intra-network layout, and after the intra-network layout is completed, the original network length and the original network height of the network are calculated;
step S3: selecting the maximum original network length from the original network lengths and the original network heights of all the networks as the final network length of each network, and selecting the maximum original network height as the final network height of each network to complete network layout;
in step S2, each network performs intra-network layout, which specifically includes:
step S21: laying out all elements in a network in a left-to-right order, and setting network labels, network comments and coordinates of energy joints;
step S22: starting to search from left to right by taking the energy joint as a starting point, and finding out elements connected with the right of the energy joint; if the element is unconditional jump or unconditional return, ending the layout flow; if the element is a switch, the next step is carried out;
step S23: finding out an element connected with the right of the switch, if the element is any one of a conditional jump, a conditional return or a coil, calculating the current network length and ending the layout flow; if the element is a POU, then find if there is a right connected element in the POU: if not, calculating the current network length and the current network height, ending the layout flow, and if so, performing the next step;
step S24: if the element connected with the right of the POU is any one of conditional jump, conditional return or coil, calculating the current network length and ending the layout flow; if the element connected to the right of the POU is a switch, calculating the current network length and jumping to the step S23; if the element connected to the right of the POU is another POU, the current network length is calculated and step S24 is repeated.
2. The interface layout method according to claim 1, wherein in step S21, the coordinates of the network tag are set to (lbl_x, lbl_y), the coordinates of the network annotation are set to (cm_x, cm_y), the coordinates x=power_line_width of the POWER connector, and the coordinates y=cm_high+cm_power_v_distance; the right connection point coordinate x=energy connection point.
3. The interface layout method according to claim 2, characterized in that in step S22, specifically comprising:
when the element is unconditional jump, the value of the unconditional jump coordinate x is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the unconditional jump=unconditional jump;
when the element is unconditionally returned, the value of the unconditionally returned coordinate x is CONN_DISTANCE, and the value of the coordinate y is RT_WIDTH/2+CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x=unconditional jump, x, coordinate y=rt_head/2+unconditional return;
when the element is switch one, the value of the coordinate x of the switch is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the SWITCH I=switch I.x, the coordinate y=switch_HEIGHT/2+switch I.y, the right connection point coordinate x of the switch=switch I.x+switch_WIDTH, the coordinate y=switch_HEIGHT/2+switch I.y.
4. The interface layout method according to claim 3, characterized in that in step S23, specifically comprising:
when the element is a conditional jump, the value of the conditional jump coordinate x is CONN_DISTANCE+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the conditional jump = conditional jump; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is a conditional return, the value of the conditional return coordinate x is CONN_DISTANCE+switch one x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x=condition return, x, coordinate y=jm_height2+ condition return; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is coil one, the value of the coordinate x of coil one is CONN_DISTANCE+switch one, x+SWITCH_WIDTH, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; wherein, the left connection point coordinate x of the COIL I=coil I, x, coordinate y=COIL_HEIGHT/2+coil I; the value TOTAL _ WIDTH of the sum of all element lengths is then calculated,
when the element is a POU without right connection, the value of POU coordinate x is conn_distance 2, and the value of coordinate y is jm_width/2+cm_y+cm_head+min_v_distance+pou_head/2; the value total_width of all element lengths added up is then calculated.
5. The interface layout method according to claim 4, wherein in step S24, specifically comprising:
when the element is a conditional jump, the value of the conditional jump coordinate x is conn_distance 2, and the value of the coordinate Y is cm_y+cm_head+min_v_distance; the left connecting point coordinate x of the conditional jump = conditional jump; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is a conditional return, the value of the conditional return coordinate x is CONN_DISTANCE, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the condition return = condition return; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is coil two, the value of the coordinate x of coil two is CONN_DISTANCE 2, and the value of the coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point coordinate x of the second coil=the second COIL, x and the coordinate y=the coil_head/2+the second COIL; then calculating the total_width value of the sum of the lengths of all the elements;
when the element is another POU, the value of POU coordinate x is conn_distance 2, and the value of coordinate Y is cm_y+cm_head+min_v_distance; then calculating the total_width value of the sum of the lengths of all the elements, and repeating the step S24;
when the element is a switch II, the value of a switch II coordinate x is CONN_DISTANCE 2, and the value of a coordinate Y is CM_Y+CM_HEIGHT+MIN_V_DISTANCE; the left connecting point of the second switch is x=the second COIL, x, and the coordinate of the second switch is y=the second coil_HEIGHT/2+switch; the right connection point coordinate x of the second switch=coil second, x+coil_with, and the coordinate y=coil_head/2+switch second; then, the value total_width of all element lengths added up is calculated, and the process goes to step S23.
CN202311486162.6A 2023-11-09 2023-11-09 Interface layout system and layout method for ladder diagram logic configuration Active CN117221146B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311486162.6A CN117221146B (en) 2023-11-09 2023-11-09 Interface layout system and layout method for ladder diagram logic configuration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311486162.6A CN117221146B (en) 2023-11-09 2023-11-09 Interface layout system and layout method for ladder diagram logic configuration

Publications (2)

Publication Number Publication Date
CN117221146A CN117221146A (en) 2023-12-12
CN117221146B true CN117221146B (en) 2024-01-23

Family

ID=89043039

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311486162.6A Active CN117221146B (en) 2023-11-09 2023-11-09 Interface layout system and layout method for ladder diagram logic configuration

Country Status (1)

Country Link
CN (1) CN117221146B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541514A (en) * 2010-12-09 2012-07-04 沈阳高精数控技术有限公司 Method for converting structural text language into trapezoidal graph language
CN104656543A (en) * 2015-03-17 2015-05-27 浪潮集团有限公司 PLC gradient diagram matrix editing display method
CN109690426A (en) * 2016-09-14 2019-04-26 三菱电机株式会社 The edit methods of trapezoid figure program editor auxiliary device and trapezoid figure program
WO2019192397A1 (en) * 2018-04-04 2019-10-10 华中科技大学 End-to-end recognition method for scene text in any shape
CN110706314A (en) * 2019-09-30 2020-01-17 广东博智林机器人有限公司 Element layout method and device, electronic equipment and readable storage medium
CN112327744A (en) * 2020-11-20 2021-02-05 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller
CN113419722A (en) * 2021-05-08 2021-09-21 南京南瑞继保电气有限公司 Ladder diagram editing method and device, electronic equipment and storage medium
CN114047912A (en) * 2021-11-23 2022-02-15 北京东土科技股份有限公司 Graph layout method and device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2821191B1 (en) * 2001-02-19 2003-04-04 Schneider Automation PROGRAMMING STATION DEVELOPING A SINGLE-LANGUAGE PROGRAM AND AUTOMATION EQUIPMENT USING SUCH A PROGRAM

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541514A (en) * 2010-12-09 2012-07-04 沈阳高精数控技术有限公司 Method for converting structural text language into trapezoidal graph language
CN104656543A (en) * 2015-03-17 2015-05-27 浪潮集团有限公司 PLC gradient diagram matrix editing display method
CN109690426A (en) * 2016-09-14 2019-04-26 三菱电机株式会社 The edit methods of trapezoid figure program editor auxiliary device and trapezoid figure program
WO2019192397A1 (en) * 2018-04-04 2019-10-10 华中科技大学 End-to-end recognition method for scene text in any shape
CN110706314A (en) * 2019-09-30 2020-01-17 广东博智林机器人有限公司 Element layout method and device, electronic equipment and readable storage medium
CN112327744A (en) * 2020-11-20 2021-02-05 深圳市海浦蒙特科技有限公司 Method for interconverting ladder diagram and instruction list for programmable logic controller
CN113419722A (en) * 2021-05-08 2021-09-21 南京南瑞继保电气有限公司 Ladder diagram editing method and device, electronic equipment and storage medium
CN114047912A (en) * 2021-11-23 2022-02-15 北京东土科技股份有限公司 Graph layout method and device, electronic equipment and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
PLC梯形图转化为多操作数逻辑指令的设计与实现;邱盛成;蔡启仲;李克俭;潘绍明;;计算机测量与控制(06);全文 *
吴亚山 ; 陆阳 ; 徐谦 ; .软PLC梯形图编辑与指令表生成方法研究.合肥工业大学学报(自然科学版).2015,(第10期),全文. *
软PLC梯形图编辑与指令表生成方法研究;吴亚山;陆阳;徐谦;;合肥工业大学学报(自然科学版)(第10期);全文 *
邱盛成 ; 蔡启仲 ; 李克俭 ; 潘绍明 ; .PLC梯形图转化为多操作数逻辑指令的设计与实现.计算机测量与控制.2016,(06),全文. *

Also Published As

Publication number Publication date
CN117221146A (en) 2023-12-12

Similar Documents

Publication Publication Date Title
CN113657064B (en) Multi-physical-field joint simulation method for power semiconductor module
Guan et al. Polynomial time algorithms and extended formulations for unit commitment problems
Ge et al. Safe Q-learning method based on constrained Markov decision processes
CN117221146B (en) Interface layout system and layout method for ladder diagram logic configuration
CN109214596A (en) Seek the grid shortest path AFW algorithm with direction constraint and obstacle limitation
US10558900B2 (en) Two-dimensional code processing method and apparatus
Conte et al. Cooperative distributed tracking MPC for constrained linear systems: Theory and synthesis
CN107944106A (en) A kind of pipeline layout optimization method based on PDMS softwares
CN114386356A (en) Wiring method, device, equipment and storage medium for chip design
CN114859909A (en) Path planning method and device for forklift type AGV
CN112287433A (en) Space topological structure generation method and device, computer equipment and storage medium
CN106375849A (en) Template generation method, template generation device, video updating method and video updating device
de Lima et al. Distributed satisficing MPC
Qiang et al. A new method for mobile robot path planning based on particle swarm optimization algorithm
CN116184933A (en) Laser cutting power determining method, control system, device and storage medium
CN113657636B (en) Automatic planning generation algorithm for power grid operation mode diagram
CN111931993A (en) Power transmission network wiring diagram generation method and system
CN113517694A (en) Method and device for setting parameters of quasi-resonant controller, electrical equipment and medium
CN114254467A (en) Power grid ring network diagram generation method
CN114218210A (en) Data processing method and device and electronic equipment
CN112966893A (en) Logistics network planning method and device
CN114123267B (en) Power transmission path management method and device
Borges et al. Performance comparison of particle swarm optimization strategies to adjust a nonlinear gapid controller
CN115358681B (en) Indoor multi-task point path planning method under static barrier
CN117349999B (en) Marine wind farm submarine cable comprehensive topological structure optimizing method and storage medium

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
GR01 Patent grant
GR01 Patent grant