News:

  • October 09, 2026, 08:38:09 AM

Login with username, password and session length

Author Topic: UDT Logic  (Read 9015 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
UDT Logic
« on: July 12, 2020, 09:52:15 AM »
Let's say I had 10 pumps as part of  Pump UDT. One of the fields of Pump was .DischargePressure. Is there an "easy" way to compare the discharge pressure of all the pumps to a certain value and set a bit in the event that any one of the pump's discharge pressure went over a certain value? Is there a way to do this with a math function or do I have to have a logic rung to evaluate each discharge pressure or a loop to index through each of the pumps [0-9].DischargePressure. Let me know if this question isn't clear.   

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3847
    • Host Engineering
Re: UDT Logic
« Reply #1 on: July 12, 2020, 12:54:28 PM »
Call the UDT PumpStruct.  Then create a block size 10 called Pump of type PumpStruct (Pump0 thru Pump9).

FOR V42 0 to 9
MOVE D5 Pump[V42].DischargePressure
SET Pump[V42].Done
NEXT

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: UDT Logic
« Reply #2 on: July 12, 2020, 12:59:26 PM »
Is the compare value the same for all pumps or does each pump have its own critical value - possibly also stored within the UDT?
An output is a PLC's way of getting its inputs to change.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: UDT Logic
« Reply #3 on: July 12, 2020, 01:14:12 PM »
In this case the compare value would be the same for all pumps which could be stored in the UDT.
« Last Edit: July 12, 2020, 01:50:15 PM by RBPLC »

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3847
    • Host Engineering
Re: UDT Logic
« Reply #4 on: July 12, 2020, 03:18:36 PM »
Call the UDT PumpStruct.  Then create a block size 10 called Pump of type PumpStruct (Pump0 thru Pump9).

FOR V42 0 to 9
MOVE D5 Pump[V42].DischargePressure
SET Pump[V42].Done
NEXT

Sorry - misread your post.  Just use a >= instead of the MOVE in the FOR/NEXT loop

RST C99
FOR V42 0 to 9
STRGE Pump[V2].DischargePressure D5
SET C99
BREAK  // once we found one, go ahead and BREAK out of the FOR/NEXT loop
NEXT