Basic Linear Scaling (Siemens)

Join Date
Jan 2015
Location
Houston, Texas
Posts
31
Time for yet another noob query.

Let's say I have a value in my PLC with a range of 0-32764.

I want to display that value range in my HMI as going from -50 to +50.

Thus far nothing I do works. I see the 0-50 in the positive range, but the values that should cause the needle to move counterclockwise into the negative range of the graphic just pin the needle.

Surely I'm doing something really boneheaded here, but I've run out of parameters to experiment with.
 
I am not a Siemens user but the basic formula for scaling is...

(((Scaled Max-Scaled Min)/(Max Raw Input-Min Raw Input))*(Raw Input-Min Raw Input))+Scaled Min = Scaled Value

Here is a handy tool...Author: John Soltesz (forum member)
 
Last edited:
I am not a Siemens user but the basic formula for scaling is...

(((Scaled Max-Scaled Min)/(Max Raw Input-Min Raw Input))*(Raw Input-Min Raw Input))+Scaled Min = Scaled Value

Here is a handy tool...Author: John Soltesz (forum member)

Thanks for that scaling tool, Mickey! I'm sure it will come in handy time and time again.

I am using the linear scaling function in the HMI tag itself. The parameters I have entered are as follows:

PLC: End Value=32764 Start Value=0

HMI: End Value=50 Start Value=-50

TIA Portal does not like me putting a negative value into the HMI Start Value field and lets me know by highlighting that value in red.

This seems inconsistent to me because I am allowed to assign the following value to my gauge graphic in the HMI:

Maximum scale value: 50
Minimum scale value: -50

I have assigned nothing to the "Tag for maximum" and "Tag for minimum" fields as it doesn't seem to be necessary for my needs.

Does anybody see the flaw in my approach?
 
What type of tag is it?

If you have selected the tag as a Word or an unsigned integer (Uint), then the value goes from 0-65535. Thus a negative number is illegal. I know you're trying to scale, but Portal still keeps the same data type that the tag originally had.

You need to use an INT, which has a range from -32,768 to 32,767. An INT and a Word take up the same amount of space in your PLC program, and you may not even need to change anything in the PLC to make the change in the HMI. It depends what you are doing, and how it is configured.

Portal will also not let you scale an integer as a REAL or FLOAT type either. You can't scale 0-32000 to 1.25-1.5 either.
 
What type of tag is it?

If you have selected the tag as a Word or an unsigned integer (Uint), then the value goes from 0-65535. Thus a negative number is illegal. I know you're trying to scale, but Portal still keeps the same data type that the tag originally had.

You need to use an INT, which has a range from -32,768 to 32,767. An INT and a Word take up the same amount of space in your PLC program, and you may not even need to change anything in the PLC to make the change in the HMI. It depends what you are doing, and how it is configured.

Portal will also not let you scale an integer as a REAL or FLOAT type either. You can't scale 0-32000 to 1.25-1.5 either.

You're a genius! I had the tag set as a Word. Once I set it to an integer, everything started working. Many thanks!
 

Similar Topics

Hi all, I have a noob question regarding data handling from sensors. I understand configurations and I/O mapping sensor input/output variables...
Replies
2
Views
195
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
0
Views
391
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
10
Views
1,907
I’m a bit stuck on HMI (KTP-1200) programming… See the picture attached. The PASS or FAIL box should only appear when the toggle switch is...
Replies
7
Views
1,005
Hey Programmers, Heres todays puzzle I was trying to solve... I have a Modbus TCP network with two Modicon M221 controllers live on my work bench...
Replies
0
Views
449
Back
Top Bottom