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

ahaanwar2

Member
Join Date
Jan 2020
Location
Sanaa
Posts
19
Hi guys,

I am using CCW with AB Micro-Controller. The user can select 2 pumps out of 4 to be running. However, the user shall not be able to select more than 2 pumps and an error message should appear if the user tries to select the 3rd pump telling him "Not more than 2 pumps to run, deselect one of the pumps if you require to select another pump".

Please help me to do this as I don't know how to restrict the selection in the HMI, or shall it be done via PLC program?

Best Regards
 
Last edited:
Create six buttons:

  1. Label "1 & 2" sends an integer value 3 (2#0011) to the PLC
  2. Label "1 & 3" sends an integer value 5 (2#0101) to the PLC
  3. Label "1 & 4" sends an integer value 9 (2#1001) to the PLC
  4. Label "2 & 3" sends an integer value 6 (2#0110) to the PLC
  5. Label "2 & 4" sends an integer value 10 (2#1010) to the PLC
  6. Label "3 & 4" sends an integer value 12 (2#1100) to the PLC
No need for the error message.


Is this homework or workwork?
 
Is this homework?
One way to accomplish this is to assign a value to each selection, say 1, then add the selections, if total =2, then allow no more.

Dear Ken,

Thanks for your response.

This is not a homework. I am trying to teach my self on programming PLC and I am trying to replicate a project I have seen but I don't have the PLC program .

So, what you are saying is doing the program in the logic. Isn't there any easier way or a function in the HMI creation tool?
 
Create six buttons:

  1. Label "1 & 2" sends an integer value 3 (2#0011) to the PLC
  2. Label "1 & 3" sends an integer value 5 (2#0101) to the PLC
  3. Label "1 & 4" sends an integer value 9 (2#1001) to the PLC
  4. Label "2 & 3" sends an integer value 6 (2#0110) to the PLC
  5. Label "2 & 4" sends an integer value 10 (2#1010) to the PLC
  6. Label "3 & 4" sends an integer value 12 (2#1100) to the PLC
No need for the error message.


Is this homework or workwork?

Dear Drbitboy,

Thanks for your answer.

Actually, I thought of your way of doing it. However, what if the user want to run only 1 pump? I don't want to fill up the screen with a list of Selection buttons.
 
My personal preference is to do all the work in the PLC. Have the HMI trigger momentary pushbuttons and show On/Off values for bits.

Have the PLC monitor each PB and if 2 pumps are already on it will not turn on a third pump, and have it turn on a timer for 20 seconds that when timing sets a visibility bit that the HMI uses for the warning popup.

The most elegant quote to apply is from someone on this forum (I'm thinking GeniusInTraining): A HMI should be a window into the PLC

I have a customer that has a hoist controlled line of plating tanks they wwant changes made in the PLC, the the CLX PLC is basically a dumb terminal that only does what the HMI tells it to do. All the recipes, timing, setpoints, hoist moves, etc are controlled by a proprietary, self made HMI the OEM won't think of making any changes to, that if the PLC ran things I could make in a couple hours.
 
Create a word, each select button will add 1 to this word. If the value is greater than or equal to two you can't select any more. You can clear the word in the beginning of the scan.
 
Dear Drbitboy,

Thanks for your answer.

Actually, I thought of your way of doing it. However, what if the user want to run only 1 pump? I don't want to fill up the screen with a list of Selection buttons.


Ten buttons on a 4x4 grid 62%+ filled:


Code:
[1 alone]
[1  &  2]  [2 alone]
[1  &  3]  [2  &  3]  [3 alone]
[1  &  4]  [2  &  4]  [3  &  4]  [4 alone]
If that seems like a lot, then I would probably put the logic in the PLC as @KenM and I_Automation suggests. Is there any logic capability in the HMI? Do you have a manual? What language is being used?


Perhaps the HMI provides a drop-down list selection widget; that would not clutter the screen.


In the PLC, @KenM and others already provided one solution: count the bits; four rungs of essentially identical code plus one compare.

Another solution: if each pump button represents one bit in an integer, there are only five invalid values to check (three with three bits as 1s and one with four bits as 1s); it's clumsy but easy to code and understand; also it is codable as five NEQs ANDed on a single rung, instead of five EQUs ORed on five branches. Also, there could be a boolean array INVALID_COMBINATIONS with 16 values: 0s for the valid combinations; 1s for the invalid combinations; the HMI assigns 1s or 0s to the bits of an index, the PLC uses one instruction [XIC INVALID_COMBINATIONS[index]]* to determine whether 3 or more bits are 1 in the index, and the error message on the HMI is driven by the result.


If you are teaching yourself PLCs, you would ideally try all of the above, and test each.


* this is RSLogix5C/Logix5k lingo, may not be work in CCW, but the idea is the same.
 
Last edited:
My personal preference is to do all the work in the PLC. Have the HMI trigger momentary pushbuttons and show On/Off values for bits.

Have the PLC monitor each PB and if 2 pumps are already on it will not turn on a third pump, and have it turn on a timer for 20 seconds that when timing sets a visibility bit that the HMI uses for the warning popup.

The most elegant quote to apply is from someone on this forum (I'm thinking GeniusInTraining): A HMI should be a window into the PLC

I have a customer that has a hoist controlled line of plating tanks they wwant changes made in the PLC, the the CLX PLC is basically a dumb terminal that only does what the HMI tells it to do. All the recipes, timing, setpoints, hoist moves, etc are controlled by a proprietary, self made HMI the OEM won't think of making any changes to, that if the PLC ran things I could make in a couple hours.

Thanks a lot for your feedback. I will follow your methodology as it seems the best option.

Regards
 
Create a word, each select button will add 1 to this word. If the value is greater than or equal to two you can't select any more. You can clear the word in the beginning of the scan.

Thanks, I will try to do that. I will post a snap of the logic if I am unable to figure it out.

Regards
 
From what you're saying, your logic has to keep track of a selected pump as the reason for this to exist is to allow group control of the pumps (start, stop, etc...).

So why not add up all the pumps that are selected and then not allow any selection command to latch if the value is higher than 1?

To make the HMI development easier, you can create a bit in your software that indicates that the maximum number of pumps has been selected and then use that bit to disable the HMI button that allows them to be enabled. It's also the faster way to, in the future, allow 1, 3 or 4 pumps to be enabled without changing your program other than that one compare instruction.
 
Brute force method

Pump1 Pump2 Pump3 Pump4 2Pumps

--] [----] [----]/[----]/[--+----( )-
|
Pump1 Pump2 Pump3 Pump4 |
|
--] [----]/[----] [----]/[--+
|
Pump1 Pump2 Pump3 Pump4 |
|
--] [----]/[----]/[----] [--+
|
Pump1 Pump2 Pump3 Pump4 +
|
--]/[----] [----] [----]/[--+
|
Pump1 Pump2 Pump3 Pump4 |
|
--]/[----] [----]/[----] [--+
|
Pump1 Pump2 Pump3 Pump4 |
|
--]/[----]/[----] [----] [--+



HMI_Pump1 Pump1 2Pumps Alert

---] [------]/[-----] [---+---( )-
|
HMI_Pump2 Pump2 2Pumps |
|
---] [------]/[-----] [---+
|
HMI_Pump3 Pump3 2Pumps |
|
---] [------]/[-----] [---+
|
HMI_Pump4 Pump4 2Pumps |
|
---] [------]/[-----] [---+


 
Dear Ken,

Thanks for your response.

This is not a homework. I am trying to teach my self on programming PLC and I am trying to replicate a project I have seen but I don't have the PLC program .

So, what you are saying is doing the program in the logic. Isn't there any easier way or a function in the HMI creation tool?


In general it is better to put your limits in the PLC. Be that number of pumps running, speeds, dosing levels, etc. You can replicate them in the HMI but only for messaging purposes so you can flag your operator when they try to enter it outside the limit they are allowed to access. This will also allow graduated ranges. Operators have the narrowest to do their job within established parameters. Supervisors have a wider range to adjust for unexpected issues. Maint can have full band within the safety limits purely for testing needs.
 
Brute force method

Pump1 Pump2 Pump3 Pump4 2Pumps

--] [----] [----]/[----]/[--+----( )-



I would delete all the XIO's

First if somehow the operator found a way to turn on 3 or 4 pumps the OTE would be off, don't underestimate the level of idiots that HR can hire to run your machine.

Second, half the bits to check.
 
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
pump_hmi.png


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
patterns.png



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
pumps.png



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.
one_pump.png
 
Last edited:

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
103
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,242
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,931
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,633
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,160
Back
Top Bottom