Monday, September 21, 2015

How to use FC105 SCALE and FC106 UNSCALE CONVERT for Analog Data of Simatic Step 7 Siemens




For make user easier read the analog data, in simatic S7 there are function to scale analog data into parameter. Example the analog input is voltage with rang 0 – 12V, and we can scale them into variable with rang 0 – 100.
Following step by step how to use FC105 SCALE CONVERT and FC106 UNSCALE CONVERT:

Step 1: Open Simatic Manager to PLC Programming Language

Follow Step 1 to Step 4 of the article about Simulation Analog Input and Output Programming in Simatic S7-PLCSim

Step 2 :  Add FC105 SCALE CONVERT

In program object, in the left Panel expand library > Standard Library > TI-S7 Converting Block and select FC105 for scale the analog input. FC105 is a function in Simatic that can convert analog data.
Figure 1 Standard Library

Figure 2 FC 105 Scaling Values

Figure 3  FC 105 Scaling

FC105 reads the integer value for analog input stored in PIW256 (parameter IN). For this example, the state of M 1.1 (parameter BIPOLAR) determines whether the input value is bipolar or unipolar.Because the value of M 1.1 is 0, FC105 processes the analog input as a unipolar number (0 to 27648). FC105 converts the integer value to a Real number, FC105 scales the Real number to a value between 0.00 (parameter LO_LIM) and 100.00 (parameter HI_LIM). If the function is executed without error, FC105 sets the RET_VAL (MW2) to W#16#0000(hexadecimal).If the input integer value is greater than 27648 or less than 0, FC105sets the output (OUT) to 100.00 (HI_LIM) or 0.00 (LO_LIM),respectively. FC105 also returns an error by setting the RET_VAL to W#16#0008(hexadecimal).FC105 stores the scaled value in MD4 (parameter OUT).

Step 3 :  Add FC106 UNSCALE CONVERT

Right click below network 1 for add new network, and select Insert New Network
Figure 4 Insert New Network
And Add FC 106 from standard library
Figure 5 FC 106

Figure 6 FC 106 Unscaling

FC106 reads real number stored in memory MD4.Same with FC 105, the state of M 1.1 (parameter BIPOLAR) determines whether the input value is bipolar or unipolar.Because the value of M 1.1 is 0, FC106 processes the analog input as unipolar number (0 to 27648).FC106 converts the Real number that is scaled between 0.00(parameter LO_LIM) and 100.00(parameter HI_LIM). If the function is executed without error, FC106 sets the RET_VAL (MW4) to W#16#0000 (hexadecimal).If the input integer value is greater than 400 (HI_LIM) or less than 0 (LO_LIM), FC106sets the output (OUT) to 27648 or 0.00, respectively. FC106 also returns an error by setting the RET_VAL to W#16#0008(hexadecimal).FC106 stores the integer value in PQW272 (parameter OUT).

Step 4 : Download Program and Run Simulation

Download program into PLC, and run PLCSim. Create input and output variable like figure 7. PIW we set with Slider:int, in simulation we will change input linearly and see the change in MD 4 and output PQW 272. Change PLC condition to RUN, and position PIW 256 in 0.
Figure 7 Run S7-PLCSim

Slide the slider PIW 256, and see data in MD 4. Data in MD 4 is scaling from input PIW 256 with rang 0 – 100. Compare data between PIW 256 and PQW 272, data must be same because we use Unscale data in MD 4 to PQW 272. As described, we set FC 105 with unipolar data (rang input 0 – 27648), when input still in the range there no error and MW 0 is 0.
Figure 8 Analogue Scale Simulation

Set input value out of range (0 – 27648), data in MD 4 set into Hi_LIM 1.000000e+002 and MW 0 (RET_VAL) is 8. Value in MW 2 is 0 because value in MD 4 still in range FC 106 and PQW set value 27648 (as limit range in unipolar).
Figure 9 Analogue Scale Simulation

Download project file click here

Video Demonstration: FC105 Scale and FC106 Uscale Convert in Simatic Step 7 Siemens


Labels:

Newer Post Older Post Home

You may also like these ebook:

Get Free PLC eBook directly sent to your email,
and email subscription to program-plc.blogspot.com




We hate SPAM. Your information is never sold or shared with anyone.

Your Email Will Be 100% Secured !