S7-1200 Noob basics

DLMUK

Member
Join Date
Jun 2013
Location
Southampton
Posts
311
Hi

I have an S7-1215 to play with, i am looking to take a 1-10V input which is not linear and program a method of linerising this input on the S7. So on a HMI screen you would have options to enter known values.

i.e.
1V = 0Kg
4.5V = 5,100Kg
10V = 10,000kg

What I would like to know is what is the best way of doing this? Would you use some sort of scale block linked to on screen tags?

What I have done on Red Lion HMIs in the past is created a custom script to calculate gain values and use different gains based upon the live input. But not sure how to achieve the same thing with a PLC.

Thanks.
 
Last edited:
How many X-Y coordinates would you want?

I have one (in STL for a S7 300/400) with up to 10 points. It looks at the input, determines where it is on the X axis and calculates the corresponding points on the Y axis. You would add the 20 tags to your screen.
 
So you scale your analog input to 0..100%. And input it. This will be your X. You add 6 pre determined points on this X axis and know what Y you need with that. If the X input is in between two X (and so Y) points, it will calculate the linear average for the Y value and output it.

See attachment for how we use it.

TEMP_RETURN_BOILER_SP_CURVE 03.03.2015 17.44.54.jpg
 
If you know points Y1, Y2 and X1, X2. You can calculete Y at knowed point X with math:





Y2-Y1
Y = -------- *(X-X1) + Y2
X2-X1






If you have compute block at PLC, this is pretty easy to write to PLC.

On PLC you can calculate this 6 times with different points and selecting afterwards that one which have values between knowed point.

Or you can first select values for X1,2, and for Y1, Y2 depending of knowed value X, transfer Y/X values to compute block and calculate equation only one time

You maybe also want limit calculation only between min and max points, so that if something goes wrong, calculated Y value is still between "wanted values"
 
Last edited:
Into my code. It will be your X signal. Your Y signal is the scaled signal ie kg.

If this is the only values you have:
1V = 0Kg
4.5V = 5,100Kg
10V = 10,000kg

Than my method would be overkill. I would do as Lare suggests.

Say X is voltage:
(((X-1V)5.1kg)/3.5) + (if X>4.5(((X-4.5)4.9kg)/5.5)
 
Into my code. It will be your X signal. Your Y signal is the scaled signal ie kg.

If this is the only values you have:
1V = 0Kg
4.5V = 5,100Kg
10V = 10,000kg

Than my method would be overkill. I would do as Lare suggests.

Say X is voltage:
(((X-1V)5.1kg)/3.5) + (if X>4.5(((X-4.5)4.9kg)/5.5)

I will have more than that. That was an example, I will have 6 points in total.
 
I can send you the code I have in STL, you will have to convert it to SCL to be able to use it in the 1200 PLC.

I will take a look at it to.

Please send me your email in a PM if you would like to have what I have.
 
Sorry not at the office so don't got my program library for sharing,

This function is done in TIA V11'
https://support.industry.siemens.com/cs/document/39334504?lc=en-WW

mRaw:Max in raw data. (10kg)
miRaw:Min in raw data. (0kg)

mEU:Max engineering units. (10V, invert the function)
miEU:Min engineering units. (1v, inver the function)

enEU:Enterd engineer units.
_______________________________________

(((mRaw-miRaw)/(mEU-miEU)) x enEU) + (miRAW-(miEUx((mRaw-miRaw)/(mEU-miEU))

__________________________________________

For SCL~

I'm sorry if the post is somewhat diffused .. it's been a long day
 
Last edited:

Similar Topics

Hi, I have got an S7-1212 to play with. I have used TIA Portal on a few occasions but only with devices which have already been configured. I...
Replies
9
Views
3,811
Hello, I have a question about an encoder that has absolute measurement. Specifically, it's the Lika SMA5, which I would like to connect...
Replies
2
Views
73
Hello, I have a question about an encoder that has absolute measurement. Specifically, it's the Lika SMA5, which I would like to connect...
Replies
0
Views
46
Hi all, Currently having trouble getting a speed reference to write over modbus to an Omron M1... I can successfully write a run command and...
Replies
6
Views
294
HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
119
Back
Top Bottom