Overview
When a Siemens S7-300 SM 331 analog input module (order number 6ES7 331-7KF02-2AB0) reads a thermocouple, the value placed in the Process Image Word (PIW) is a raw integer count. To display a temperature in degrees Celsius on a WinCC HMI, the raw count must be converted to an engineering unit. The conversion is a two-point linear scaling operation that maps the module's raw range to the process variable range defined by the transmitter (lower engineering limit UGR and upper engineering limit OGR).
This reference documents three scaling paths used in production: (1) an in-line STL function with literal constants, (2) a parameter-driven function block backed by a data block (DB) that holds the upper and lower range limits, and (3) WinCC linear scaling applied directly to the HMI tag. The math, the DB layout, and the integration points for TIA Portal V20 and STEP 7 V5.x are covered, with a verification procedure, a troubleshooting matrix for common field errors (including the 1.4x error introduced by selecting the wrong sensor type), and notes on S7-1200, S7-1500, and ET 200SP equivalents.
Module Identification and Key Specifications
The 6ES7 331-7KF02-2AB0 is an 8-channel analog input module from the SIMATIC S7-300 family. The order number suffix "-2AB0" is significant: the -2AB0 revision supports the 0-10 V, plus/minus 10 V, plus/minus 5 V, 1-5 V, 0/4-20 mA, RTD (Pt100, Pt1000, Ni100, Ni1000), and thermocouple (Type J, K, T, E, R, S, B, N, U, L) measuring modes selectable per channel group in the hardware configuration. Earlier -0AB0 and -1AB0 revisions do not support the full thermocouple type list and have different default ranges.
| Parameter | Value |
|---|---|
| Order number (MLFB) | 6ES7 331-7KF02-2AB0 |
| Number of channels | 8 AI (4 groups of 2 channels, RTD/TC reduces to 4 AI for 4-wire sensors) |
| Resolution | 13 bits plus sign (12 bits + sign for bipolar) |
| Conversion time per channel | approx. 23 ms (4-channel group) |
| Thermocouple types supported | J, K, T, E, R, S, B, N, U, L (per HW config) |
| Nominal range for raw output | 0 to +27648 (unipolar) / -27648 to +27648 (bipolar) |
| Linear mode output | 0.1 deg C / count (0.01 deg C / count when selected) |
| Reference junction compensation | None, Internal (module terminal), External (Pt100) |
| Basic accuracy (TC mode) | plus/minus 0.3 percent of full scale |
| Integration time options | 2.5 / 16.67 / 20 / 100 ms (HW config) |
Hardware Configuration and Raw Value Ranges
- Insert the SM 331 in the S7-300 station at the correct slot (slot 4-11). Open the device configuration and double-click the module to open properties.
- Open Properties > Analog Inputs and select the measuring type per channel group. Each group of 2 channels shares a measuring type. For one thermocouple on channel 0, select the group, then pick the thermocouple type (for example "TC-Type K" or the linearized variant "TC-K linear").
- Set the reference junction compensation: None, Internal, or External via Pt100. For most field installations with thermocouple-grade wire run directly to the front connector, Internal is used.
- Select the temperature unit (deg C or deg F) and the resolution (0.1 deg C or 0.01 deg C per count).
- Select the integration time: 2.5 ms, 16.67 ms, 20 ms, or 100 ms. Longer integration times reduce noise at the cost of conversion speed. For thermocouple inputs with 50 Hz line noise, 20 ms is the default. 100 ms is preferred for low-temperature-difference measurements.
- Note the PIW address from the address overview (for example PIW 288 for channel 0 of slot 4). This is the address the STL program must read. Compile and download the hardware configuration to the CPU.
The SM 331 reports thermocouple values in three modes; the choice in HW config determines the math the program must apply.
| Mode selected | PIW at minimum | PIW at maximum | Units per count |
|---|---|---|---|
| Thermocouple, non-linear (TC-J, TC-K, ...) | -27648 | +27648 | Module outputs already linearized in deg C per IEC 60584 (table-driven) |
| Thermocouple, linear (TC-JL, TC-KL, ...) | 0 | +27648 | 0.1 deg C or 0.01 deg C |
| Voltage, plus/minus 80 mV range | -27648 | +27648 | approx. 2.5 uV typical |
For Type K thermocouples in linear mode with 0.1 deg C resolution, the full-scale range of approximately -270 deg C to +1370 deg C maps to -27648 to +27648 counts at 0.1 deg C per count. In the source project, the user observed PIW values around 250 for a 25.0 deg C calibrator reference, confirming 0.1 deg C per count. The applied fix was to switch the measuring type to the linear compensation mode and divide the PIW by 10 to obtain degrees Celsius as a floating-point value for the HMI.
Linear Scaling Formula and Conversion Math
The two-point linear scaling formula converts a raw count X to an engineering value Y:
Y = UGR + (X - MIN) * (OGR - UGR) / (MAX - MIN)Where:
- X = current PIW value (raw count, integer)
- MIN = raw count at the lower range limit (typically 0 for unipolar, -27648 for bipolar)
- MAX = raw count at the upper range limit (typically +27648 for unipolar and bipolar)
- UGR = Untergrenze (lower engineering limit) - the value the lower raw count represents in engineering units (e.g. 0.0 deg C)
- OGR = Obergrenze (upper engineering limit) - the value the upper raw count represents in engineering units (e.g. 100.0 deg C)
For a 0-10 V input mapped to 0-100 percent display with a 0-27648 raw range:
Y_percent = (PIW - 0) * (100 - 0) / (27648 - 0) = PIW * 100 / 27648For a 4-20 mA input mapped to a 0-200 deg C transmitter with live-zero:
Y_C = (PIW - 0) * (200 - 0) / (27648 - 0) = PIW * 200 / 27648The 4 mA live-zero is handled at the transmitter side: 4 mA corresponds to 0 deg C and 20 mA to 200 deg C. The PIW at 4 mA is approximately 0 (after module calibration) and at 20 mA is 27648.
For a bipolar plus/minus 10 V input mapped to -100 to +100 percent:
Y_percent = (PIW - (-27648)) * (100 - (-100)) / (27648 - (-27648)) = (PIW + 27648) * 200 / 552961.200000e+004 (12000.0) as the normalization factor. This is not the standard SM 331 raw full-scale of 27648 and will produce a scaling error if applied to a 0-27648 range. It is a project-specific value suitable only when the configured nominal range is 12000 counts. Always use the actual nominal range from the hardware configuration; never hard-code 12000 unless the configuration matches. The error introduced by using 12000 instead of 27648 is approximately a factor of 2.30 (27648 / 12000).STL Implementation: In-line Scaling Function
The in-line approach uses a single STL function (FC) with input parameters for the raw value, UGR, and OGR. The function returns the scaled real value at output OUT. The original snippet from the source project follows the S7-300 STL programming model, where PIW is loaded, type-converted to REAL via ITD then DTR, and the linear math applied.
FUNCTION FC 100 : VOID
// Inputs
// IN0 : INT - raw PIW value
// IN1 : REAL - UGR (lower engineering limit)
// IN2 : REAL - OGR (upper engineering limit)
// Outputs
// OUT3 : REAL - scaled engineering value
VAR_TEMP
TEMP4 : REAL;
END_VAR
BEGIN
L #IN0
ITD // Integer to Double Integer
DTR // Double Integer to Real
T #TEMP4 // store raw value as REAL
L #IN2 // OGR
L #IN1 // UGR
-R // OGR - UGR
L 2.764800e+004 // MAX (27648)
/R // (OGR - UGR) / 27648
L #TEMP4 // X
*R // X * (OGR - UGR) / 27648
T #OUT3 // scaled result
END_FUNCTION
Notes on the code:
-
ITD(Integer to Double Integer) andDTR(Double Integer to Real) are required because the CPU-315/317 family used with the SM 331 does not provide a direct INT-to-REAL conversion. The intermediate DINT step prevents sign-extension artifacts on negative raw counts from bipolar thermocouples (which would otherwise be misinterpreted as 16-bit signed values and could overflow on a -27648 input). - The constant 27648 (unipolar full scale) is the canonical SM 331 raw range for the non-linear thermocouple type and 0-10 V / plus/minus 10 V / 4-20 mA ranges. For the bipolar plus/minus 80 mV range used in the source project (thermocouple in non-linear mode), MIN should be -27648 and MAX should be +27648, with the formula:
Y = UGR + (X - (-27648)) * (OGR - UGR) / (27648 - (-27648)). - The TEMP4 local variable is needed because the accumulator must hold the raw value across the multi-step scaling operation. Without the temp, the result of the -R would overwrite the raw value.
- Call this FC in OB1 (or in a cyclic OB at the desired update rate). The HMI tag is then wired directly to
FC100.OUT3or to a DB location that holds the last result.
DB-Driven Parameterized Scaling Block
The parameterized version is preferred for installations with many scaled points because the upper and lower engineering limits are stored in a DB. The programmer changes the DB values without recompiling the FC, and the same FC is reused for all analog inputs in the project. The DB layout below is the structure used in the source project, with field names translated from the comments (PEW is the German/Italian abbreviation for PIW; OGR = Obergrenze; UGR = Untergrenze).
| Address | Symbol | Type | Initial value | Description |
|---|---|---|---|---|
| DBD 0 | PEW_REAL | REAL | 0.0 | Raw PIW value, converted to REAL |
| DBD 4 | MAX | REAL | 27648.0 | Upper raw count (27648 for unipolar / plus/minus 27648 for bipolar) |
| DBD 8 | MIN | REAL | 0.0 | Lower raw count (0 for unipolar, -27648 for bipolar) |
| DBD 12 | OGR | REAL | 100.0 | Engineering value at MAX (e.g. 100.0 deg C) |
| DBD 16 | UGR | REAL | 0.0 | Engineering value at MIN (e.g. 0.0 deg C) |
| DBD 20 | OGR_UGR | REAL | 0.0 | Pre-computed OGR - UGR |
| DBD 24 | PEW_MIN | REAL | 0.0 | Pre-computed PEW - MIN |
| DBD 28 | MAX_MIN | REAL | 0.0 | Pre-computed MAX - MIN |
| DBD 32 | XA | REAL | 0.0 | Final scaled engineering value |
The FC reads PIW into DBD 0, performs the scaling math against the DB parameters, and writes the result to DBD 32. The HMI tag points to DBD 32.
FUNCTION FC 200 : VOID
// Inputs
// #DB_NUMERO : BLOCK_DB - data block containing the scaling parameters
// #PT100_Direccion : INT - PIW address of the raw value
// Outputs
// Result written to DBD 32 of #DB_NUMERO
VAR_TEMP
DB_No : INT;
END_VAR
BEGIN
AUF #DB_NUMERO // open DB
L #PT100_Direccion // load PIW
ITD
DTR
T DBD 0 // PEW_REAL := PIW (as REAL)
L DBD 12 // OGR
L DBD 16 // UGR
-R
T DBD 20 // OGR_UGR := OGR - UGR
L DBD 0 // PEW_REAL
L DBD 8 // MIN
-R
T DBD 24 // PEW_MIN := PEW - MIN
L DBD 4 // MAX
L DBD 8 // MIN
-R
T DBD 28 // MAX_MIN := MAX - MIN
L DBD 20 // OGR_UGR
L DBD 24 // PEW_MIN
*R
L DBD 28 // MAX_MIN
/R
L DBD 16 // UGR
+R
T DBD 32 // XA := UGR + (PEW - MIN) * (OGR - UGR) / (MAX - MIN)
END_FUNCTION
Usage examples from the source project and common field cases:
- PT100 temperature transmitter, 0-100 deg C:
OGR = 100.0, UGR = 0.0, MAX = 27648, MIN = 0. - Danfoss VLT drive frequency feedback, 0-60 Hz from 4-20 mA:
OGR = 60.0, UGR = 0.0, MAX = 27648, MIN = 0. - Velocity in machine units where the input is a -10 V to +10 V bipolar signal mapped to -100 to +100:
OGR = 100.0, UGR = -100.0, MAX = 27648, MIN = -27648. - Pressure transmitter 0-10 bar with 4-20 mA output:
OGR = 10.0, UGR = 0.0, MAX = 27648, MIN = 0.
Y = 0 + (13824 - 0) * (100 - 0) / (27648 - 0) = 50.0 deg C. This is the expected mid-scale reading and should match a calibrator set to 50 percent of range. A second test point at PIW 27648 (or 27647 with 1-LSB rounding) should yield 100.0 deg C. A 1-LSB error in the scaled output corresponds to 0.1 deg C at 0.1 deg C / count resolution, or 0.01 deg C at 0.01 deg C / count.WinCC / HMI Linear Scaling Configuration
For projects where the scaling should be performed on the HMI side rather than the PLC, WinCC Unified, WinCC Professional, and WinCC Flexible all support tag-level linear scaling. This eliminates the need for a dedicated FC and reduces the PLC scan-time impact when the value is only used for display.
- In the TIA Portal project tree, open the HMI device and select HMI Tags.
- Create a new tag pointing to the PLC address (e.g.
DB200.DBD0for the raw REAL, or directly toPEW 288if the tag type is INT). - In the Inspector window, select Properties > Properties > Linear scaling.
- Click Linear scaling to enable the function. The PLC area shows the raw value type (INT, DINT, REAL) and the raw range endpoints; the HMI area shows the engineering range endpoints.
- Enter the engineering range endpoints that match the transmitter. For a 4-20 mA / 0-200 deg C transmitter, enter PLC range 0-27648 and HMI range 0.0-200.0. For a -10 V to +10 V bipolar signal mapped to -100 to +100 percent, enter PLC range -27648 to +27648 and HMI range -100.0 to +100.0.
- Assign the scaled tag to the IO field on the screen. Set the display format to match the engineering unit (e.g. "999.9 deg C" for 0.1 deg C resolution).
For WinCC Unified in TIA Portal V20, the official Siemens documentation describes the procedure in detail: Applying linear scaling to a tag (RT Unified) - WinCC Unified.
For WinCC Professional on Comfort Panels and PC Runtime, the path is HMI Tags > Properties > Linear Scaling on the tag dialog. WinCC V7.x uses Tag Management > Properties > Linear Scaling in the channel/tag dialog. The configuration is identical across versions: PLC range and HMI range are entered as two endpoints each, and the runtime applies the linear mapping.
Compensation Methods and Configuration
Thermocouples generate a voltage proportional to the temperature difference between the measuring junction and the reference (cold) junction. The SM 331 must know the cold-junction temperature to report the absolute measuring-junction temperature. The module offers three compensation modes.
| Mode | Description | Use case | Effect of misconfiguration |
|---|---|---|---|
| None | Module treats the cold-junction as 0 deg C. Reading is the thermoelectric voltage translated to deg C with 0 deg C cold reference. | Differential measurements only. Not used in production heater control. | Constant offset equal to ambient temperature at the terminal block (typically 20-30 deg C). |
| Internal | Module uses an internal temperature sensor at the front connector terminals as the cold-junction reference. | Most field installations with thermocouple wire run directly to the cabinet. | Without compensating cable, an error proportional to the temperature gradient between cabinet and field connection. Error is roughly the temperature difference times the Seebeck coefficient. |
| External | A separate Pt100 RTD is wired to a dedicated channel and used as the cold-junction reference. | When the cabinet ambient is far from the field sensor, or for high-accuracy measurements. | Errors only if the Pt100 itself is faulty or wired incorrectly. |
The source project initially used internal compensation with a constant 1.4x error. The recommended fix is to use the linearized thermocouple type (e.g. TC-K linear) which keeps the internal compensation but outputs the value already in 0.1 deg C increments, removing the need for in-program linearization against a non-linear table. The 1.4x error in the original configuration was a symptom of selecting a non-existent "TC-I" type, not a compensation failure; the right fix is to use the correct thermocouple type letter for the physical sensor (TC-K for Type K, TC-J for Type J, and so on). With the correct type selected, internal compensation produces an accurate reading at the calibrator to within the module's plus/minus 0.3 percent of full scale.
Platform Variants: S7-300, S7-1200, S7-1500, and ET 200SP
The SM 331 is specific to the S7-300 platform. The same scaling math applies to all Siemens platforms, but the module, the address scheme, and the HW config steps differ.
| Platform | Module family | Order number example | Raw full-scale | Compensation options | Notes |
|---|---|---|---|---|---|
| S7-300 | SM 331 | 6ES7 331-7KF02-2AB0 (this reference) | 0 to 27648 (unipolar) / plus/minus 27648 (bipolar) | None, Internal, External (Pt100) | Older platform, but the scaling math is identical. |
| S7-1200 | SM 1231 | 6ES7 231-5QD32-0XB0 (4 AI TC) or 6ES7 231-5PF32-0XB0 (8 AI TC) | 0 to 27648 (unipolar) / plus/minus 27648 (bipolar) | None, Internal, External (Pt100 on dedicated channel) | 4-channel TC modules use the same 27648 nominal range. Resolution is 15 bits + sign. |
| S7-1500 | AI 8xU/R/RTD/TC | 6ES7 531-7KF00-0AB0 (8 AI) or 6ES7 531-7PF00-0AB0 (8 AI high-speed) | 0 to 27648 (unipolar) / plus/minus 27648 (bipolar) | None, Internal, External (Pt100) | Resolution up to 16 bits + sign. Same 27648 nominal range. TIA Portal V20 supports tag-level scaling for these modules. |
| ET 200SP | AI 4xU/R/RTD/TC | 6ES7 134-6JD00-0CA1 (4 AI) or 6ES7 134-6JF00-0CA1 (8 AI high-speed) | 0 to 27648 (unipolar) / plus/minus 27648 (bipolar) | None, Internal, External (Pt100) | Distributed I/O, same 27648 nominal range. Same scaling math applies. |
The scaling math, the ITD/DTR instructions, and the linear formula are identical across all four platforms. The only differences are the module order number, the slot/address scheme, and the HW config dialog. The DB-driven FC shown above can be reused on any of these platforms with no code changes.
Safety, Commissioning, and Field Checks
For heater control applications (the source use case), the scaled temperature value drives an output that controls a heating element. Three safety and commissioning practices are mandatory.
- Independent high-temperature cutout. Never rely solely on the scaled value for over-temperature protection. Install a separate safety thermostat or safety PLC (e.g. SIMATIC F-CPU with F-AI) that trips the heater contactor independent of the S7-300 standard program. The S7-300 is a non-safety PLC and the SM 331 is a standard (non-Fail-Safe) module.
- Wire break and out-of-range detection. Add code that checks for PIW = -32768 (underflow / wire break) and PIW = +32767 (overflow / over-range) and forces the heater output off when these conditions are detected. A broken thermocouple in the source project would otherwise report a very low temperature and the controller would command full heater output indefinitely.
- First-article calibration. Before relying on the scaled value for closed-loop control, apply a calibrator at three points (0 percent, 50 percent, 100 percent of range) and verify the scaled output matches to within the module accuracy. A 1-LSB error at 0 percent is acceptable; a 1 percent error indicates a configuration mistake (wrong type, wrong compensation, wrong divisor).
- Commissioning sequence. Use this sequence when bringing a thermocouple loop into service: (a) verify the HW config type matches the physical sensor; (b) verify the wiring at the front connector with a continuity check; (c) apply a calibrator at the lower range limit and confirm the PIW and the scaled value; (d) apply a calibrator at the upper range limit and confirm; (e) apply a calibrator at mid-scale and confirm; (f) enable the closed-loop control only after all three points are within tolerance; (g) enable the safety cutout and test it by intentionally opening the thermocouple wire.
Verification, Calibration, and Field Diagnostics
- Open the watch table. In STEP 7 / TIA Portal, open a Monitor/Modify table and enter the PIW address. Verify the raw value changes as the thermocouple is heated or cooled.
- Apply a known reference. Use a thermocouple calibrator (e.g. WIKA CTI9100 or Beamex MC6) at 0.000 mV (Type K reference at 0 deg C) and at 4.096 mV (100 deg C Type K, per NIST polynomial). Record the PIW and the scaled output. They should match the calibrator within the module accuracy spec (plus/minus 0.3 percent of full scale for the -7KF02).
- Check the end points. With the calibrator at the lower and upper range limits, the FC output should match UGR and OGR to within 1 LSB. A 1-LSB error in the scaled output corresponds to 0.1 deg C (or 0.01 deg C at the higher resolution).
- Verify on the HMI. Force the FC to write a known value (e.g. write 50.0 to DBD 32 directly) and check that the HMI tag shows 50.0. This isolates the HMI tag configuration from the PLC scaling. If the HMI shows 50.0, the tag is correctly configured; if it shows 0.0 or "########", the tag type is wrong (INT instead of REAL) or the format string is mismatched.
- Check the scaling direction. A common error is to swap UGR and OGR when the input is inverted (e.g. 4-20 mA where 20 mA is the low end and 4 mA is the high end for some flow sensors). Verify against a single calibrator point that the FC output increases as the calibrator output increases.
-
Check overflow / underflow. Values outside the raw range produce PIW of -32768 (underflow, often wire break) or +32767 (overflow, often over-range). The FC should clamp these or generate a fault bit. Add a check: if
PIW < MIN or PIW > MAX, set a fault flag and stop using the scaled value for control. - Read the diagnostic buffer. If the SF (group fault) LED on the SM 331 is on, open TIA Portal online, expand Online > Diagnostics > Diagnostic Buffer, and read the SM 331 entry. Common codes: "Wire break" (check thermocouple), "Measuring range violation" (input out of configured range), "Configuration error" (HW config not downloaded or wrong type for the channel group).
Troubleshooting Matrix
| Symptom | Likely cause | Diagnostic | Fix |
|---|---|---|---|
| Scaled value is approximately 1.4x the expected temperature. | Wrong thermocouple type selected (e.g. "TC-I" instead of TC-K, TC-J, ...). The 1.4x factor is consistent with the Seebeck coefficient ratio between two adjacent type letters over a 0-100 deg C range. | Open HW config and check the type letter; cross-check the thermocouple wire color code against the type letter (per IEC 60584 or ANSI/MC 96.1). | Select the correct type (TC-K, TC-J, TC-T, ...). Recompile and download the HW config. |
| Scaled value is offset by a constant (e.g. always 23 deg C too high or too low). | Internal compensation is on but the cold-junction temperature is not the actual terminal temperature (no compensating cable, or the cabinet ambient sensor is faulty). | Measure the actual terminal block temperature with a separate thermometer; compare to the scaled value at calibrator 0 mV. | Switch to external compensation with a Pt100 strapped to the terminal block; or use thermocouple-grade wire to extend the cold junction to the field connection. |
| Scaled value is 10x too large or 10x too small. | Resolution configured as 0.01 deg C / count in HW config but the HMI / FC treats it as 0.1 deg C / count (or vice versa). | Open HW config and check the resolution setting. | Match the divisor: divide PIW by 100 for 0.01 deg C / count, by 10 for 0.1 deg C / count, or by 1 if the module is set to the non-linear type letter (no division needed; the value is already in deg C per count). |
| Scaled value is negative when the temperature is positive. | UGR and OGR swapped, or the bipolar range is selected for a unipolar input. | Apply a positive calibrator input; check the FC intermediate values in a watch table (DBD 20, DBD 24, DBD 28). | Swap UGR and OGR; or change HW config to unipolar mode. |
| Scaled value reads 0.0 or a constant value regardless of input. | Wrong PIW address in the FC; or the wrong DB is opened (AUF instruction); or the FC is not being called. | Online watch on the PIW; cross-check the address with the HW config address overview. Cross-check the FC call in OB1. | Correct the PIW address in the FC call; verify the AUF operand matches the actual DB number; verify the FC is called in the cyclic OB. |
| Scaled value jumps / oscillates by plus/minus 5 deg C or more. | No averaging in the FC; the SM 331 quantization is at the noise level; or 50/60 Hz line pickup on the thermocouple wire. | Watch the raw PIW for stability with a fixed calibrator input. Check the input wiring for routing near VFD cables or contactor coils. | Add a moving average filter (e.g. last 8 or 16 samples) in the FC; or enable integration time of 60 ms / 100 ms in HW config. Re-route the thermocouple wire away from noise sources and use shielded thermocouple extension wire. |
| HMI shows dashes or "########". | Tag type mismatch (INT vs REAL) or the value exceeds the tag display range configured in the IO field. | Check the HMI tag properties in TIA Portal (right-click > Properties > Type). | Set the tag type to REAL; widen the format string and the display range (e.g. "9999.9 deg C" and -9999.9 to +9999.9). |
| SF (group fault) LED on SM 331 is on. | Wire break (thermocouple open), measuring range violation, or module fault. | Open the diagnostic buffer of the CPU (Online > Diagnostics > Diagnostic Buffer) and read the entry from the SM 331. | Check thermocouple wiring and connections. For type J/K with the wrong compensation, the module may also report "Measuring range violation". Power cycle or perform a CPU restart to clear the SF LED after the fault is fixed. |
| Scaled value is correct at room temperature but drifts at high temperature. | Cold-junction compensation error increasing with delta T; or thermocouple wire of wrong type (e.g. Type J wire used with a Type K sensor). | Apply a calibrator at multiple points across the range and plot the error vs temperature. Check the wire type against the sensor type. | Replace the wire with the correct thermocouple-grade wire; or switch to external Pt100 compensation. |
Frequently Asked Questions
What is the correct normalization factor for a Siemens SM 331 in the linear scaling formula?
The canonical raw full-scale value is 27648 (positive) for unipolar ranges (0-10 V, 0/4-20 mA, unipolar thermocouple) and 27648 (with sign) for bipolar ranges (plus/minus 10 V, plus/minus 80 mV thermocouple). For bipolar inputs, MIN = -27648 and MAX = +27648. Using 12000 or 32000 in the divisor is incorrect for the SM 331 and produces an error equal to (correct divisor / wrong divisor).
Why does my scaled temperature value come out 1.4x too high on an S7-300 SM 331?
A 1.4x factor is the typical symptom of selecting a non-existent or wrong thermocouple type in the HW config. Verify the type letter (J, K, T, E, R, S, B, N, U, L) against the actual physical thermocouple. If a "TC-I" or other non-standard type was selected, change to the correct letter and re-test. The module's internal linearization table for the wrong type produces a Seebeck coefficient mismatch that scales linearly with temperature.
Can I perform the linear scaling on the HMI side instead of the PLC?
Yes. WinCC Unified, WinCC Professional, and WinCC V7.x all support tag-level linear scaling. Enable the Linear Scaling property on the HMI tag, set the PLC range to 0-27648 (or plus/minus 27648 for bipolar), and set the HMI range to the engineering value range. This keeps the PLC scan lean for display-only tags. See the WinCC Unified linear scaling reference for the V20 procedure.
Should I use internal or external reference-junction compensation for a thermocouple on the SM 331?
Use internal compensation when the thermocouple wire (or compensating cable) runs directly to the SM 331 front connector and the cabinet ambient is stable. Use external compensation (a separate Pt100 on a dedicated channel) when the cabinet ambient is far from the field sensor, when the connection uses regular copper wire instead of thermocouple-grade wire, or when measurement accuracy better than plus/minus 2 deg C is required. Misconfiguration of internal compensation typically shows as a constant offset equal to the cabinet-to-field temperature difference.
How do I read the SM 331 diagnostic buffer when the SF LED is on?
In TIA Portal, connect online to the CPU, expand Online > Diagnostics > Diagnostic Buffer. The SM 331 entries identify the channel, the fault code, and the cause. Common codes: "Wire break" (check thermocouple), "Measuring range violation" (input out of configured range), "Configuration error" (HW config not downloaded or wrong type for the channel group). Clear the fault by fixing the wiring or configuration, then power cycle or perform a CPU restart to clear the SF LED.