Tins (Customer) asked a question.

How to improve click PLC scan rate

Dear all,

I am building a click plc cpu c0-02dd1-d project which include one analog input module, 2 input module, 2 output module, rs232 serial communication with pc and rs 485 modbus communication with load cell amplifier. The project has around 6 thousand steps ( infact there are unused subroutines I dont think these unused sub routines slow the scan rate). And the scan rate is around 13ms which is slow.

My question​

1. Does including analog input module ​slow plc scan rate significantly? (I have one which I dont need seriously)

2. Do unused subroutines affect scan rate

3. Do communication port affect scan rate significantly? (How to improve)

N​ote. There is no for loop in my code. But timer maths copy are present.


  • ADC TechnologyGroup_01 (AutomationDirect)

    ​1. No, not significantly.

    2. No, they will consume program steps but not execution time if they are not called.

    3. No, not significantly.

     

    You could change from the C0-0x series to the C0-1x series which offers a speed increase of "3 to 10 times faster".

     

    Depending on how your code is arranged, the END instruction can be used conditionally to terminate the scan early. See helpfile Topic CL179.

     

    If you are using subroutines, they can also Return early conditionally. See helpfile Topic CL176.

     

    Expand Post
    Selected as Best
  • RBPLC (Customer)

    "13ms which is slow"

    This is relative. For a great many applications this is more than fast enough. In the realm of PLC's, this isn't particularly slow. What exactly are you trying to do that necessitates a faster scan rate or where are you seeing potential issues?

    • Tins (Customer)

      I am building concrete batching plant controller. The first version of my ladder do these:

      1. Receive either analog input from the load cell amplifier or rs485 (now I stick with this)

      and see if it is greater than setpoint. If it is it will check it for more count for confirmation beside that .

      2. It will start timer and if the required weight not achieved then will trigger an alarm

      3. it also continously send this to the pc software (scada)​

      There are 4 load cell amplifier that will simultaneously communicate with the plc

      I have completed the project and tested in the field then result was bad. The plc wasnot able to close weighing valves at the right time.

      Then I removed read confirmation and alarm timer codes also some sacrification on the scada data update rate and other mechanical means on the system then the scan rate improved and also the accuracy of the weighing​.

      But still I need to improve if possible to not sacrify some features of the project​

      Expand Post
      • Orion HE (Customer)

        The valves themselves may be a source of delay, if they are motorized. I would look into the valves, load cell amplifier, and RS-485 communication before I looked at other shaving scan time. Maybe you have already done all that. I'm just having a hard time imagining 13ms being the bottleneck in your application.

  • kewakl (Customer)

    "infact there are unused subroutines I dont think these unused sub routines slow the scan rate"

    Are these 'unused' subroutines called? If so, then they will impact scan time.

     

    Do you have For Loops? Loops may not contribute heavily to step count, but can significantly contribute to scan time. See attached project (EatScans-WxpireWDT)

    Bit C1 will eat scans. If C2 is off, all is fine, except for the increase in scan time. (roughly 0 - 66 increase here)

    If you turn on C2, the watchdog will expire and the CPU will FAULT. (latest time is 201)

     

    Unrolling loops can decrease scan time at the expense of increasing code base.

    Computerphile video

    Expand Post
    • Tins (Customer)

      1. the unused subroutines are not called
      2. I dont have for loop
      3. I cant open the file you attached to me because my version is lower. but i understood the idea

      thanks

  • PouchesInc (Customer)

    Honestly, that seems like pretty good speed from a Click that is being asked to do that much. If you were to do it in a BRX though, you would probably have a scan time closer to 3-5ms.

     

    If it is your serial comms you are trying to get faster, you can't do much about those. They run asynchronously to scan time and take much longer than scan time does, as in, takes more than 1 cycle to complete. This is simply how RS serial coms are and will likely be very similar time to completion between any PLC.

     

    And a load cell itself requires a good bit of smoothing time to get a stable readout, which takes a long time and will always be far slower than your PLC scan is (usually half second minimum for stable weight reading).

     

    Since you are talking about speeding serial coms it sounds like you may really just be wanting to get your weight calculation rate faster. I would bet that if you were to take the load cell analog signal directly into a BRX PLC and a BX-04UT module and do the signal smoothing in the PLC, you would probably save a good 50-100ms time from how it is done now, with the scale doing the load cell calc and then retrieving that data via rs485.

    Expand Post
    • kewakl (Customer)

      >If it is your serial comms you are trying to get faster, you can't do much about those

      It may be possible (if it is serial) to trim a bit off. If OP can go for a faster baud, this would make the bit time shorter. Bit time is roughly 1/rate -- if we can ignore protocol trickery that introduces anything other than the time-domain.

    • Tins (Customer)

      1. Okay I may consider BRX alternative (good to know it is faster though not for the current issue)
      2. No I dont want the serial communication to be such fast. what i want from it is just display the amplifiers (4 of them) reading to display in the scada and send motors and solenoid status too. But what i afraid is if I overload(or make busy) the serial port (say because of poor coding) does that affect the plc scan rate?
      3. Yes you are right, most amplifiers sampling rate is not that much fast. But what I saw practically when testing the project is by increasing the plc scan rate (removing some feature such as alarm...etc) there is significant accuracy of weighing
      4. And for the case of analog out put of the amplifier rather than the rs485 output. yes in the fist phase of my project I used it but due to field electrical noise the reading was very unstable significant kilogram fluctuation. but i dont knwo how to filter it may be averaging? any idea here is appreciated

       

      Expand Post
  • ADC TechnologyGroup_01 (AutomationDirect)

    ​1. No, not significantly.

    2. No, they will consume program steps but not execution time if they are not called.

    3. No, not significantly.

     

    You could change from the C0-0x series to the C0-1x series which offers a speed increase of "3 to 10 times faster".

     

    Depending on how your code is arranged, the END instruction can be used conditionally to terminate the scan early. See helpfile Topic CL179.

     

    If you are using subroutines, they can also Return early conditionally. See helpfile Topic CL176.

     

    Expand Post
    Selected as Best
10 of 14