24.01.2015 Views

PLC Programming

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

What is What in CoDeSys<br />

Note:<br />

When an action has been deactivated it will be executed once more. This means that each action<br />

at least is executed twice (also an action with qualifier P).<br />

Implicit variables in SFC<br />

SFC Flags<br />

There are implicitly declared variables in the SFC which can be used.<br />

A flag belongs to each step which stores the state of the step. The step flag (active or inactive state of<br />

the step) is called .x for IEC steps or for the simplified steps. This Boolean<br />

variable has the value TRUE when the associated step is active and FALSE when it is inactive. It can<br />

be used in every action and transition of the SFC block.<br />

One can make an enquiry with the variable .x. as to whether an IEC action is active or<br />

not.<br />

For IEC steps the implicit variables .t can be used to enquire about the active time of the<br />

steps.<br />

Implicit variables can also be accessed by other programs. Example: boolvar1:=sfc1.step1.x; Here,<br />

step1.x is the implicit boolean variable representing the state of IEC step step1 in POU sfc1.<br />

For controlling the operation of SFC POUs flags can be used, which are created implicitely during<br />

running the project. To read this flags you have to define appropriate global or local variables as<br />

inputs or outputs. Example: If in a SFC POU a step is active for a longer time than defined in the step<br />

attributes, then a flag will be set, which is accessible by using a variable "SFCError" (SFCError gets<br />

TRUE in this case).<br />

The following flag variables can be defined:<br />

SFCEnableLimit: This variable is of the type BOOL. When it has the value TRUE, the timeouts of the<br />

steps will be registered in SFCError. Other timeouts will be ignored.<br />

SFCInit: When this boolean variable has the value TRUE the sequential function chart is set back to<br />

the Init step. The other SFC flags are reset too (initialization). The Init step remains active, but is not<br />

executed, for as long as the variable has the value TRUE. It is only when SFCInit is again set to<br />

FALSE that the block can be processed normally.<br />

SFCReset: This variable, of type BOOL, behaves similarly to SFCInit. Unlike the latter, however,<br />

further processing takes place after the initialization of the Init step. Thus for example the SFCReset<br />

flag could be re-set to FALSE in the Init step.<br />

SFCQuitError: Provided that the Execution of the SFC diagram is stopped for as long as this boolean<br />

variable has the value TRUE whereby a possible timeout in the variable SFCError is reset. All<br />

previous times in the active steps are reset when the variable again assumes the value FALSE. It is a<br />

pre-condition that the flag SFCError has been defined also, which registers any timeout in the SFC.<br />

SFCPause : Execution of the SFC diagram is stopped for as long as this boolean variable has the<br />

value TRUE.<br />

SFCError: This Boolean variable is TRUE when a timeout has occurred in a SFC diagram. If another<br />

timeout occurs in a program after the first one, it will not be registered unless the variable SFCError is<br />

reset first. It is a pre-condition that SFCError is defined, if you want to use the other time-controlling<br />

flags (SFCErrorStep, SFCErrorPOU, SFCQuitError, SFCErrorAnalyzation).<br />

SFCTrans: This boolean variable takes on the value TRUE when a transition is actuated.<br />

SFCErrorStep: This variable is of the type STRING. If SFCError registers a timeout, in this variable is<br />

stored the name of the step which has caused the timeout. It is a pre-condition that the flag SFCError<br />

has been defined also, which registers any timeout in the SFC.<br />

SFCErrorPOU: This variable of the type STRING contains the name of the block in which a timeout<br />

has occurred. It is a pre-condition that the flag SFCError has been defined also, which registers any<br />

timeout in the SFC.<br />

SFCCurrentStep: This variable is of the type STRING. The name of the step is stored in this variable<br />

which is active, independently of the time monitoring. In the case of simultaneous sequences the step<br />

CoDeSys V2.3 2-19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!