How to Allow user to select 2 outputs from HMI but not more!

Btw, if 0-2 pumps are allowed to run and pump 1-4 set bits 0-3 of an INT, then invalid values are either 7 or 11 or >12, so only three tests are required.


also, another approach would be to make the pump 1 start button invisible when

  • Pump 1 is on
  • OR
  • That 4-bit INT is 6 or 10 or 12
So that is only four tests per pump, still brute force but less brutish. Similar logic works for pump 2 (5 or 9 or 12), pump 3 (3 or 9 or 10), and pump 4 (3 or 5 or 6).


N.B. this assumes a jumpered-on pump does not set a bit in that 4-bit INT.
 
Last edited:
I know you are using CCW, but the principles are the same. KISS. Main(OB1) not shown, but it only calls the pumps' handler FB.


HMI


  • Normal operation
    • press up to two [Preset Pump N] buttons to determine which pumps will be on
      • Each [Preset Pump N] button sets one bit in INT PLC INT hmi_pattern.
    • Then press [Send Presets]
      • This will assign a 1 to accept_pattern
      • PLC logic will use hmi_pattern bits determine which pumps to turn off or one, IFF pattern is valid
      • PLC logic will also clear hmi_pattern and accept pattern to 0 to prepare for next set and send.
    • All buttons are "set and forget:"
      • HMI assigns ones (sets)
      • PLC assigns zeros (resets)
  • Abnormal operation (shown)
    • Too many pumps are preset
    • Red error message shown
      • Visible when PLC boolean [pattern_valid] is 0
    • Send button is red
      • for the same reason,
      • but it still assigns 1 to accept_pattern,
        • which PLC ignores


Static array with validity of sixteen possible hmi_pattern values
e.g.

  • pattern_validities[5] is true, because 5 is 2#0101 => two 1-bits
  • pattern_validities[11] is false, because 11 is 2#1011 => three 1-bits
  • Changing this to an (Array[0..15] of INT) would enable providing the number of 1-bits, in case the allowable number of pumps changes
    • [0] => 0
    • [1], [2], [4], [8] => 1
    • [7], [11], [13], [14] => 3
    • [15] => 4
    • All others => 2



Handler for all four pumps


  • Determine HMI pattern validity from pattern_validities array
  • Handle pump start/stop using pump function
  • Delay assigning 0 to accept_pattern bit



Pump Function


  • Seal-in circuit; adding a system Stop bit (not used here) to the main rung on the right would make this a Start/Stop circuit.


I cannot thank you enough for helping me out.

However, I couldn't find the blocks used in network 2.

What is the function block used as it seems that it is not supported in CCW :cry:
 
Generalised case in ST:

Thanks a lot(y).

I tried using the same text you are using. But I couldn't set the data type to an array as it is not available in CCW. It seems that your are using Siemens PLC which is more capable than what I am using :unsure:.
 
I cannot thank you enough for helping me out.

However, I couldn't find the blocks used in network 2.

What is the function block used as it seems that it is not supported in CCW :cry:






Ah, the user-defined, one-rung program under [Pump function] is what is used for those blocks.


In CCW I suspect you will have to replace Rung 2* with four duplicates of that [Pump function] rung, and change the hmi_bit and pump_on tags to the specific tags for each pump.


Whether you use the ST or LAD code (and I suggest doing both), please take the time to think them though in your mind, and then test your understanding how they work.


* "Network" is a silly moniker for the rung of a LADDER!
 
Thanks a lot(y).

I tried using the same text you are using. But I couldn't set the data type to an array as it is not available in CCW. It seems that your are using Siemens PLC which is more capable than what I am using :unsure:.




I suspect one issue is the non-literal number of pumps; try using 4 instead of #gc_NumberOfPumps throughout the program and variable declarations.


Another issue might the "of Struct." Instead of Pump.Q, Pump.StartPB, etc., try creating parallel arrays e.g. Boolean Pump_Q, Pump_StartPB, etc.
 

Similar Topics

Good Afternoon , We all must of done this before ...... Installing a Frequency Drive in an enclosure , you forget how deep your selector...
Replies
1
Views
138
For the project I'm doing, the operator has to enter a string of 7 alphanumeric characters. This represents the unique part number. For now, the...
Replies
19
Views
2,361
Hi. This is as nerdy as it can get for Siemens experts for whom I can be grateful for advice. Our Profibus testing systems consist of an S7-313C-2...
Replies
8
Views
1,967
I have been having an issue with assigning the management VLAN other than the default 1 to my stratix 5700 switch. I go through the express set up...
Replies
1
Views
1,651
Hi: I have been using this module for years for my testing. Now it does not work and have no idea how to fix this. Will be very grateful for your...
Replies
9
Views
10,629
Back
Top Bottom