4-20mA scaling (PT100 measuring) in Step7

..... sorry to report that your function fails big time. As you have converted it to use integer arithmetic, the processing involves dividing the input by 27648, which for all values other than 27648 produces zero. This function thus produces the LO_LIMIT for IN=0...27647, and the the HI_LIMIT for IN=27648

You should retain the floating point arithmetic and convert the integer parameters to reals at the start of the block, and convert the real output to an integer.

Code:
L iInteger
ITD
DTR
T rRealValue

Code:
L rValue
RND
T iValue


(NB this is a function (FC), function blocks (FB) are another story)
 
Here's your block re-coded using floating point and the RET_VAL removed (make the type of the FC:VOID to do this)

The sooner you get your plc the better - you don't want to write the code only to have to correct lots of simple coding errors.


Code:
FUNCTION FC 1055 : VOID
TITLE =SCALING VALUES INT
//
AUTHOR : DAHNUGUY
FAMILY : CONVERT
NAME : SCAL_INT
VERSION : 1.2

VAR_INPUT
  IN : INT ; // input value to be scaled
  HI_LIM : INT ; // upper limit in INT
  LO_LIM : INT ; // lower limit in INT 
END_VAR
VAR_OUTPUT
  OUT : INT ; // result of the scale conversion
END_VAR
VAR_TEMP
  IN_REAL : REAL ; // input value as an REAL
  K1 : REAL ; // low limit for input value
  K2 : REAL ; // high limit for input value
  SPAN : REAL ; // HI_LIM - LO_LIM
  TEMP1 : REAL ; // temporary result
END_VAR
BEGIN
NETWORK
TITLE =
//
//
	  SET   ; // .
	  L	 #IN; // ACC1=IN
	  ITD   ; 
	  DTR   ; 
	  T	 #IN_REAL; // IN as a real
	  L	 #HI_LIM; // SPAN=HI_LIM-LO_LIM
	  L	 #LO_LIM; // .
	  -I	; // .
	  ITD   ; 
	  DTR   ; 
	  T	 #SPAN; // .
	  L	 #IN_REAL; // if(IN_REAL<0.0)
	  L	 0.000000e+000; // limit to 0.0
	  >=R   ; // .
	  JC	EL02; // {
	  TAK   ; 
EL02: TAK   ; // } else {
	  L	 2.764800e+004; // if(IN_REAL>27648.0)
	  <=R   ; // limit to 27648.0
	  JC	EI04; // {
	  TAK   ; 
EI04: TAK   ; // IN_REAL (limited)
	  L	 2.764800e+004; // -------
	  /R	; // 27648.0
	  L	 #SPAN; // * by SPAN
	  *R	; // .
	  L	 #LO_LIM; // + LO_LIM
	  ITD   ; 
	  DTR   ; 
	  +R	; // .
	  RND   ; 
	  T	 #OUT; // OUT=scale(IN_REAL)
	  SET   ; // RLO = 1 (NO ERROR)
END_FUNCTION
 
L D[AR2,P#0.0] vbmenu_register("postmenu_294112", true);

I almost did it your way in the beginning but didn't for some reason. I have allot of people talking and several sudden drive by meetings.

I still think it is a big victory and a step in the right direction.

I am mostly getting the feel for Step7 and just manipulating it a bit.

The process should be easy once I get all my questions answered.

I already like Step7, but it could be just the new toy smell.

Thanks for the check and edit, I'll look it over tonight.
 
New scale blocks...........not mine

https://support.automation.siemens....xtranet=standard&viewreg=WW&load=treecontent#



Thus in the y values there is always the result of the conversion. The x values are the known parameters in each case.

The four functions of the loadable library differ with regard to data types that are available for the y side or x side.
With the FC164 function the x values are integer numbers and the y values are integer numbers.
With the FC165 function the x values are integer numbers and the y values are real numbers.
With the FC166 function the x values are real numbers and the y values are integer numbers.
With the FC167 function the x values are real numbers and the y values are real numbers.

Notes:
These functions do not change the address register AR1/AR2 and for the FBD and LAD applications provide the ENO box in which the RLO = 0 or 1 in the BR bit is stored.
 
If 3 wire of rtd's r directly used using a barrier to measure the temperature , then how to proceed for scaling ?
Is there any contant factor for all rtd scaling?
 
If you set up the hardware correctly in the hardware config, the hardware does the scaling for the RTD and gives you an integer as I recall.

I have only used T/C with Step7.

The number you get from the Thermocouple is 10 times the actual temperature.

SO at 55 degrees, your PLC will have a register with 550 in it.

Part of the hardware setup involves the correct position of a square jumper on the side of the input module.
 
Thanks alot dahnuguy..... for the reply
but still I am having doubt : I am using universal module AI8X13BIT -6ES71KF010AB0 IN WHICH I AM USING OTHER ANALOG INPUTS ALONG WITH RTD INPUT. IN THAT CASE HOW 2 SCALE THE VALUES CAN U SEND A SAMPLE PROGRAMME ,PLEASE AS i AM A NEW COMMER IN THIS FIELD!
THANKS IN ADVANCE
 
there is a scale block in Step 7

I posted a few that I made here , search for my name or scale blocks , you'll find them.
 
Choose the right hardware and you don't have to scale anything with a pt100.
You get the right temp in Celsius at your PIW only divide 10 is necessary.
 

Similar Topics

5069 IF8 with a 4-20ma 0-100psi, sealed fixed, no calibration, transducer attached. IF8 is scaled 4ma= 0 psi, 20ma=100psi. If over time the...
Replies
12
Views
2,637
Hello, I have looked through the archives and haven't had any luck on the basics of scaling. I'm trying to refresh myself and what formulas I can...
Replies
10
Views
2,720
Hey guys, Normally I have an add in instruction that does this for me but the version of RSLogix I have (borrowed laptop) doesn’t have AOI’s so I...
Replies
19
Views
9,731
Hi, im using a wago 750-455 connected to s7-300 cpu I use fc105 but the scaling is not right, the value is 20% off. Almost like the fc thinks im...
Replies
15
Views
4,347
Hello, I am seeing an issue with inaccurate tank level. It is an elliptical bottom tank with an Anderson Level sensor mounted on the bottom of...
Replies
20
Views
7,513
Back
Top Bottom