You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old February 23rd, 2021, 06:03 AM   #1
ahaanwar2
Member
Yemen

ahaanwar2 is offline
 
Join Date: Jan 2020
Location: Sanaa
Posts: 12
Exclamation How to Allow user to select 2 outputs from HMI but not more!

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 by ahaanwar2; February 23rd, 2021 at 06:04 AM. Reason: Typo
  Reply With Quote
Old February 23rd, 2021, 06:06 AM   #2
Ken Moore
Lifetime Supporting Member
United States

Ken Moore is offline
 
Ken Moore's Avatar
 
Join Date: May 2004
Location: North, West, South Carolina
Posts: 2,994
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.
__________________
Certified Siemens Functional Safety Professional,
ID: SFSP17010238
https://azr.com/
  Reply With Quote
Old February 23rd, 2021, 06:18 AM   #3
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,317
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?
  Reply With Quote
Old February 23rd, 2021, 06:39 AM   #4
ahaanwar2
Member
Yemen

ahaanwar2 is offline
 
Join Date: Jan 2020
Location: Sanaa
Posts: 12
Quote:
Originally Posted by Ken Moore View Post
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?
  Reply With Quote
Old February 23rd, 2021, 06:42 AM   #5
ahaanwar2
Member
Yemen

ahaanwar2 is offline
 
Join Date: Jan 2020
Location: Sanaa
Posts: 12
Quote:
Originally Posted by drbitboy View Post
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.
  Reply With Quote
Old February 23rd, 2021, 06:48 AM   #6
I_Automation
Member
United States

I_Automation is offline
 
I_Automation's Avatar
 
Join Date: Jun 2020
Location: Detroit, Michigan USA
Posts: 461
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.
  Reply With Quote
Old February 23rd, 2021, 06:52 AM   #7
Phrog30
Member
United States

Phrog30 is offline
 
Join Date: Dec 2006
Location: Montgomery, Alabama
Posts: 769
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.
  Reply With Quote
Old February 23rd, 2021, 07:07 AM   #8
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,317
Quote:
Originally Posted by ahaanwar2 View Post
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 by drbitboy; February 23rd, 2021 at 07:11 AM.
  Reply With Quote
Old February 23rd, 2021, 07:12 AM   #9
ahaanwar2
Member
Yemen

ahaanwar2 is offline
 
Join Date: Jan 2020
Location: Sanaa
Posts: 12
Quote:
Originally Posted by I_Automation View Post
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
  Reply With Quote
Old February 23rd, 2021, 07:13 AM   #10
ahaanwar2
Member
Yemen

ahaanwar2 is offline
 
Join Date: Jan 2020
Location: Sanaa
Posts: 12
Quote:
Originally Posted by Phrog30 View Post
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
  Reply With Quote
Old February 23rd, 2021, 07:37 AM   #11
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 1,773
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.
  Reply With Quote
Old February 23rd, 2021, 09:19 AM   #12
Steve Bailey
Lifetime Supporting Member + Moderator
United States

Steve Bailey is online now
 
Steve Bailey's Avatar
 
Join Date: Apr 2002
Location: The boondocks of Western Massachusetts USA
Posts: 7,424
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 |
|
---] [------]/[-----] [---+


  Reply With Quote
Old February 23rd, 2021, 09:31 AM   #13
Nova5
Member
United States

Nova5 is offline
 
Join Date: May 2013
Location: Northern Snowball
Posts: 246
Quote:
Originally Posted by ahaanwar2 View Post
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.
  Reply With Quote
Old February 23rd, 2021, 09:34 AM   #14
I_Automation
Member
United States

I_Automation is offline
 
I_Automation's Avatar
 
Join Date: Jun 2020
Location: Detroit, Michigan USA
Posts: 461
Quote:
Originally Posted by Steve Bailey View Post
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.
  Reply With Quote
Old February 23rd, 2021, 01:35 PM   #15
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,317
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 by drbitboy; February 23rd, 2021 at 01:56 PM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Hide a user in tp 700 hmi tia v 14 ron7 LIVE PLC Questions And Answers 3 December 19th, 2018 03:38 AM
HMI user authentication with LDAP via laptop Evirua LIVE PLC Questions And Answers 2 September 21st, 2018 11:18 AM
Automation direct HMI EA7-T12C shows No user program. hinddhindsa LIVE PLC Questions And Answers 2 February 3rd, 2016 11:45 PM
User rights HMI PV800 Allen-Bradley akathomas LIVE PLC Questions And Answers 10 November 6th, 2015 04:32 AM
Troubleshooting Siemens HMI w/Step 7, & WinCC/Redlion HMI question AutomationTechBrian LIVE PLC Questions And Answers 5 June 22nd, 2014 01:06 PM


All times are GMT -5. The time now is 05:03 PM.


.