TIA Portal How To Read Analog Inputs : non-standard range

0
TIA Portal How To Analog Inputs voltage
TIA Portal How To Analog Inputs

Analog Inputs Configuration in TIA Portal for non-standard range

Toady I’m going to show you how to read analog inputs with non-standard range. We’re going to read a pressure sensor that outputs voltage range of: 0,5V – 5,5V (0 – 5000 PSI). A couple of AI modules have ‘measuring range adjustment’ on the hardware level, which makes this task much easier. This functionality has been improved in TIA Portal V14 (TIA Portal V14: What’s New).

In this tutorial you will learn:

  • How to configure Hardware in TIA Portal
  • How to configure Analog Input Card TIA Portal
  • How to scale Analog signals in TIA Portal

 

Analog inputs configuration in TIA Portal for modules withmeasuring range adjustment’

Analog inputs modules currently (04/04/17) supporting ‘measuring range adjustment‘:

Hopefully new firmwares will roll-out for the remaining modules and add ‘measuring range adjustment’ functionality.

 

1. Hardware Configuration in TIA Portal

Highlight analog input module and go to: Properties » General » Highlight Input Channel that you wish to configure » Measuring » Measurement type: Voltage, Measuring range: +/- 10V (AI 8xU/I HF) / 0..10V (AI 2xU/I 2-,4-wire HF)

TIA Portal How To Analog Inputs Card Bipolar
TIA Portal How To Analog Inputs Module Bipolar

 

TIA Portal How To Analog Inputs Card Unipolar
TIA Portal How To Analog Inputs Module Unipolar

"<yoastmarkTIP! Take advantage of the built in diagnostics, especially overflow and underflow (value read out side of our measuring range). This errors will be displayed in diagnostic buffer and the PLC’s LED will blink red. Also they will be displayed in ‘System diagnostics view’ window if you have it on one of your HMI screens.

 

 

 

Still having the channel highlighted scroll down to Measuring range scaling » tick Measuring range adjustment box. Please note that the limits are in millivolts!

TIA Portal Measuring range adjustment bipolar
TIA Portal Measuring range adjustment bipolar

 

TIA Portal Measuring range adjustment unipolar
TIA Portal Measuring range adjustment unipolar
  • sensor’s low limit: 0 PSI »500 mV = 0,5V »  Scaled low nominal range limit (bipolar: -27648, unipolar: 0)
  • sensor’s high limit: 5000 PSI » 5500mV = 5,5V » Scaled high nominal range limit (27648)

Last but not least we’re going to assign a tag that will contain our reading. This tag will be of type Integer and will contain a value between ‘scaled low nominal range limit (bipolar: -27648, unipolar: 0) and scaled high nominal range limit (27648).

Switch the lower level tab from General to IO tags and enter the tag name:

TIA Portal How To Analog Inputs Tag
TIA Portal How To Analog Inputs Tag

Each tag corresponds to a channel, starting at Channel 0 at the top and ending with channel 7 at the bottom.

 

2. Create ‘Analog Value Conversion’ Function in TIA Portal

Now we’re going to write a function that will convert integer value stored in our tag (IN_PressureRead) to engineering value (PSI in this case).

Start by creating a FC:

TIA Portal How To Analog Inputs Function
TIA Portal How To Analog Inputs Function

Create function variables:

INPUT OUTPUT TEMP
In_VoltageValueRead - RealQ_ScaledValue - RealNormMinValue - Real
In_EngineeringValMin - RealNormalized_Value - Real
In_EngineeringValMax - Real
In_Bipolar - Bool
In_Offset - Real

TIA Portal How To Analog Inputs Function IO

NOTE: In_Offset is used for manipulating the measurement if required by  sensor’s calibration result.

Insert the following code in the Function (OR DOWNLOAD THE FC FROM OUR DOWNLOAD PAGE):

TIA Portal How To Analog Inputs Function Code

 

3. Function call and IO assignment in TIA Portal

TIA Portal How To Analog Inputs FunctionCall

 

Now let’s have a quick look at NORM_X and SCALE_X functions. Detailed information can be found in TIA Portal’s help.

TIA Portal How To Analog Inputs NORM_X
Source: TIA Portal help

 

NORM_X maps a tag value to a linear scale and outputs a result (type: Real) between 0.0 and 1.0 as per the following graph:

 

 

 

At this point:

  • sensor’s low limit: 0 PSI »500 mV = 0,5V »  Scaled low nominal range limit (bipolar: -27648, unipolar: 0) » 0.0 (NORM_X min)
  • sensor’s high limit: 5000 PSI » 5500mV = 5,5V » Scaled high nominal range limit (27648) » 1.0 (NORM_X max)

 

TIA Portal How To Analog Inputs SCALE_X
Source: TIA Portal help

 

SCALE_X maps a tag value between 0.0 and 1.0 to a linear scale and outputs a result (type: Real) in specified value range.

 

 

 

 

At this point:

  • sensor’s low limit: 0 PSI »500 mV = 0,5V »  Scaled low nominal range limit (bipolar: -27648, unipolar: 0) » 0.0 (NORM_X min) » 0 PSI (engineering units)
  • sensor’s high limit: 5000 PSI » 5500mV = 5,5V » Scaled high nominal range limit (27648) » 1.0 (NORM_X max) » 5000 PSI (engineering units)

 

Analog inputs configuration in TIA Portal for modules withoutmeasuring range adjustment’

 

1. Hardware Configuration in TIA Portal

Highlight analog input module and go to: Properties » General » Highlight Input Channel that you wish to configure » Measuring » Measurement type: Voltage, Measuring range: 0..10V or +/- 10V (depending on the type of analog module you’re using)

TIA Portal How To Analog Inputs Card Bipolar

TIP! Take advantage of the built in diagnostics, especially overflow and underflow (value read out side of our measuring range). This errors will be displayed in diagnostic buffer and the PLC’s LED will blink red. Also they will be displayed in ‘System diagnostics view’ window if you have it on one of your HMI screens.

 

 

TIA Portal How To Analog Inputs Card Diagnostics

Now we’re going to assign a tag that will contain our reading. This tag will be of type Integer and will contain a value between ‘scaled low nominal range limit (bipolar: -27648, unipolar: 0) and scaled high nominal range limit (27648).

Switch the lower level tab from General to IO tags and enter the tag name:

TIA Portal How To Analog Inputs Tag
TIA Portal How To Analog Inputs Tag

Each tag corresponds to a channel, starting at Channel 0 at the top and ending with channel 7 at the bottom.

 

2. Create ‘Analog Value Conversion’ Function in TIA Portal

Now we’re going to write a function that will convert integer value stored in our tag (IN_PressureRead) to engineering value (PSI in this case).

Start by creating a FC:

TIA Portal How To Analog MRA Inputs Function

Create function variables:

INPUT OUTPUT TEMPCONSTANT
In_VoltageValueRead - RealQ_ScaledValue - RealNormMinValue - RealResolution_Multiplier - Real: 2764.8
In_Min - RealQ_Error - BollNormMaxValue - Real
In_Max - RealNormalized_Value - Real
In_EngineeringValMin - Real
In_EngineeringValMax - Real
In_Offset - Real

TIA Portal How To Analog Inputs MRA Function IO

Insert the following code in the Function:

TIA Portal How To Analog Inputs MRA Function Code

 

3. Function call and IO assignment in TIA Portal

TIA Portal How To Analog Inputs MRA Function Call

  • In_VoltageValueRead – Input value from analog input module
  • In_Min – Sensor’s low limit: 0,5V
  • In_Max – Sensor’s high limit: 5,5V
  • In_EngineeringValMin – Sensor’s low limit in engineering value: 0 PSI
  • In_EngineeringValMax – Sensor’s low limit in engineering value: 5000 PSI
  • In_Offset – used for manipulating the measurement if required by  sensor’s calibration result.
  • Q_ScaledValue – Output value in engineering units
  • In_Offset – logic state equals 1 if the measurement is out of range.

Now let’s have a quick look at NORM_X and SCALE_X functions. Detailed information can be found in TIA Portal’s help.

TIA Portal How To Analog Inputs NORM_X
Source: TIA Portal help

 

NORM_X maps a tag value to a linear scale and outputs a result (type: Real) between 0.0 and 1.0 as per the following graph:

 

 

 

 

 

  • Sensor’s low limit: 0 PSI » 0,5V multiplied by 2764.8 = low range limit (1382.4) » 0.0 (NORM_X min)
  • Sensor’s high limit: 5000 PSI » 5,5V multiplied by 2764.8 = high range limit (15206.4)» 1.0 (NORM_X max)
TIA Portal How To Analog Inputs SCALE_X
Source: TIA Portal help

 

SCALE_X maps a tag value between 0.0 and 1.0 to a linear scale and outputs a result (type: Real) in specified value range.

 

 

 

 

 

 

  • Sensor’s low limit: 0 PSI » 0,5V multiplied by 2764.8 = low range limit (1382.4) » 0.0 (NORM_X min) » 0 PSI (engineering units)
  • sensor’s high limit: 5000 PSI » 5,5V multiplied by 2764.8 = high range limit (15206.4)» 1.0 (NORM_X max) » 5000 PSI (engineering units)

Conclusion

If using a sensor with non-standard measuring range it’s more advantageous to use a module with ‘measuring range adjustment’. Not only is it easier to configure,  but more importantly, it provides a far better reading resolution.

81 Shares