Scale a value 4-20mA on a 0-20mA input (Siemens)

I spent way too long trying to figure out the meaning of 27648. There are many other mentions of it as a PLC range. I couldn't arrive at any obvious reasons to use the value. I've seen mention of (-27648, 27648), so maybe the other 10,240 values (starting from 2^16, a 2 byte word, which does make sense) are reserved for something? I have no idea. Maybe we'll get an old timer to step in and shed some light on the issue...


rsdoran said:
What I never understood was 27648, where does that number come from?

16384 is easy, 2 to the power of 14, standard resolution for many analog devices.

Regardles of how you look at if 16384 is the input values then its divided by 20 then times 4 to get the value = to 4ma.

Another way to do that since many KNOW off the top of their head 20/5 = 4 is divide 16384 by 5, same result.

WAIT, I think the 27648 was a misprint (error), 2^15 is 32768, close enough for me.
 
Thanks for shedding light on the situation. My guess wasn't too far off. They just chose a range for -100% to 100% using 16 bits and gave themselves padding to go over or under. In light of the last post, the S7-300 analog module uses a "twos compliment" scheme to represent the range from -117.596% to 118.515%. You can effectively choose any scaling to display. I don't see any magic, rhyme or reason in how they do it. Not to say that it wasn't well considered - those type of design meetings usually involve hours of debate over how to use a bit or two.
 
COnfusion

Okay, so it's like this then:


m = dy/dx = (0-(-1))/(16384-3276,8)

m = 1/13107,2

But, about c:

y = mx + c, so c = y - mx

we don't know y, we only know mx

so we make y = 0

then c = 0 - 1/13107,2 x 16384 (x value if y = 0) = -1,25

back to y = mx + c

y = 1/13107,2 x X - 1,25

Y = X/13107,2 - 1,25


I guess that I understood it right now
 
I know this is a slight diversion, but I couldn't resist posting this old chestnut showing that 2=1 :)

twoequalsone.JPG
 
I think you got it...

Combo,
You're correct up though c = y - mx.
At that point we know m and are solving for c. We can plug in either set of known (x,y) values to determine this. You're right, we used (16384, 0). We could have also used (3276.8, -1) to arrive at the same value.

L D[AR2,P#0.0] brings up a very interesting invalid proof. I remember my high school calculus teaching showing us that one to stress the importance of formal rigor. I couldn't spot what was wrong with it without asking Google (wikipedia). Turns out you can't divide by (x-y) - remember by the first statement x=y -> x-y = 0.




Combo said:
Okay, so it's like this then:


m = dy/dx = (0-(-1))/(16384-3276,8)

m = 1/13107,2

But, about c:

y = mx + c, so c = y - mx

we don't know y, we only know mx

so we make y = 0

then c = 0 - 1/13107,2 x 16384 (x value if y = 0) = -1,25

back to y = mx + c

y = 1/13107,2 x X - 1,25

Y = X/13107,2 - 1,25


I guess that I understood it right now
 
Yeah, yeah, yeah, and 2 = 3 as well ...:)

Start with ...

(4 - 10) = (9 - 15)

... then add 25/4 to both sides ...

(4 - 10 + 25/4) = (9 - 15 + 25/4)

... then factorise as ...

(2 - 5/2)(2 - 5/2) = (3 - 5/2)(3 - 5/2)

since they're both equal, take the square roots of both sides ...

(2 - 5/2) = (3 - 5/2)

... and inevitably, add 5/2 to both sides, giving -

2 = 3

Ken

PS : Can any real PLC genius provide the code to prove that that 'on' = 'off'? That would be so useful whenever you need to fix things.
 
Man, I'm such a buzzkill.

Again, wikipedia saves the day. The square root of x2 is not in general equal to x, but to the absolute value of x. Especially true when your x happens to be negative

so abs((2 - 5/2)) = abs(3 - 5/2)
and adding 5/2 to both sides is still valid.

You could probably apply their 0=1 or -1 = 1 proofs to show that on=off.

Ken M said:
Yeah, yeah, yeah, and 2 = 3 as well ...:)

... then factorise as ...

(2 - 5/2)(2 - 5/2) = (3 - 5/2)(3 - 5/2)

since they're both equal, take the square roots of both sides ...

(2 - 5/2) = (3 - 5/2)

... and inevitably, add 5/2 to both sides, giving -

2 = 3

Ken

PS : Can any real PLC genius provide the code to prove that that 'on' = 'off'? That would be so useful whenever you need to fix things.
 
surferb said:
Man, I'm such a buzzkill.

Again, wikipedia saves the day. The square root of x2 is not in general equal to x, but to the absolute value of x. Especially true when your x happens to be negative

so abs((2 - 5/2)) = abs(3 - 5/2)
and adding 5/2 to both sides is still valid.

You could probably apply their 0=1 or -1 = 1 proofs to show that on=off.


All of the "proofs" using algerbra to show false = true type things use invalid math. The 2 = 1 proof uses division by zero, which as far as I know, yeilds unreliable results in PLCs (faulting some). You can never use math to show on=off in a PLC cause it's smart enough to find those invalidities.
 
ABTech said:
I am also having a problem with working out analogue to digital scaling but after reading this page it has helped a lot.

With reference to surferb's question. 20mA = 16384 is always going to be true as that is what the drive will say it can see when presented with 20mA. Since 0 - 20mA has to be a linear scale 16384/5 has to be what the drive will see when you give it 4mA as it has to be linear.

On another note. Does anyone have some code written for Siemens S7-200 that I could use for doing analogue scalling. I have tried doing it my self but I am not getting the right answers.

It would be great if you could post it to the forum so that I could have a read through.

JonnyDY2J

Have u solved the problem with scaling s7-200 and how did u do it then?
I have also bean looking for that in a while now, and got this from siemens support. havent tried it yet...

http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27043396&caller=view
 

Similar Topics

Hi! I'm trying to obtain a scaled value for a distance of 1090 units (10nths of 1")read by a distance laser in the range of 4-20ma. I want to use...
Replies
10
Views
2,869
I have an extremely dumb math question. An analogue input gives me 0 to 27648 when operating in 0 to 20mA In the program I want to scale into...
Replies
11
Views
4,395
the scale occasionally stops working and displays the message "no response from modbus" on the control screen . tunaylar - load line2
Replies
2
Views
144
Hi! I'm wondering if PLCs are used for small-scale production. I've got four machines doing different things with textiles, and I'm exploring the...
Replies
16
Views
1,356
I am having an issue writing a carriage return to my scale, I can manually push the print button the the scale and then read the buffer. The scale...
Replies
4
Views
1,127
Back
Top Bottom