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.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


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

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old January 30th, 2018, 11:51 AM   #1
alendi
Member
Venezuela

alendi is offline
 
alendi's Avatar
 
Join Date: Aug 2005
Location: San Casimiro, Aragua
Posts: 28
Smile RSLogix Increase Decrease multiple files values with one value

Hello everyone

I'm looking for a solution to this:

I've 10 on/off lamps control with SSR in order to regulate infrared lamps on a blow molding machine, the values use to control timers are in N files, 0 to 7, from HMI I can send values using values inputs, it works ok, I can change individually those values and heat is controlled well.

Now I'm looking for change all the 8 N files using increments or decrements from a N value, I mean, when introduce a value in this N file, as say 1 or 2, or -1 or -2, I want to convert it value in percentage, so when I key in this value and enter, all 10 lamps values will increase or decrease in the same percent/time, if lamp one has 70 in value and lamp two has 30 in value those values will increase at the same time and remains in 70+% and 30+%, understood?

Don't know if is possible make calculations on the HMI memory or in the PLC memory.

PLC is AB Micrologix 1200A and HMI is Wecon model.

Thanks for help.
  Reply With Quote
Old January 30th, 2018, 04:11 PM   #2
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,647
Before I get too carried away, let's clarify what your desired outcome is.

Let's say for simplicity that you have three lamps. They are set to 25%, 50%, and 75%.

Do you want to:
1. Increase (or decrease) all of the lamps intensity simultaneously by a certain amount, with the relative proportions between lamps remaining the same; or
2. Increase (or decrease) all of the lamps intensity simultaneously by the same percentage?

Let's say you want to increase by 5 points.

If you mean option 1, that would mean that you are trying to maintain the ratio between lamps, so lamp 2 (50%) is double the value of lamp 1 (25%), and lamp 3 (75%) is three times the value of lamp 1 (25%).
- The first lamp increases from 25% to 30%
- The second lamp is double the first, so it increases from 50% to 60%
- The third lamp is three times the first, so it increases from 75% to 90%

If you mean option 2, that would mean that you do not care about the ratio between lamps, you just want them all to go up or down the same number of % at the same time.
- The first lamp increases from 25% to 30%
- The second lamp increases from 50% to 55%
- The third lamp increases from 75% to 80%

Which of those two options are you trying to achieve? The second option is quite straightforward; the first option requires a little more thought and math. But both are possible.
  Reply With Quote
Old January 30th, 2018, 06:17 PM   #3
alendi
Member
Venezuela

alendi is offline
 
alendi's Avatar
 
Join Date: Aug 2005
Location: San Casimiro, Aragua
Posts: 28
Hi ASF

Thanks for answer to me.

You got a good idea, is the second one option that will work, I saw other machine with this function:

First Lamp = 60
Second Lamp = 45
Third Lamp = 40
Fourth Lamp = 40
Fifth Lamp = 75

So you can control of course each lamp with a input value control from HMI, but has a input control to work like you say, you input as example, 1, this value is labeled with %, ok, the result in the lamps values will change proportionally to this.

Results:

Lamp 1 = 60.6
Lamp 2 = 45.5 (45.45 rounded)
Lamp 3 = 40.4
Lamp 4 = 40.4
Lamp 5 = 75.8 (75.75 rounded)

If value is more or less is the same, also accept negative values to decrease.

Advantage is if you need raise or low temperature but keeping the temperature profile you use it, increase or decrease with one value all lamps at the same time.

Thanks for help.
  Reply With Quote
Old January 30th, 2018, 07:37 PM   #4
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,647
Okay, so you want to increase/decrease the intensity of each lamp by a percentage - in your example about you increased by 1%.

Let's say that your lamp intensity for lamps 1-5 is stored in N7:1 through N7:5. The value in N7:0 is the amount (in percent) you want to increase or decrease each lamp by. You will also need something to trigger this increase or decrease: let's say you have a HMI pushbutton which turns on the bit B3:0/0 when you want it to be applied.

The first thing is to make sure that the calculation and subsequent increase/decrease only happens once when you press the button. So you will need a oneshot or some other logic. My suggestion would be to do something like this:
Code:
|    B3:0/0            B3:0/0
|-----| |----------+---( U )--|
|                  |
|                  |   B3:0/1
|                  +---(   )--|
This means that when your HMI pushbutton turns on B3:0/0, the PLC will immediately turn that bit off, and turn on bit B3:0/1 for one scan. There are a lot of reasons that I would suggest this approach, which I can go into if you would like, but the important thing for now is that we have got a trigger for the calculation.

Next, to the calculation. If you want a 5% increase, you should multiply the existing value by 105%, or 1.05. The easiest way to achieve this is the calculation:

[Existing Lamp Intensity] * ((100+[Intensity Increase])/100)

Using the PLC registers we decided on above, that calculation is:

Lamp 1: N7:1 * ((100 + N7:0) / 100)
Lamp 2: N7:2 * ((100 + N7:0) / 100)
Lamp 3: N7:3 * ((100 + N7:0) / 100)
Lamp 4: N7:4 * ((100 + N7:0) / 100)
and so on.

As there are only 10 lamps, a "brute force" calculation is certainly viable and would be the simplest option. This means you write code to perform the calculation 10 times for the 10 different lamps.

You could if you wished look at indirect addressing, which would allow you to write a the calculation once, and a loop to make it index through all 10 lamps. If you're interested in this approach I can provide more information, but unless you have a particular reason for wanting to do it this way, I would suggest that brute force might be your best option, especially as you seem to be fairly new to PLC programming and this is not a straightforward operation.

Now, as to how to perform the calculation in the PLC: the programming software does have a CPT instruction, which allows you to write exactly the expression above directly into it. However, I'm not sure if the Micrologix 1200 supports this instruction. If not, you will have to take each step as an individual operation as follows:

For Lamp 1:
N7:0 + 100
Divide the result by 100
Multiply the result by N7:1

So, you'll have either one CPT instruction, or one ADD, one DIV, and one MUL.

Let's take the example of a 10% increase, and your figures above.
First Lamp (N7:1) = 60
Change value (N7:0) = 10
60 * ((100 + 10) / 100)
60 * (110 / 100)
60 * 1.1
= 66

Now let's look at a 10% decrease:
First Lamp (N7:1) = 60
Change value (N7:0) = -10
60 * ((100 + -10) / 100)
60 * (90 / 100)
60 * 0.9
= 54

So all that's left is to have your B3:0/1 bit trigger these calculations!

Finally: a note on data types. N registers like N7 are integers, meaning they cannot handle decimals and will simply round them. This becomes a large problem when working with percentages as your last step is to multiply the current value of a lamp by a decimal number like 1.1 or 0.9, both of which will be rounded to 1, which will cause the lamp to maintain exactly the same intensity. I would recommend using F registers (floating point) for all of your calculations and all of your lamp intensity values - floating point values support decimal places.

Last edited by ASF; January 30th, 2018 at 07:41 PM.
  Reply With Quote
Old January 30th, 2018, 08:37 PM   #5
yasirkhi
Member
Canada

yasirkhi is offline
 
Join Date: Oct 2011
Location: Toronto
Posts: 132
MicroLogix 1200 doesn't have CPT instruction for easy calculation.

But there is a very easy way to do it. And you won't have you right so many rungs with conditions.

I prefer using indirect address, and having:

INC routine / DEC routine separate
Used label and jump command with indirect addressing meaning you simply write all your math functions in one or two rungs, and jump back to rung until it exhausts all the pointer values. So you won't have to duplicate math functions.

For example if you put value in "X" and press INC button on HMI, it will call INC routine and run increase, and fill the all variables.

Also write the program and try indirect addressing, and you will love art of programming.

N7:[N9:0] (N9:0) is pointer for example
  Reply With Quote
Old February 7th, 2018, 01:15 PM   #6
alendi
Member
Venezuela

alendi is offline
 
alendi's Avatar
 
Join Date: Aug 2005
Location: San Casimiro, Aragua
Posts: 28
Thanks ASF and Yasirkhi, for take your time to read my post, very gratefull your help.

So, taking both recomendations.

I'll make a subroutine triggered or making in enabled from HMI with INC funtion and DEC function separate, I'll make calculations needed in order to send to (for example) F:10 to F:17 the values to be increased or decreased in all lamps that's is in ON state.

After that I'll take this value (in this case 10% or 1.1), read each value from N7:20 to N7:27 and multiply by value, storing results in N7:30 to N7:31, well for send this new values to temps what I'll use?

I think in:

---||----------------------|MOVE N7:30 T4:0/PRE|----
|
|----|MOVE N7:31 T4:1/PRE|----
|
|----|MOVE N7:32 T4:2/PRE|----
|
|----|MOVE N7:33 T4:3/PRE|----
and so on.

What you think?

Also make calculations to divide values with 1.1 too and make same proced.

Thanks a lot.
  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
RSView Enterprise File Viewer 1900 - Converting multiple files timeinvariant LIVE PLC Questions And Answers 0 June 27th, 2014 09:34 AM
Why rated current of an inverter decrease when working temperature increase? mir shefali LIVE PLC Questions And Answers 3 August 9th, 2008 09:54 AM
Viewing RSLogix Files ewood1972 LIVE PLC Questions And Answers 10 May 5th, 2007 12:59 PM
RSLogix 5000 V15 Features Samneggs LIVE PLC Questions And Answers 18 April 20th, 2006 05:45 PM
RSLogix: Multiple Machine Support GBrinkworth LIVE PLC Questions And Answers 17 November 15th, 2002 08:21 AM


All times are GMT -5. The time now is 10:41 AM.


.