长沙工控帮教育科技有限公司整理
Step 14: Downloading and Debugging the User Program
8 Tips and Tricks
How can one reduce the program size?
Reducing the DB size
1. Select the Options > Settings menu command.
2. Activate the option "Restructure data block" in the "Compile" register tab.
3. Compile and download the program again.
(Caution: You must switch the CPU to STOP mode in order to download the program with the restructured data block.)
Reducing the FC size
• Number the state numbers in ascending order without gaps and begin from zero in each state graph.
• Use block calls (CALL) very sparingly, or at least reduce the number of their parameters.
• Use waiting and monitoring times sparingly.
• Select the Options > Settings menu command and deactivate the option
"Switch Any transition only once" in the "Compile" register tab.
We recommend instead that you explicitly reset those conditions which caused the Any transition to be switched by using a reset command (for example, in the transition action).
• Select the Options > Settings menu command and deactivate the option
"Execute cyclic actions with RLO=0" in the "Compile" register tab.
We recommend that you explicitly reset the signals instead (for example, in the output action).
• Deactivate the predefined variables which you do not require in your program.
For this purpose select the variable in the variable declaration window and then select the Edit > Properties menu command. Then select the "Attributes"
register tab in the dialog box and assign the value "false" to the "S7_active"
attribute.
长沙工控帮教育科技有限公司整理
How can I find out whether an S7-HiGraph source agrees with a program running ONLINE?
During compilation the generated block is assigned the same time stamp as the source last modified (state graph or graph group). This means you can determine reliably whether an archived project version (for example, on EOD) is the same as the content of the programmable controller or not.
Proceed as follows:
1. First check in the SIMATIC Manager whether the offline block agrees with the ONLINE block (PLC > Online/Offline Comparison" or "Options > Block comparison" menu command (as from V5)).
2. Once you have determined that the offline block is the same as the block on the programmable controller, you must establish whether the graph group has been compiled and is up-to-date. To do so, display the properties for the relevant graph group and check the time stamp of the most recent modification in the "Source files" register tab. Compare this with the modification date of the off-line block. If they are the same, the existing S7-HiGraph source agrees with a program running ONLINE.
A graph group which was compiled error-free does not run in the CPU
If the function "Monitoring the program status" displays that all the state graphs are in the state zero:
• Check whether you have also downloaded the block which calls the S7-HiGraph FC (for example, OB 1), to the CPU.
• Check whether you have programmed the call of the S7-HiGraph FC in it.
If the CPU displays STOP and/or SF:
• Check whether you have downloaded the S7-HiGraph FC.
• Check whether the calling block does not call the S7-HiGraph FC but rather another FC which is not downloaded.
• Check whether all the FCs called by the graph group are downloaded.
• Check whether all the DBs referenced in the graph group are downloaded.
The function "Monitoring the program status" cannot be selected (message
"Non-correctable error 02")
You have selected variables in the "Select variables" dialog box whose current parameters refer to non-existing data blocks. Delete these variables from the list.
长沙工控帮教育科技有限公司整理
Can S7-HiGraph sources also be printed out with printers which do not have a Postscript functionality?
When printers without Postscript functionality are used the printing image depends on the used printer/driver and on the settings used. Thus we recommend, for example, the following settings:
• HP Laserjet 4SI under WIN 95: Graphics as vector
• HP Laserjet 4mPlus under WIN NT: Text as graphics; without spooling from metafile
• HP Laserjet 5SI MX under WIN 95: Grid graphics and text
• HP Laserjet 5SI MX under WIN NT: Text as graphics; without spooling from metafile
Graph group takes a long time to open and compile
Remove unused declarations from the variable declaration windows.
No reference data are displayed in a project with S7-HiGraph blocks
Reference data cannot be generated by S7-HiGraph blocks while S7-HiGraph is running in the program status. Terminate the program status in S7-HiGraph!
A converted HiGraph V2.7 source cannot be compiled without errors
In HiGraph V2.7 it was possible to supply current parameters of the type WORD or DWORD to formal parameters of a called FC of the type INT or DINT when the FC is called from HiGraph.
As from S7-HiGraph V4.0 this is no longer possible. Such constellations result in a
"type conflict" error during compilation.
Adapt the data types of the formal and current parameters to each other.
Automatic resetting of all signals which were set during a state
1. When programming the state graphs use a separate instruction block for each assignment.
2. Before compiling the graph group select the option "Execute cyclic actions with RLO=0" in the "Compile" register tab (Options > Document Settings menu command).
This option has the effect that the cyclic actions of a state graph are executed once more with RLO=0 when the state graph is left, and thus that all the signals which were set during the state are reset.
长沙工控帮教育科技有限公司整理
Inactive variables lead to the compiler message "Variable xy does not match a declaration neither is xy in the symbol table"
If the above error message is displayed although the respective variable is entered in the variable declaration, the reason may be that it is not active.
In order to activate the variable, select the "Object Properties" menu command from the pop-up menu (right-hand mouse button) and enter the value "true" for the
"S7_active" attribute in the "Attributes" register tab.
长沙工控帮教育科技有限公司整理
Glossary
A
Address
An address is part of a STEP 7 instruction and specifies with what the processor is to do something. It can be addressed either absolutely or symbolically.
Any transition
An Any transition is a particular type of transition. An Any transition goes from all states to a target state. Any transitions are continually processed independently of the current state of a state graph. Any transitions are used, for example, for the permanent supervision of invalid signals. If the supervision situation programmed in the Any transition occurs, the process branches to a target state.
C
Compilation
Compilation is the generation of an executable user program from a source file.
Current parameter
Current parameters replace the formal parameters when a state graph is compiled.
Example: The formal parameter “Start“ is replaced by the current parameter “I 3.6“.
Cycle time
The cycle time is the time which the CPU needs to execute the user program once.
D
Data block (DB)
长沙工控帮教育科技有限公司整理
Data type
A data type is used to determine how the value of a variable or a constant is to be used in the user program.
In SIMATIC S7 there are two types of data types available to the user in accordance with IEC 1131-3: standard and derived data types.
Derived data type
Derived data types are created by the user by means of the data type declaration.
They do not have an own name and can therefore not be used several times. A differentiation is made between fields and structures. The data types STRING and DATE AND TIME are such data types.
Diagnostic buffer
Buffered memory area in the CPU, in which diagnostic events are saved in the sequence of occurrence.
F
Fault signal
Displays a fault in the process.
Formal parameter
A formal parameter is a token value for the current parameter in the case of configurable code blocks. In the case of FBs and FCs the formal parameters are declared by the user. In the case of SFBs and SFCs they already exist. When the block is called, a current parameter is assigned to the formal parameter so that the called block operates with this current value.
The formal parameters are part of the block-specific data of the block and are divided into the input, output and in/out parameters.
Functional unit
Functional units are the smallest physical objects within a plant or machine which can only have one state at any one time (for example, a valve). In S7-HiGraph functional units are represented by state graphs.
长沙工控帮教育科技有限公司整理
G
Graph group
A graph group is a number of state graphs belonging together which can be compiled, downloaded and saved. It defines an ordered sequence of calls to state graphs, which is executed cyclically during the program execution.
I
Initial state
Specifies which state a functional unit should assume at power on.
Initial value
Signal state of the address which causes a fault or operation message.
Instance
In S7-HiGraph the term instance is used for the call of a state graph in a graph group.
Instruction
An instruction is part of a STEP 7 statement and specifies what the processor is to do.
Instruction
Smallest independent unit of a user program written in a text language. It represents an operation sequence for the processor.
M
Message
State graphs can influence one another in the way they are executed by exchanging messages.
Message acknowledgement
长沙工控帮教育科技有限公司整理
Message acknowledge memory
Memory area in the PLC for messages and message acknowledgements which occur in connection with a process error diagnosis.
Mnemonics
The mnemonics are the abbreviated representation of the addresses and programming instructions in the program (for example, "I" stands for input).
STEP 7 supports the international representation IEC (in English) and the SIMATIC representation (based on the German names for the instructions and the
conventions for SIMATIC addressing).
O
Operating mode
The operating mode defines the method by which a machine or plant operates (for example in automatic mode, manual mode, setup mode).
Operation message
Operation messages indicate a status in the process.
Operation messages are often used to display invalid operations. Example: A motor is to be activated by operator control, although this is not allowed due to an open protective door.
Operator panel (OP)
Operator panel for rapidly accessing the machine, for example, in order to specify setpoint values or to output machine data.
Organization block
Organization blocks form the interface between the operating system of the CPU and the user program. The sequence for executing the user program is specified in the organization blocks.
P
Permanent instructions
长沙工控帮教育科技有限公司整理
Predefined variable
Predefined variables are variables which are entered automatically into the variable declaration when a state graph or a graph group is created.
Process error diagnosis
Localization of errors in the process (outside the PLC). For process error diagnosis you require a program item which can determine the error source for example, by comparing the setpoint and actual states of the process.
Project
A folder for all the objects of an automation solution irrespective of the number of stations, modules and their networking.
R
Return transition
A return transition returns from the current state to the previously active state.
Run sequence
Sequence in which the instances contained in a graph group are executed.
S
S7-HiGraph
Programming language for the comfortable functional description of technological objects in the form of state graphs.
S7-HiGraph source file
An S7-HiGraph source file is part of an S7 program that is created with S7-HiGraph and from which an executable function (FC) is generated by compilation.
S7 program
A folder for blocks, source files and charts for programmable S7 modules which also contains the symbol table.
长沙工控帮教育科技有限公司整理
Standard data types
Standard data types are predefined data types in accordance with IEC 1131-3.
Examples:
• “BOOL“ defines a binary variable (“Bit“);
• Data type “INT“ defines a 16-bit fixed-point variable
Startup transition
Transition for initializing a state graph.
The startup transition ends in the default setting of state 0. It queries the preset variable INIT_SD, so that if this variable has the signal 1, it branches to state 0. If you make sure that the parameter "INIT_SD" has the signal 1 in the calling block on startup, the state graph will be initialized with this value.
State
Every state which a functional unit can have is represented by a state in the state graph.
A state graph can never be in more than one state at any one time. The states have instructions assigned to them which are executed if the state is active.
State graph
State graphs describe the behavior of functional units. They define states, which the functional units can have and the transitions between the states. The entire function of the plant or machine is represented by a combination of state graphs.
Statement List (STL)
The statement list (STL) is a machine text-based programming language. STL is the assembly language of STEP 5 and STEP 7. If a program is programmed in STL, the individual instruction statements correspond to the sequences with which the CPU executes the program.
Station
Device which can be connected to one or more subnets as a connected unit, for example, programmable logic controllers, programming devices, operator stations.
Status
The status is the designation for the signal state of an address in the
长沙工控帮教育科技有限公司整理
Status display
The status display is the display of the signal state of one or more addresses on the screen or display of a programming device connected online to the
programmable logic controller.
Status overview
The status overview is the status display of a graph group.
Symbol
A symbol is a name defined by the user under observance of certain syntax rules.
This name can be used after you have specified what it is to represent (for
example, variable, block) for programming and for operator control and monitoring.
Example: Address: I 5.0, Data type: Bool, Symbol: Emergency stop.
Symbol table
Table for assigning symbols (= names) to addresses for shared data and blocks.
Examples: Emergency stop (symbol) - I 1.7 (address) or closed-loop controller (symbol) - SFB 24 (block).
System attributes
You can assign the following system attributes to parameters in HiGraph.
• S7_active
Displays whether the declaration of the parameter is active or inactive.
• S7_message
designates whether a variable is used for exchanging messages between state graphs.
长沙工控帮教育科技有限公司整理
T
Transition
A transition contains conditions which have to be fulfilled for the open-loop control to switch from one state to the next.
Transition priority
If several transitions are assigned to one state, a different priority is assigned to each transition. If the conditions for more than one transition are fulfilled, the transition with the highest priority switches to the next state.
V
Variable declaration
The variable declaration encompasses the specification of a symbolic name, a data type as well as any initial value and comment.
长沙工控帮教育科技有限公司整理
Index
"
"Current parameters" tab card. ... 3-6
"Instructions" tab card ... 3-6
)
Aligning graphics objects . ...3-18 AN . ...5-7 AN( . ...5-7 Any transition ...3-22 Application example . ...2-2 Arranging windows ... 3-6, 3-7 Arranging working windows . ... 3-6, 3-8 ASIN. ...5-7 Assigning characteristics . ...3-20 ATAN. ...5-7 Authorization. ... 1-6, 1-7 Authorization diskette ... 1-6, 1-7 Authorization to use. ...1-6 AUTHORSW.EXE . ...1-6 AutomaticMode ...3-13 AW . ...5-7
B
Basics of programming with HiGraph ... 3-1, 3-2 Behavior on startup and restart ...7-3 Block structure ...1-1 Character (CHAR) . ...5-10 Characteristics ... 3-8, 3-20, 3-24 CLR . ...5-7 Cold restart . ... 7-3, 7-4, 7-5
长沙工控帮教育科技有限公司整理
Conversion of programs from
HiGraph 2.6/2.7. ... 3-54 Copying
State... 3-21 Transition. ... 3-25 COS . ... 5-7 Counter ... 5-10 Creation of diagnostic data (steps)... 4-3, 4-11 Criteria analysis . ... 4-5 CU. ... 5-7 Current parameters
Current parameters for messages. ... 3-37 Exchanging messages between
state graphs . ... 3-37 Graph groups
Programming messages. ... 3-37 Interaction between variable declarations
and current parameter assignments .... 3-16 Messages . ... 3-37 Printing ... 3-52 User interface. ... 3-5 CurrentState . ... 3-13, 3-15 Cutting
State... 3-21 Transition. ... 3-24 Cyclic actions... 3-28 Cyclic processing of a state graph . ... 7-1
D
-D . ... 5-7 Data types . ... 5-10 DATE . ... 5-10, 5-11 Date and time (DATE_AND_TIME). ... 5-10 DATE_AND_TIME . ... 5-10 Debug functions of STEP 7 . ... 3-50, 3-51 Debugging . ... 3-47 Monitoring the program status ... 3-47, 3-49 DEC . ... 5-7 Declaring variables
Columns in the variable
declaration window ... 3-11 Predefined variables. ... 3-12, 3-13 Steps for entering the variable
declaration . ... 3-38 Variable declaration window . ... 3-5, 3-10 Diagnosis ... 4-1 Diagnosis via format converter ....4-9, 4-10, 4-11
Displaying messages in the
message screen . ... 4-4 Displaying reference data . ...3-40, 3-41 Displaying units in the overview screen. ... 4-8 Double word (DWORD) ...5-10 Downloading . ...3-45, 3-46 Downloading for the first time . ...3-45 Downloading the user program . ...3-45, 3-46 Drawing and positioning aids. ... 3-8 Drilling machine example ... 2-2 DTB . ... 5-7 DTR . ... 5-7 DWORD...5-10
E
Emergency authorization ... 1-6 Enlarging and reducing the view. ... 3-7 Entering the priority. ...3-23 Entry actions . ...3-28 Example program . ... 2-2 Exchanging messages between
state graphs...3-37 EXP . ... 5-7
F
Fault messages . ...4-4, 4-5 FN. ... 5-7 Fonts. ... 3-8 Formal parameters . ... 3-1 Format converter diagnosis... 4-9, 4-10, 4-11 FP. ... 5-7 FR. ... 5-8
G
Generating and displaying reference data....3-40 Graph. ... 3-4
Refer to state graph ... 3-4 Graph groups
Compilation . ...3-42, 3-43 Compiling . ...3-43, 3-44 Planning information ... 6-6 Printing. ...3-52, 3-53 Programming messages . ...3-37 Programming with absolute or symbolic
addresses . ...3-36
长沙工控帮教育科技有限公司整理
installation . ... 1-6 Starting. ... 3-4 User interface . ... 3-5 HiGraph 2.6 / 2.7 . ...3-54 HiGraph Version 4.0/4.01. ...3-55 HiGraphErrEmitterFB (FB 20) . ...4-11 HiGraphMsgEmitterFB (FC 101) . ...4-11 HiGraphUnivEmitterFC (FC 102). ... 4-3
I
-I . ... 5-7 IEC date (DATE). ...5-10 IEC time (TIME)...5-10 Inserting states . ...3-19 Installation... 1-6 Instance ...3-34 Inserting . ...3-34 Programming with instances. ... 3-1 Instance concept . ... 3-1 Instructions. ... 3-15, 3-26, 3-27, 3-28,
3-29, 3-30, 5-7
Instructions in STL . ... 5-7 Sorted by mnemonics ... 5-7 INT. ...5-10 Integer (INT). ...5-10 Integer 32 bits (DINT) . ...5-10 Interaction between S7 HiGraph
the automation system and the OP . ... 4-2 the automation system and the OP
(format converter) ...4-10 Interaction between variable declarations
and current parameter assignments...3-16 Interaction between variable declarations
and instructions . ...3-15 Internet. ...vi Introduction . ... 1-1 INVD . ... 5-7 Linking the incoming and outgoing
messages. ...3-38 LN . ...5-7
M
ManualMode ...3-13 Message screen (diagnosis) ...4-4 Message window. ...3-5 Messages . ...3-37 Migration...3-54 Mnemonics . ... 3-30, 5-7 MOD. ...5-7 Monitoring and controlling variables . ...3-50 Monitoring the program status . ... 3-47, 3-49 Monitoring time ... 3-32, 4-4, 4-9
Copying
State . ...3-21 Exceeding . ... 4-4, 4-9 Monitoring times...3-28 Movement screen (diagnosis) ...4-6 Multiple use of state graphs ...3-1
N
NEGD . ...5-7 NEGI . ...5-7 NEGR . ...5-7 New functions in HiGraph V5.0 ...1-4 NOT... 5-8, 5-9 Online help ... iv Opening state graphs . ...3-4 Operating modes
(planning information) . ... 6-11, 6-13 Operation enables (planning information) .... 6-10
长沙工控帮教育科技有限公司整理
P
Page numbering . ... 3-52 Page settings. ... 3-53 Planning the standard diagnostics with
a transfer line as an example ... 6-21, 6-22 Planning with a transfer line as
an example . ... 6-1, 6-2 PLC
Downloading to ... 3-45, 3-46 Downloading to . ... 3-45 Downloading to ... 3-45, 3-46 Pointer... 5-10 Points of use of addresses in the program .. 3-41 POP . ... 5-7 Positioning the working window . ... 3-7 Power on/off
Behavior during power on/off . ... 7-3 Prerequisite for program creation. ... 3-3 Prerequisite for standard diagnosis. ... 4-3 PreviousState . ... 3-13, 3-15 Print settings. ... 3-53 Applicable to the entire application... 3-52 Graphic or textual display of objects... 3-52 Sequence of print objects . ... 3-52 Zoom factor. ... 3-53 Printing . ...3-9, 3-52, 3-53 Printing steps. ... 3-52 Priority class . ... 3-23 Refer to "Priority". ... 3-23 ProAgent ... 4-1 Process error diagnosis. ...4-1, 4-2, 4-3, 4-4,
4-6, 4-8, 4-9, 4-10, 4-11
Program status ... 3-47, 3-49 Program structure . ... 1-1 Programming a state
Assigning characteristics . ... 3-20 States . ... 3-19 Programming a state graph . ... 3-4
Assigning a functional unit and a
state graph (drilling machine example) .. 2-7 Designing the state graphs
(drilling machine example) . ... 2-7 Determining the program structure
(drilling machine example) . ... 2-6 Determining the required state graphs
(drilling machine example) . ... 2-6 Opening... 3-4
Inserting . ...3-19 Programming symbolically ...3-36 Programming with symbolic addresses...3-36 ProTool/ProAgent . ... 4-1 PUSH... 5-7
R
R . ... 5-7 -R . ... 5-7 Rapid positioning at points of use
in the program . ...3-41 REAL . ...5-10 Real (REAL) . ...5-10 Reference to literature . ...iv Reloading...3-46 Reloading changes ONLINE . ...3-46 Return transition . ...3-22 RLD . ... 5-7 Run sequence . ...3-35
S
S . ... 5-7 S5TIME (SIMATIC time) ...5-10 S7 HiGraph . ... 1-1 S7 HiGraph-specific abbreviations in the
reference data . ...3-41 S7_message . ...3-38 Save format. ...3-55, 3-56 Saving...3-42 Saving state graphs and graph groups ...3-42 SD . ... 5-7 SE. ... 5-7 SET...5-8, 5-9 Setting colors . ... 3-8 Setting fonts in working windows. ... 3-8 Setting headers and footers . ...3-53 Setting the drawing area ... 3-7 Setting the page settings...3-53 Setting the printer . ...3-53 Setting up a project. ... 3-3
长沙工控帮教育科技有限公司整理
SLD. ... 5-7
ProTool/ProAgent .. 4-1, 4-2, 4-3, 4-4, 4-6, 4-8 Starting HiGraph. ... 3-4 Startup behavior . ... 7-4 Startup transition . ...3-22 State graph . ...3-17, 7-1 Creating/opening . ... 3-4 Printing. ...3-52, 3-53 Saving ...3-42 State name
number and comment ...3-20 StateChange . ...3-13, 3-15 Status . ... 3-47, 3-48, 3-49 Steps for assigning the message type . ...3-38 Steps for creating a HiGraph program . ... 3-2 Steps for programming the
statements for messages . ...3-38 STL instructions. ... 5-7 String . ...5-11 Structure of a state graph. ...3-17 Symbol table (drilling machine example)...2-11
T
T . ... 5-7 TAK. ... 5-7 TAN . ... 5-7 Template mechanism . ... 3-1 Refer to "Instance concept" . ... 3-1 Test functions of STEP 7 ...3-40 Testing
Displaying reference data. ...3-40 Test functions of STEP 7. ...3-40
Transitions . ...3-22 Copying Moving Deleting ...3-24 Specifying priorities...3-23 Transition characteristics ...3-24 Transition name. ...3-23 Transition properties . ...3-23 TRUNC . ...5-7
U
UDT_Motion. ... 4-3, 4-6 UDT_Unit. ...4-3 Unit overview (diagnosis). ...4-8 User interface...3-5 Adapting the user interface . ... 3-7, 3-8 Using state graphs and graph groups. ...3-1 UsrMsgQuit. ...4-11
V
Validity of the manual . ... iii Variable declaration. ...3-11
Interaction between variable
declarations and instructions . ...3-15 Interdependency between variable
declarations and current parameter
assignments . ...3-16 Printing . ...3-52 Variable declaration window...3-5 Version 4.0/4.01 ...3-55 View
Enlarging and reducing . ...3-7 Volume of project data. ...3-17
W
Waiting times ...3-28 Warm restart . ... 7-3, 7-4, 7-5 What has changed from V4.01 to V5.0? . ...1-4 WORD . ...5-10
X
X . ... 5-7 X( . ... 5-7 XN. ... 5-7 XN(. ... 5-7
XOD. ... 5-7 XOW . ... 5-7
Z
Zooming... 3-7
长沙工控帮教育科技有限公司整理
Siemens AG A&D AS E 81
Oestliche Rheinbrueckenstr. 50 76181 Karlsruhe
Oestliche Rheinbrueckenstr. 50 76181 Karlsruhe