Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

the action of the SFC after the poweroff

SeanWong
2007-01-26
2013-01-30
  • SeanWong - 2007-01-26

    I often use the SFC to deal with the complex state machine. But I met a problem: how can I make the present step go to the specified step that I want if the power is suddenly off? I once used the PLC environment of the SELECTRON GmbH, they provided a vendor-specified component called "SFC assistant" to deal with this problem. Does the 3S have this special component?

     
  • Ralph Holz - 2007-01-26

    3S does not a provide such a Tool.

    There are two possibities to get a SFC retain.

    1. declare all Stepnames used in SFC as RETAIN variable

    2. define your POU istead of a PROGRAM as FUNCTION BLOCK and declare the FUNCTION BLOCK as RETAIN

     
  • Dreioli - 2010-12-22

    "1. declare all Stepnames used in SFC as RETAIN variable "

    I want to believe in this solution ! ^^
    But wich type do you declare the stepname ? (BOOL,STRING, ??)

    Thank's

     
  • shooter - 2010-12-22

    Put a restartvariable in each step you have and update it every step. when a restart happens check this restartvar where to jump to.
    however when power down there should be a special procedure dealing with it, asking what state the machine is in.

     
  • Dreioli - 2010-12-23

    shooter hat geschrieben:
    Put a restartvariable in each step you have and update it every step. when a restart happens check this restartvar where to jump to.
    however when power down there should be a special procedure dealing with it, asking what state the machine is in.

    Thanks Shhoter x)
    I already thought to do this way, but it's a crapy solution for my big SFC... x(

    The solution to make a FB of your SFC and declare the instance in VAR RETAIN works perfectly, but i think its not the better solution, its make so many modification on my programm.

    "1. declare all Stepnames used in SFC as RETAIN variable " is the best solution was make no modification in the programm.
    So i find "SFCStepType" for the type of the variable but now the question is where to declare it ??

    In local var: VAR OUTPUT RETAIN/VAR INPUT RETAIN/VAR RETAIN
    Ex: nameStep:SFCStepType;
    you got an error 4353 "name of step double :<namestep>"</namestep>

    In global var: VAR GLOBAL RETAIN
    Ex: nameStep:SFCStepType;
    its seems the name of the step you've declared isnt linked with the step in your SFC, nothin happen

    Is there a solution in this way ? x)

    (Sorry for my rude english...)

    Regards

     
  • shooter - 2010-12-29

    the answer is in the error:
    you did declare the steps in the sfc so when you put it again in global it says double.
    you can take one away, or look for all vars and put retain behind it.
    this will slow down the program btw.
    i do have theory on the state of machine.
    there are two main streams on this subject. depending on type.
    i would do it with states like press is closed, press moves up etc.
    after restart i would ask operator the state the machine is in to confirm, as lots can have changed.

     
  • Easytherm - 2011-01-22

    "There are two possibities to get a SFC retain....
    1. declare all Stepnames used in SFC as RETAIN variable
    2. define your POU istead of a PROGRAM as FUNCTION BLOCK and declare the FUNCTION BLOCK as RETAIN
    .....
    "

    my tests:
    2: works perfectly
    1: I can't find where is the right place to define the stepname variables as RETAIN.
    as Dreioli tells, declaring the stepname as a retain variable just results in an "error 4353 :name of step double :<namestep>", which is quite obvious, because the stepnames have been allready written (=declared) in the SFC steps. </namestep>

    The question is: where can I find the formal declaration of theses variables (with their variable type), in order to put there the RETAIN qualifyer. It seems these declarations are "implicit"

     
  • enric - 2013-01-30

    Hello,

    I have de same problem. I think I found the solution.
    1. declare all Stepnames and _Stepnames used in SFC as RETAIN variable less first Stepname
    For example SFC with two steps:
    VAR RETAIN
    Step1:BOOL; Step2:BOOL; _Step2:BOOL;
    END_VAR

    Regards

    Dreioli hat geschrieben:
    Thanks Shhoter x)
    I already thought to do this way, but it's a crapy solution for my big SFC... x(
    The solution to make a FB of your SFC and declare the instance in VAR RETAIN works perfectly, but i think its not the better solution, its make so many modification on my programm.
    "1. declare all Stepnames used in SFC as RETAIN variable " is the best solution was make no modification in the programm.
    So i find "SFCStepType" for the type of the variable but now the question is where to declare it ??
    In local var: VAR OUTPUT RETAIN/VAR INPUT RETAIN/VAR RETAIN
    Ex: nameStep:SFCStepType;
    you got an error 4353 "name of step double :<namestep>"
    In global var: VAR GLOBAL RETAIN
    Ex: nameStep:SFCStepType;
    its seems the name of the step you've declared isnt linked with the step in your SFC, nothin happen
    Is there a solution in this way ? x)
    (Sorry for my rude english...)
    Regards</namestep>

     

Log in to post a comment.