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

SFC EDGE DETECTION ISSUE

sverko
2016-11-30
2016-12-06
  • sverko - 2016-11-30

    Hi,

    I'm running very simple test program and I'm having some issues with order execution. Please see following images for better understanding. I was able to get this to work by adding rising edge block to StopPB_ON transition, but I think that it should work with out it as well. Hopefully someone can explain why it does not.

    Thank You

    IMG: Auto Mode.png

    IMG: Stope Mode.png

    IMG: Stope Mode 02.png

    IMG: SFC Settings.png

     
  • r.evbatyrov - 2016-12-02

    Hi sverko,

    you have race condition in the chart.
    your Run_Mode step will get active state, but just for one cycle - that is why you did not notice that. In this cycle the upper branch is evaluated: the Run_Mode is now active and StopPB_ON is TRUE, causing that Stop_Mode jump (from upper branch) prepares Stop_mode to be active in the next cycle and Run_Mode to be inactive in the next cycle.
    Regards
    Roman

     
  • sverko - 2016-12-02

    r.evbatyrov hat geschrieben:
    Hi sverko,
    you have race condition in the chart.
    your Run_Mode step will get active state, but just for one cycle - that is why you did not notice that. In this cycle the upper branch is evaluated: the Run_Mode is now active and StopPB_ON is TRUE, causing that Stop_Mode jump (from upper branch) prepares Stop_mode to be active in the next cycle and Run_Mode to be inactive in the next cycle.
    Regards
    Roman

    Hi Roman,

    First of all thank you for taking time to answer my question. I think that by selecting/checking "Calculate active transitions only" should take care of race condition and force StopPB_ON condition under Auto_Mode to be the only active transition. I might be wrong, but I thought that this is the main purpose of this option.

    Regards,

    Sverko

     
  • r.evbatyrov - 2016-12-05

    Hi sverko,

    no, it is not.
    "Calculate active transitions only" is an option to skip the evaluation of unrelated transitions. So, this option has no influence on the chain's logic. The decision whether some transition is considered to be active depends on the state of step before it.
    Regards,
    Roman

     
  • sverko - 2016-12-05

    r.evbatyrov hat geschrieben:
    Hi sverko,
    no, it is not.
    "Calculate active transitions only" is an option to skip the evaluation of unrelated transitions. So, this option has no influence on the chain's logic. The decision whether some transition is considered to be active depends on the state of step before it.
    Regards,
    Roman

    Hi Roman,

    Could you please explain why attached file is working differently with addition of R_TRIG next to edge detection contact (StopPB_ON)?

    Thanks,

    Sverko

    Test_11_22_16.project [158.56 KiB]

     
  • r.evbatyrov - 2016-12-06

    Hi Sverko,

    your actual design problem is the transition StopPB_ON which appears twice on the diagram and will be evaluated in adjacent cycles, confusing the logic which step should be activated in the next cycle.

    Adding R_TRIG to the transition code causes that the transition code will be evaluated TRUE on rising edge of xStopPB only - that means the transition is evaluated TRUE only once (for the transition element in the lower branch, preparing the Run_Mode step to be active in the next cycle). The second evaluation of the transition (in the next cycle from the the UPPER branch) will produce FALSE, preventing jumping to Stop_Mode. Without trigger the transition StopPB_ON would remain TRUE, causing jump to Stop_Mode.

    Regards
    Roman

     

Log in to post a comment.