5/27/2010 7:19 AM  
Joined: 4/2/2007 Last visit: 12/3/2022 Posts: 16 Rating: (0) 
Hello.I have a problem. This are the facts: I´have an ultrasonic sensor with a 420mA Analog Output connected to a 420mA Analog Input, this 420mA I have to convert to 3002000 Litres but I can`t do this. Is a FC or FB to do this scale? Or can someone help me to do it. Thank you very much!

5/27/2010 8:23 AM  
Posts: 65 Rating: (2) 
Hi! I know how to do it in STEP7 v10.5. May be you can do it in erlier versions also. You have to use NORM_X and SCALE_X instructions (Instructions>Convert). Look at attachment. Good luck! 
This contribution was helpful to1 thankful Users 
5/27/2010 9:00 AM  
Posts: 147 Rating: (34) 
Hi It is quite straightforward to do a scaling, since you can do it all by yourself. Since you don't mention your CPU, I'll assume you're using S7300. First you have to make sure that you get the proper value (usually in a PIW variable) Then, if you check the SIMATIC S7300 S7300 Module data you can see the analog value represantation in chapter 5. The manual informs you that the maximum value you can get using 420 mA (that is 20mA) is at 27648, and the minimum (0 mA) is 0.(you can get higher than that actually, but is an overflow...) You have to find the represantation of 4mA (= 300 litres). That is 27648*4/20 = 5529.6 (approx. 5530) Then, by applying simple arithmetic (20mA == 27648 == 2000 litres & 4mA == 5530 == 300 litres) you solve the equation for a, b: y = a*x + b (y is litres, x is mA) For y = 300, x = 4mA => 300 = 4a + b For y = 2000, x = 20mA => 2000 = 20a + b Solve this and you get a=106.25, b= 125 Then it is easy, you get y = a*x + b (y is litres, x is mA) with a=106.25, b= 125. From here, it is straightforward to implement this arithmetic in you CPU, any language you are using. Just take care to convert the PIW word value to real first (ITD, DTR commands in STL). Do the same for getting the the actual decimal value, instead of the value in mA, where it should be easy. glhf Aristotelis 
This contribution was helpful to1 thankful Users 
5/27/2010 9:43 AM  
Joined: 10/7/2005 Last visit: 6/17/2024 Posts: 3008 Rating: (1051)

Hello MecoMatic not too sure about the "4mA = 5530 raw AI value= 300 litres" part of Aristotelis's equation (4mA as a raw AI value is "0" as far as I'm concerned assuming the instrument is a 420mA and the AI card is setup to be420mA). Anyhow, assuming you areusing an S7 300 or 400, you'll finda preprogrammed Analogue Input scaling Block in form ofFC105 (SCALE) in the "TIS7 converting Blocks" library (which is part of the "Standard Library"). Click "F1"on it and you'll get the context sensitive help which tells you how to use it. I hope this helps 
Cheers 

5/27/2010 10:28 AM  
Posts: 147 Rating: (34) 
Hi Fritz, Indeed I assumed that the AI card is set up as a 020 mA. Anyway, info about the problem is inadequate and I did a lot of assumptions, but the underlying mathematics remain the same. You just change the numbers.(and getting a better resolution in your values) 
This contribution was helpful to1 thankful Users 
5/27/2010 7:01 PM  
Joined: 4/2/2007 Last visit: 12/3/2022 Posts: 16 Rating: (0) 
Hello to all again. I allready try the formula "y = a*x + b" but I think my mistake is in the convertion "Word to Real" because I don´t do that. Just take the data from the sensor and put it in to the formula and transfer it to a DBx.DBWx and show into the HMI. Tomorrow I will try it and try too the FC105. Later I will comment the results. Thank you all for the help!!!! 
5/27/2010 7:11 PM  
Joined: 4/2/2007 Last visit: 12/3/2022 Posts: 16 Rating: (0) 
I forgot. The CPU is a S7313C 6ES73135BE010AB0 and the AI Card is a 6ES54648ME** put it into an ET200U 6ES53188MB1 via PROFIBUS 
Last edited by: MecoMatic at: 5/27/2010 7:12 PM 

5/30/2010 7:45 PM  
Joined: 4/2/2007 Last visit: 12/3/2022 Posts: 16 Rating: (0) 
Well, I solve my problem. I take the formula from the FC105 SCALE but with the possibility of entry the K1 and K2 because the 2 sensors I got return different values. Not to different but different. Thank you all for the support. 
This contribution was helpful to2 thankful Users 
2/15/2015 6:33 PM  
Posts: 7 Rating: (0) 
How did you that sir , I want also to enter K1 & K2 , SO PLEASE CAN U HELP ME ?! :) 
2/18/2015 11:43 AM  
Joined: 6/24/2013 Last visit: 6/1/2024 Posts: 1608 Rating: (416) 
Hi Your conversion would work like shown below: // **** Ignore small negative values i.e. use 0 instead **** L 200 // 200  allowed hegative value from 4..20mA AI L PIW68 // Raw Signal from AI >I // PIW68>=200?JC AWRI // Value Below 200  use it as is  scale will show Error on Ret_Val L 0 // 0 >=i // PIW68>=0? JCN AWRI // NO: Jump to Write 0 when value is between 200 and 0 POP // YES: Move value from PIW68 back to ACC1 (to use it in write in next instruction) AWRI: T Int_Temp // Store in Integer Temporary Variable // **** Scale to Engineering Units **** CALL "SCALE" The SCALE is a Simatic standard function Hope this helps 
Follow us on