Skip to content

SFC Initialisation

Hi,

I'm currently trying to do the following thing on the SFC add-on :

An emergency stop is activated, i set my SFC to HALT mode,

Then a button 'Reset' is push, the SFC come back to step 1.


I found how to set to HALT mode, but i can't find how to put the SFC to step 1.

How can i do ?

Comments

  • Here is the answer from the PLCnext Engineer support team:

    ===============================================================

    if you set the variable to "Halt"-Mode you can operate via. the inputs 

    Step_ID and Activate_Step to the first step for example.

    The right Step_ID can be select below the struct Step_States.


    Important:

    The ID can be different to the Step count.

    Example = Step 1 has ID 2



    If you have additional questions do not hesitate to ask.

  • Hi Robin02,

    first things first so check the help page for programming in SFC. You'll find the FBs' parameter description.

    Then I would suggest something along this pseudo code:

    IF ResetButton = TRUE AND SfcFB.Active_Operating_Mode = HALT THEN


    //Go through all steps and deactivate them

    WHILE(I < Step_States.StateCount) DO

    SfcFb.Deactivate_Step(Step_States.StateList[I]);

    I++

    End_while


    //Crawl through the structure and check the object property. Return the ObjectID of init step

    InitStepID := FindInitStep(SfcFb.STRUCTURE);

    SfcFb.Activate_Step(InitStepID)


    End_If

Sign In or Register to comment.