actual value

moody088

Member
Join Date
Nov 2008
Location
checago
Posts
38
hi,, how r u
can anyone explain this network to me
the network enter analog value and then convert this value to the actual value
but i want to know the numbers used like 5900 and all number
plz.........
 
Start from the left:

The first SUB_I (integer subtraction) subtracts 5900 from 27648. These are hard coded values. The result is stored in #TEMP6.

The next DIV_I (integer division) block takes the value in #TEMP6 and divides by 40. Note that the result is truncated to a whole number (integer). The result is stored in #TEMP7.

Next is another SUB_I block, subtracts 5900 from PIW754 (I'm assuming this is an analog input?). Result is stored in #TEMP8.

Next is another DIV_I. #TEMP8 is divided by #TEMP7 and stored in #TEMP9. Note truncation.

The I_DI block converts #TEMP9 from an Int to a DoubleInt and stores in #TEMP10.

The DI_R converts the value in #TEMP10 to a Real number, and stores it in MD110.

Not familiar enough with your system to know where the hardcoded 5900 or 27648 come from, but I would think they are analog counts?

The description of all of these block instructions can be found in the program's help file, give that a look through.
 
This is a pretty typical scaling equation. It is basically:

Input / Max Span * Max Engineering Units

It would be much easier to understand if they had used REALs all the way through so they could keep the form a little more standard.

Siemens analog input modules justify the input word to the upper bits of the integer. So the typical 12-bit input uses bits 4-15 of the word. I am assuming this is a 4-20mA input or an input with some amount of known offset (1-5VDC, for example). 5900 is the number of bit equivalent to the offset. 27648 is the number of bits equivalent to a maximuim rated input.

The divide by 400 in this case is effectively that same as multiplying by 400 at the end. But they need to do the divide where they do becasue they can't have the result of the second divide (TEMP8/TEMP7) be less than 1 since they are using integer math.

So the moral of the story is the equation will give you 0-400 out given a 4-20mA analog input.

Keith
 
Thanks for the explanation Keith. I was curious where those values came from, haven't worked much with Siemens equipment.
 
Good point. Though I do remember when I was doing some programming in Proficy ME, on a GE PAC, one of the AO cards only liked to receive Reals, and you had to convert regardless.
 
A couple of points:

27648 equates to 0-10v or 0-20mA for Siemens analogue inputs.

4mA would thus be 27648 * 4/20 = 5529.6 (cf 5900 in the code)

Using the code shown, when PIW754 = 27648 the result is 402.0 due to the integer arithmetic. If you use floating point arithmetic, the result is 400.0
 
I'm not clear what you are asking. The code you posted scales an analogue input using the following relationship:

Scaled O/P = (PIW754 - 5900)/54

If you want to change the scaling, a code change is required.
 
Pardon me for saying, but who ever programmed that needs a smack on the head.

The first SUB_I and DIV_I and #temp6, #temp7 are useless, they can be deleted and #temp7 can be replaced by 54.

However, it looks like you are using a 4-20mA signal while the AI-card is configured for 0-20mA.

Bad practice all around, and as you can see, makes it more difficult then it needs to be.

The good way to do it:

Configure the AI-card for 4-20mA, then use FC105 from the standard library to scale your value.


As for your last question, why 400? Well the analog value get scaled 0-400, if you want to scale it 0-500, just replace the 400 in the first DIV_I with 500.
 

Similar Topics

I am current connecting a Schneider pm5100 Digital Power Meter to a PLC using modbus connection, my prime objective is to get the actual Value of...
Replies
6
Views
1,567
Hello I want to to make the DB's current values DB's initial values. How can I do this? Thank you.
Replies
4
Views
6,227
Hi There, I have a 1746-NI16I analogue card. (In the field device I have 5mA and in the channel scaling ladder it measures zero value. Just...
Replies
5
Views
2,922
Hi all, I've got a project running on a S7-318-2 with several DB's, where in some shared DB's I've added some new data types and changed the...
Replies
1
Views
3,745
Why is the configuration IP different from the actual IP address still able to run normally?
Replies
6
Views
821
Back
Top Bottom