Moving avg values from cyclical pumps

... But due to the way the copy instruction works it's necessary to copy to a buffer, then back.

Depends on the COPy implementation, but by copying "down*", a buffer is usually not required.

* e.g. in Logix mnemonics: [COP array[1] array[0] 7]
_
 
Last edited:
Another question: What's the simplest totalizer I can build with ladder logic?

I think I have already provided that, but if you don't have AVE or MAVE:

  • Tags
    • REAL flow: continuously updated flow measurement
    • REAL peak: current cycle's peak flow.
    • REAL tot: running total
    • REAL arr[8]: 8 element array, arr[0] to arr[7]
    • BOOL pump_is_on: pump is running on this scan
    • BOOL pump_was_on: pump was running on previous scan
  • Code
    • XIC first_pass ### Initialization
      • CLR peak
      • CLR tot
      • FLL arr[0] 8 ### or ... 9; see below
      • OTU pump_was_on ### or OTL, so this instruction is probably superfluous
    • XIO pump_is_on XIC pump_was_on GRT peak 0 ### Falling edge of pump running if peak is positive
      • SUB tot arr[0] tot
      • ADD tot peak tot
      • COP arr[1] arr[0] 7 ### or ... 8; see below
      • MOV peak arr[7]
    • XIC pump_is_on ### Pump is running
      • XIO pump_was_on ### Rising edge of pump running
        • CLR peak
      • GRT flow peak MOV flow peak
      • OTE pump_was_on
If arr is REAL array with 9 elements, peak is arr[8], the Length of 8 in the FLL is replaced by 8, and the Length of 7 in the COP is replaced by 8, then the red instructions are not needed.

Caveats


  • The totalizer will represent fewer than eight peaks for the first 7 cycles, so the tot by 8 will be give a misleading value for the first hour.
  • With fractional REAL values, there will be some rounding error in the totalizer.
_
 
Last edited:

Similar Topics

Ok, I'm no expert so bear with me. I'm using a dual head Keyence laser setup to measure board thickness. The board dimensions are 4'x8'...
Replies
5
Views
2,599
I'm a Siemens person, and this is one of my first AB programs. The customer wants everything programmed in Ladder. I have a lot of data (3...
Replies
14
Views
221
Hello, I have a compact Logix plc and I have been task with configuring alarms into our SCADA when an Analog signal stops moving. The analog...
Replies
6
Views
244
Hello, i am a beginner with a Siemens Logo 8 PLC. I would determine the direction of an object if it passes a whole cycle of 2 input sensors. See...
Replies
2
Views
188
Can an AOP be removed from Logix? I seem to have some version weirdness from an E&H AOP and I need to see if reinstalling the AOP will correct it.
Replies
5
Views
974
Back
Top Bottom