PDA

View Full Version : PLEASE help with Analogue converting maths on S7-200 and scaling


STJ
September 20th, 2008, 07:46 PM
HI all - am hoping someone could help me a little... I am something of a novice and need to sort out my analogue Outs and Ins for a small project...
I am using S7-224 with 4 Analogue INs, 2 Analogue outs.
I am aware of analoue channels being a single word (AQW0 etc)...

The problem I have here is more to do with the maths !! :-(

Would I be correct to assume that 4mA = 650 and 20mA = 32760 ?

I want to send a 4-20mA signal to a K-tron dosing feeder...

Apparently 4mA equates to 50 RPM on the doser which inturn equates to 0.71 Litres/Hour dosed.
20mA equates to 1950 RPM on the doser which inturn equates to 71.0 litres per hour.

If I setup a box on my TP170 HMI screen for an operator to type in what amount of flow they want (ie 35.5 litres/hour) what would the maths and conversions be ? I am struggling with scaling the output values correctly...?

I have to start with REAL because they type in 34.7 etc, then convert to DINT (use ROUND instruction ?) then convert to single word (HOW ?) to paste value into AQW0.. ?

And how on earth do you work out the scaling from what they type in to the correct value to give correct mA to get correct dosing ??

ANY advice or where to look for samples / examples etc GRATEFULLY APPRECIATED !
THANKS !
Steve

bkottaras
September 21st, 2008, 08:00 AM
http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objID=10805149&subtype=133000

The link will take you to the Siemens site.
All about the S7-200 series.
Click on Creating S7 Programs - Calling Blocks and Functions.
There's a few examples on scaling and such.
It is what you will need to get you started.
And the do use REALs so you should be in good shape.
You may also find some examples that you can download and play with.
Hope this helps.

STJ
September 21st, 2008, 09:54 AM
Excellent - thanks for the advice - having browsed around a lot, I came across the examples of creating the SCALE library which creates 3 routines that can be called up and accept input variables (locals) and give the relevant output values...

The three routines S_RTR, S_RTI and S_ITR etc are great !! - you just enter the input scale, enter the output scale and where you want to store the result and it does all the maths for you !
Wish I had found it a few days ago ! - have been pulling my hair out trying to scale the correct values

bkottaras
September 21st, 2008, 10:50 AM
Hopefully you have plenty hair left!!
The example programs as well as the built-in blocks are quite handy.
At least now you know where to look for future projects.