RSLogix Increase Decrease multiple files values with one value

alendi

Member
Join Date
Aug 2005
Location
San Casimiro, Aragua
Posts
36
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.
 
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.
 
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.
 
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:
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
 
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.
 

Similar Topics

Hello all, I have a question in regards to RSlogix 5000. I am having issues with the program force closing when I try to make online edits. We...
Replies
0
Views
95
I am having trouble with getting no control of my analog output signal. I am using the SCL function block to control my analog output. The logic...
Replies
11
Views
210
Hello, Haven't been on in a while. I need to generate a bit level pdf of the I/O for RSLogix 500. I can generate a report but it just shows the...
Replies
1
Views
113
Greetings ... someone sent me a request for some student handsouts that I developed ... turns out that I had this hosted on my business website...
Replies
0
Views
109
Thank you for any and all responses/help. I have an RSLogix 5000 v20 and a Cognex In-Sight v5.9 spreadsheet (8502P). I can not figure out how to...
Replies
0
Views
101
Back
Top Bottom