Download Display - Siemens
Transcript
s 9 Behaviour description BEHAVIOUR DESCRIPTION The behaviour description for a component consists of a part that is executed once during initialisation and a part that is carried out in every cyclic calculation step. The same description syntax applies to both parts. There are two different approaches to the behaviour description for a component: • Equation-oriented approach The equation-oriented approach describes every new status value or output value as an explicit function of the inputs, parameters and states. It is particularly suitable for modelling physical contexts. This approach allows you to describe the change in continuous state variables using common differential equations as well. • Instruction-oriented approach The instruction-oriented approach describes the calculation of new state variables or outputs in the form of programming instructions that are processed sequentially in the specified order. This approach is particularly suitable for modelling technical behaviour. The two approaches can also be combined in a component type. 9.1 Conversion of the behaviour description to C# code Regardless of which approach is used to define the behaviour of a component type, it is ultimately converted into C# code in the simulation project for every component instance. This conversion takes place automatically and cannot be seen by and is of no significance to the user. Not all syntax errors are detected before the code is generated, so the compiler may also generate error messages. Please note that the information in such error messages relates to the generated code that differs from the behaviour specified in the component type in terms of both syntax and breakdown. 9.2 The equation-oriented approach In the equation-oriented approach, the syntax in which you set out the behaviour of your component type consists of relationships in the form of equations, rather than instructions. These equations explicitly describe how a state variable or an output is calculated from other variables, for example as follows: Output = Parameter * Input; Essentially: • Every equation contains the equals sign. • On the left of the equals sign is the variable that is being determined. On the right of the equals sign are the variables that are read (explicit form of an equation). • At the end of every equation there is a semicolon. • Any variable may occur only once on the left of the equals sign, i.e. a variable may only be determined once. The following variables may appear on the left of the equals sign: • Outputs Copyright Siemens AG, 2013 Process Automation SIMIT 7 – CTE Page 49