长沙工控帮教育科技有限公司整理
Step 14: Downloading and Debugging the User Program
1. Select the Options > Application Settings menu command
3.7 Programming the Structure of a State Graph
3.7.3 Possibilities of Aligning Graphical Objects
Using the grid
The grid serves as an aid in aligning and positioning objects precisely.
• The drawing area is filled with a grid when you select the View > Grid Points menu command.
• In order to set the grid size select the Options > Settings for Graph Groups/State Graphs menu command and enter the desired values in the
"Graphics" register tab.
• Activate the Options > Align to Grid menu command in order to move selected objects to the next grid point.
• Select the Options > Snap to Grid menu command in order to align objects automatically to the grid during insertion or moving.
Aligning to other objects
The following menu commands facilitate symmetrical alignment of elements:
• In order to align several objects in the same vertical or horizontal position, select several objects with the lasso and then select the Options > Align >
To Object > Vertically/Horizontally menu command. Then click on the object to which the selected objects are to be aligned.
• In order to place objects equidistantly select the objects and then select the Options > Align > To Distance > Vertically/Horizontally menu command.
• In order to place an object before or after another object, use the Options > Forwards or Options > Backwards menu commands.
Positioning the page
You can have the print page frames displayed if you want to adapt the layout of the state graphs or graph groups to the format of the future print page already while drawing.
• Have the print page frames displayed by using the View > Print Page Frame menu command.
• Use the Options > Align > To Page menu command to center a selected object or a group of objects exactly to the nearest print page.
长沙工控帮教育科技有限公司整理
Aligning lines
Transition and message lines do not always have to be straight. If the graphics are complex, bending the lines can give you a better overview.
• Lines can be bent by clicking on the square in the line middle and dragging it in any direction.
• Whenever you bend a line, it is separated into two sections. Additional nodes from which the line sections can be bent again are displayed at the middle of each section.
• In order to straighten the lines select the Options > Straighten Line menu command or delete individual nodes.
3.7.4 States
States
Every state which a function unit can enter is represented by a state in the state graph. A state is represented as a circle. Every state has a unique number within the state graph. Names can also be assigned to the states in order to obtain a clearer overview.
Actions can be triggered in the states. The time at which the action is executed can be defined: For the entry in the state, during the state or when leaving the state.
Initial state
A state for the initialization is required in every state graph.
In the initial state it is possible to check whether the functional unit is in a defined initial position. If required, it can be brought to the initial position.
A state becomes the initial state when an Any transition branches into the state which queries the predefined variable INIT_SD.
Steps for inserting states
Proceed as follows in order to enter states:
1. Open a state graph window.
2. Select the Insert > State menu command. The cursor then changes its shape to an insertion cursor.
3. Click on the point at which the state is to be inserted.
4. Insert further states or press ESC in order to leave the insert mode and return to the editing mode.
长沙工控帮教育科技有限公司整理
Assigning the state name, number and comment
You can assign the following properties to the states. These do not have any influence on the program execution.
• State name
The state name is indicated in the instruction table of the state. The names are also displayed in the context of a process error diagnosis.
• State number
State graph with sequential numbering require the least memory. When states are inserted, state numbers are assigned sequentially automatically. However, gaps in the numbering occur when you delete states. In this case you can change the numbering in order to close this gap.
• State comment
A well-commented user program can be interpreted rapidly and is thus easy to update.
Assigning names, numbers and comments
When you have selected a state and then select the Edit > Object Properties menu command you can enter the name, number and comment of the state in the subsequent dialog box.
Assigning state characteristics
Characteristics can be assigned to states so that later diagnostics are possible.
The following figure shows a state graph whose states have had characteristics assigned.
1 1 1
3
ME2
E1
Characteristic Function Abbreviation
Error Outputs an error message to the diagnostic program E Message Outputs an operating message to the diagnostic program ME
You can select the desired characteristic after you have selected a state and have then selected the Edit > Object Properties menu command.
Note
长沙工控帮教育科技有限公司整理
Handling states Selecting:
Elements can be selected by various means:
• Individual elements can be selected by clicking on them.
• Several elements can be selected by using the lasso function. Position the cursor on the drawing area, keep the mouse button pressed and drag the cursor around the desired elements.
• If you press the [SHIFT] key as well while you are drawing a lasso, only the elements which can be copied are selected.
• Alternatively you can select several elements by keeping the [CTRL] key pressed while clicking on the elements.
Moving:
1. Select one or more states.
2. Click on one of the selected states and drag the selection to the desired position while keeping the mouse pressed.
3. Select the View > Update menu command if the screen display was distorted by the dragging operation.
Copying:
You can copy states both within a state graph as well as to other state graphs.
1. Select one or more states.
2. Select the Edit > Copy menu command.
3. Select the Edit > Insert menu command. The cursor then changes its shape to an insertion cursor. Click with the insertion cursor on the point in the drawing area at which you want to insert the state.
Cutting:
When you cut a selected object you place it into the clipboard. It can then be inserted at any other point.
• Select a state and then select the Edit > Cut menu command. Ensure that you only select the circles which have state numbers. You cannot cut elements if you select instruction tables or permanent instructions at the same time.
Deleting:
• Select a state and then select the Edit > Delete menu command. Ensure that you only select the circles which have state numbers. You cannot delete elements if you select instruction tables or permanent instructions at the same time.
长沙工控帮教育科技有限公司整理
3.7.5 Transitions
Transitions
Transitions contain the transition conditions. A status change is carried out when all the conditions of a transition are fulfilled.
Several transitions can lead from one state. If the conditions of several transitions are fulfilled, the transition with the highest priority switches, the highest possible priority being 1.
Transition types
Transition type Function Display
Normal transition A normal transition leads from a starting state to a
subsequent state. 1
2 1
Any transition An Any transition leads from all states to a target state.
Any transitions are always processed, irrespective of the current state of a state graph. They are used, for example, for the permanent monitoring of higher-level conditions (for example, EMERGENCY-Off). If the monitoring case programmed in the Any transition arises, the system branches to the target state.
If a state graph has several Any transitions, an individual priority is assigned to each Any transition. The priority of the Any transitions are evaluated separately from the priorities of the other transitions: All the Any transitions always have a higher priority than the normal transitions.
An Any transition which queries the predefined variable INIT_SD is treated as a startup transition. It is used to initialize the state graph.
1 3
Return transition A Return transition leads from the current state back to the previously active state.
Return transitions do not have a higher priority than the normal transitions.
1
1长沙工控帮教育科技有限公司整理
Steps for inserting transitions Proceed as follows:
1. Open a state graph window.
2. Select the Insert > Transition menu command. The cursor then changes its shape to an insertion cursor.
3. Click on the output point of the transition.
4. Keep the mouse button pressed and drag the cursor to the target. When you are there, release the mouse.
5. Insert further transitions or press ESC in order to leave the insert mode and return to the editing mode.
Transition types
Depending on where the end points are placed the following transitions are created:
• A normal transition (between two states),
• An Any transition (pointing from any point of the drawing area to a state)
• Or a Return transition (pointing from a state to any point of the drawing area).
Specifying the transition priority
If several transitions leave a state, a different priority is assigned automatically to each transition. The priority is displayed in a small square at the transition arrow.
The transition priorities do not have to be assigned without gaps.
If required, change the priorities by using the Edit > Object Properties menu command.
Assigning the transition name and comment
You can assign names and comments to the transitions. These properties do not have any influence on the program execution.
• Transition name
The transition name is displayed in the instruction table of the transition. The name is also displayed at a connected operator control and monitoring device.
• Transition comment
A well-commented user program can be interpreted rapidly and is thus easy to update. The comments are also displayed at a connected operator control and monitoring device.
When you have selected a transition and then select the Edit > Object Properties menu command you can enter the name and comment of the transition in the subsequent dialog box.
长沙工控帮教育科技有限公司整理
3.7.5.1 Assigning Transition Characteristics
You can assign transition characteristics in order to program operating modes and to take waiting times into consideration. The following figure shows a state graph whose transitions have had characteristics assigned.
W 1
A 1 E
MA 1
3 2
WT T#500ms1
Characteristic Function Abbreviation
Manual Transition only switches in the manual operating mode MA Auto Transition only switches in the automatic operating mode A Waits When the transition is switched a waiting time which was
planned in the output state is taken into consideration.
W Error Identifies the transition as an error transition. E
You can select the desired characteristic after you have selected a transition and have then selected the Edit > Object Properties menu command.
Note
The abbreviations MA, A, W and E can also be displayed directly in the transition node. To do so, select the Options > Application Settings menu command and activate the corresponding option in the "Display" register tab.
Handling transitions Selecting:
Elements can be selected by various means:
• Individual transitions can be selected by clicking on them.
• Several transitions can be selected by using the lasso function. Position the cursor on the drawing area, keep the mouse button pressed and drag the cursor around the desired elements.
• Alternatively you can select several transitions by keeping the [CTRL] key pressed while clicking on the transitions.
长沙工控帮教育科技有限公司整理
Moving:
1. Move around the entire transition with the lasso.
2. Select the Edit > Cut menu command. Select the Edit > Insert menu
command. The cursor then changes its shape to an insertion cursor. Click with the insertion cursor on the point in the drawing area at which you want to insert the transition.
Moving starting or end points:
1. Select the starting or end point of a transition.
2. Drag it to the desired state while keeping the mouse button pressed.
Copying:
1. Select a transition by clicking on the box in the transition center.
2. Select the Edit > Copy menu command.
3. Select the Edit > Insert menu command. The cursor then changes its shape to an insertion cursor. Click with the insertion cursor on the point in the drawing area at which you want to insert the transition.
Aligning transition lines:
Transition lines do not always have to run straight. If the graphics are complex, bending the lines can give you a better overview.
• Transition lines can be bent by clicking on the square in the transition center and dragging it in any direction.
• Whenever you bend a transition line, it is divided into two sections. Additional nodes from which the line sections can be bent again are displayed at the middle of each section.
• In order to straighten the lines select the Options > Straighten Line menu command or delete individual nodes.