1. Connection Path Overview
The SITRANS F M MAG 5000 is Siemens' compact electromagnetic flow transmitter for line sizes DN 15 to DN 2000. The base unit exposes an active 4-20 mA current output on its main board, meaning the transmitter itself sources the loop current. The S7-1500 can read this output directly on a 4-wire current input channel of an SM 531 analog input module - no communication module, no HART gateway, no Profinet add-on required.
This is the lowest-risk path for proportional valve control driven by an instantaneous flow signal. A single shielded twisted pair carries both the current and the field-power loop. The S7-1500 returns a 16-bit raw integer (0-27648 for 4-20 mA) that TIA Portal NORM_X and SCALE_X instructions convert into engineering units (m³/h, L/s, gal/min, etc.).
For higher-end requirements (predictive maintenance, energy monitoring, redundant transmitters), the MAG 5000 accepts an add-on module for HART 7, Profibus DP, or Modbus RTU. These options do not change the 4-20 mA path - they run in parallel over the same base unit. The product family is documented on the Siemens process instrumentation product page and the S7-1500 system on the SIMATIC S7-1500 product page.
2. Prerequisites and Required Components
Verify the following before opening the cabinet door:
| Item | Specification / Order Number |
|---|---|
| SITRANS F M MAG 5000 base unit | 7ME6910-1AA30-0AA0 (115/230 V AC supply) or 7ME6910-1AA10-0AA0 (24 V DC supply). Internal 4-20 mA hardware jumper set to active. |
| Flow sensor | MAG 1100, MAG 3100, or MAG 5100 sensor connected to the MAG 5000 base. |
| S7-1500 CPU | CPU 1511-1 PN, 1513-1 PN, 1515-2 PN, 1516-3 PN, 1517-3 PN, 1518-4 PN/DP, or T-variant motion controller. Firmware V2.5 or later recommended for current TIA Portal V16/V17/V18 projects. |
| Analog input module | SM 531 AI 8xU/I/RTD/TC ST - order number 6ES7531-7KF00-0AB0 (16-bit, 8 channels, 4-wire current). Lower-cost option: SM 531 AI 4xU/I HF - 6ES7531-7QD00-0AB0. |
| Front connector | 6ES7592-1AM00-0XB0 (40-pin screw-type) or 6ES7592-1BM00-0XB0 (40-pin push-in) for the SM 531. |
| Field cable | 2-wire shielded twisted pair, e.g. LiYCY 2x0.75 mm². Maximum recommended length 100 m to keep loop impedance below 600 Ω and preserve HART communication if used. |
| TIA Portal | V16, V17, or V18 - must match the S7-1500 firmware family. |
| MAG 5000 keypad | Required to set output mode and Qmax - the device has a built-in 3-button keypad on the front panel. |
3. SITRANS F M MAG 5000 Hardware Configuration
Three parameters must be set in the MAG 5000 keypad before the loop will be useful. Enter the menu with the centre button and navigate to Setup > Output > Current output.
-
Current output mode: Set to
4-20 mAactive. Factory default is often OFF or 0-20 mA; the S7-1500 will read 0 mA until this is changed. Press ENTER to commit. -
Qmax (Q_max): Set the flow that corresponds to 20 mA. Match this number exactly to the
MAXparameter you will later use in TIA Portal'sSCALE_Xblock. Typical values: 50 m³/h, 100 m³/h, 250 m³/h - whatever matches the process design. - Direction of flow: Forward for unidirectional; Bidirectional if the application requires negative flow reading. In bidirectional mode, 12 mA is zero flow, 4 mA is -Qmax, and 20 mA is +Qmax.
After configuration, press the padlock symbol on the keypad to lock the menu against operator drift. The MAG 5000 keypad also supports a 4-digit user code - enable it if the device is in a public area.
4. Wiring the Active 4-20 mA Loop to the S7-1500
Wire the MAG 5000 current output terminals directly to the SM 531 channel configured as a 4-wire current input. The transmitter sources 24 V loop voltage internally; do not install a separate 24 V supply in the loop. Terminal assignments are documented on the device-side wiring label - common MAG 5000 configurations use terminals 81/82 for current output (+/-) - verify against the label on the installed unit.
| MAG 5000 terminal | Signal | SM 531 (6ES7531-7KF00-0AB0) terminal |
|---|---|---|
| 81 (current output +) | Active 4-20 mA + | Pin 2 (Channel 0 I+) |
| 82 (current output −) | Active 4-20 mA − | Pin 3 (Channel 0 I−) |
Grounding rules: bond the cable shield to the cabinet PE bar at the entry gland only. Do not ground the shield at the MAG 5000 end - this creates a ground loop and injects 50/60 Hz common-mode noise. Keep the analog cable at least 200 mm from VFD output cables and cross at 90° when crossing is unavoidable. The SM 531 channel-to-bus isolation is 500 V AC, which is sufficient to break ground loops between the field device and the S7-1500 backplane.
Wiring topology (active transmitter, 4-wire current measurement at SM 531):
5. SM 531 AI Module Selection and Channel Configuration
The SM 531 AI 8xU/I/RTD/TC ST (6ES7531-7KF00-0AB0) covers the requirements for the active 4-20 mA output of the MAG 5000. The module has 8 channels in 4 channel groups; each group is configured independently. For the MAG 5000, configure channel 0 as follows:
- Measurement type: Current (4-wire transducer) - this is the mode that accepts an externally powered current source (i.e. the active MAG 5000 output).
- Input range: 4 to 20 mA
- Integration time: 60 ms (default; 16.6 ms for high-bandwidth valve control on the HF module)
- Smoothing: None or Weak - avoid Strong for closed-loop control because it adds phase lag
- Diagnostics: Enable Wire break and Overrange events so the CPU flags bad flow data if the loop is interrupted
Two error thresholds matter at commissioning: the NAMUR NE43 lower limit is 3.6 mA and the upper limit is 20.5 mA. The MAG 5000 sources the lower current to 3.6 mA on internal sensor fault and drives to 21+ mA on overrange; the S7-1500 raises a hardware diagnostic in both cases, and the raw AI word will read 0 (wire break) or 32767 (overflow).
The full mapping from 0/4/20 mA to the S7-1500 integer range (0-27648), as well as overflow/underflow behavior, is documented in Siemens entry 67989094 "SIMATIC S7-1500/ET 200MP/ET 200SP/ET 200AL/ET 200pro/ET 200eco PN Analog value processing".
6. TIA Portal Device Configuration Steps
- Open the TIA Portal project that contains the S7-1500 station.
- In the project tree, open Devices & networks and select the S7-1500 rack.
- Drag the SM 531 (6ES7531-7KF00-0AB0) into the slot to the right of the CPU. The first SM/IM slot is slot 0; the SM 531 for the MAG 5000 is typically in slot 4.
- Open Properties > Module parameters > AI configuration > Channel 0 and select Current 4-wire, range 4-20 mA.
- Tick the Diagnostics: Wire break and Overrange checkboxes so the CPU raises an OB 82 diagnostic interrupt on loop failure.
- Assign the channel to process image partition PIP 1 if you intend to read it in a fast cyclic OB (e.g. OB 30 for proportional-valve control).
- Compile the hardware configuration and download to the CPU.
After download, the input is accessible as %IW0 for slot 4 / channel 0. Confirm the assignment via the device view's I/O addresses table - TIA Portal will show the start address and length for each configured channel.
7. Analog Value Scaling in the S7-1500 Program
The SM 531 returns the raw AI word. For 4-20 mA inputs, Siemens maps the integer range linearly:
| Current | Raw AI word | Meaning |
|---|---|---|
| 0 mA | 0 (with wire-break diagnostic) | Loop open / cable cut |
| 3.6 mA | − 3277 | Sensor fault (NAMUR NE43 low alarm) |
| 4 mA | 0 | Zero flow |
| 12 mA | 13824 | 50% of span |
| 20 mA | 27648 | Qmax (full scale) |
| 20.5 mA+ | 27648+ / 32767 (overflow) | Overrange (NAMUR NE43 high alarm) |
Use NORM_X to convert the raw integer to a normalized real (0.0-1.0) and SCALE_X to expand that to engineering units. The function block pattern is documented in Siemens entry 77316903 "How do you standardize and destandardize analog values with STEP 7 (TIA Portal)?".
Working SCL example (drop into FB 100 or OB 1):
// === SITRANS MAG 5000 4-20 mA to flow in m3/h ===
// Read raw AI word from SM 531 slot 4 channel 0
#raw_input := %IW0;
// Normalize integer 0..27648 to real 0.0..1.0
#norm := NORM_X(
MIN := 0,
VALUE := #raw_input,
MAX := 27648
);
// Scale to engineering units (Qmax must equal MAG 5000 menu value)
#flow_m3h := SCALE_X(
MIN := 0.0,
VALUE := #norm,
MAX := #qmax_setting // e.g. 50.0 m3/h
);
// Fault detection - zero out flow on any out-of-range condition
IF (#raw_input < 0) OR (#raw_input > 27648) THEN
#flow_m3h := 0.0;
#io_fault := TRUE;
ELSE
#io_fault := FALSE;
END_IF;
// Optional: simple first-order filter for noisy flows
// fc = 0.1 s; alpha = dt / (dt + fc); dt = OB1 cycle time
#flow_filtered := #flow_filtered * (1.0 - #alpha) + #flow_m3h * #alpha;
For bidirectional flow, set SCALE_X.MIN to a negative Qmin (e.g. -50.0) and adjust the fault threshold to 4-20 mA nominal but treat 12 mA as the zero point in the downstream control logic.
SCALE_X MAX parameter. The cleanest way to avoid drift is to expose Qmax as a TIA Portal HMI tag and write it to both the FB instance and the MAG 5000 via HART (or document the value on the device label).8. Sampling, Diagnostics, and Safe State
Proportional valve control requires deterministic sampling. The S7-1500 supports two patterns:
- OB 1 cyclic main: Default 10-100 ms. Sufficient for slow flow loops (PID with integral time > 5 s).
- OB 30-38 cyclic interrupt: 1-1000 ms configurable. Use for fast proportional-valve control where the loop bandwidth exceeds 1 Hz. The AI channel must be assigned to a process image partition that is updated in that OB.
Implement a diagnostic interrupt handler in OB 82 to catch wire break and overrange events. The OB 82 local data includes the channel status - write the affected flow to a fail-safe value (0 m³/h or last-good-value with timeout) and raise a maintenance alarm on the HMI:
// OB 82 - diagnostic interrupt
#slot := %OB82_IO_FLAG; // Bit field from S7-1500
IF (#slot AND 16#0001) <> 0 THEN
#flow_m3h := 0.0; // Fail-safe value for proportional valve
#alarm_id := 1001; // Custom HMI alarm number
SET_SFC108(#alarm_id); // Generate PROFINET alarm to HMI
END_IF;
Galvanic isolation between the field loop and the backplane is 500 V AC on the SM 531. The module is hot-swappable - the S7-1500 raises a station stop only if you remove the CPU, not the SM 531.
9. Verification and Commissioning
- Go online in TIA Portal and open the Watch table for the MAG 5000 input. Force the MAG 5000 current output to a fixed test value (Setup > Simulation > Current = 12.0 mA).
- Monitor
%IW0- it should read 13824 (50% of 27648) and the scaled#flow_m3hshould equal half of Qmax (e.g. 25.0 m³/h if Qmax = 50.0). - Repeat at 4 mA (raw = 0) and 20 mA (raw = 27648). All three points must match within ±0.3% of span (≈ ±83 counts) - this is the SM 531 accuracy at 25 °C.
- Exit simulation mode on the MAG 5000 (Setup > Simulation > Off) before returning the loop to service.
- Command the proportional valve to a mid-position setpoint and verify the measured flow tracks the controller output within the loop's bandwidth.
- Pull a wire from terminal 81 to simulate a wire break. Confirm the OB 82 interrupt fires and the flow value is forced to the fail-safe state.
Document the final Qmax value on the device label and the TIA Portal project documentation. Both numbers must be visible from the HMI maintenance screen for the next commissioning engineer.
10. Troubleshooting Matrix
| Symptom | Likely cause | Action |
|---|---|---|
| AI reads 0 mA, no diagnostic | Current output disabled in MAG 5000 | Enable in Setup > Output > Current output, confirm mode = 4-20 mA |
| AI reads 0 mA, Wire break diagnostic | Open loop, broken cable, or reversed polarity | Verify polarity at MAG 5000 terminals 81/82, check cable continuity end-to-end |
| AI reads 21+ mA (raw = 32767), Overrange diagnostic | Flow above programmed Qmax | Increase Qmax in MAG 5000 to cover the process maximum, or de-rate the proportional valve |
| AI reads ≈ 3.6 mA (raw = − 3277) | Internal sensor fault; coil open or shorted | Read MAG 5000 diagnostic log; check coil resistance at terminals, replace sensor if coil open |
| Flow reading drifts randomly | Common-mode noise from VFD cable in same conduit | Re-route analog cable, ground shield at cabinet PE only, separate conduit by 200 mm minimum |
| Scaling off by constant factor | Qmax in MAG 5000 differs from SCALE_X MAX in PLC |
Match both values; Qmax set in MAG 5000 menu, MAX set in TIA Portal SCALE_X
|
| AI value stuck at 27648 even at no flow | SM 531 channel configured for voltage instead of current | Change channel 0 measurement type to Current (4-wire transducer) |
| AI value flickers between 0 and 27648 | Loose terminal on SM 531 front connector | Re-torque the front connector screw; check for cold solder joints on the field cable lugs |
| OB 82 fires every scan | Channel diagnostics enabled but no Wire break condition present | Verify the Wire break threshold is supported in 4-20 mA mode (it is) and that the loop is not floating - re-verify shield ground |
11. Frequently Asked Questions
Does the SITRANS F M MAG 5000 need a separate 24 V supply for the 4-20 mA loop?
No. The MAG 5000 base unit ships with an active 4-20 mA current output - the transmitter sources the loop voltage internally. Wire the current output terminals directly to the S7-1500 SM 531 channel configured as Current 4-wire transducer. Do not install an external 24 V supply in series.
How do I enable the 4-20 mA output on the MAG 5000?
From the device keypad, navigate to Menu > Setup > Output > Current output. Set the mode to 4-20 mA and confirm the channel is ON. Configure Qmax on the same screen - this is the flow value that drives the loop to 20 mA.
Which S7-1500 analog input module should I use with the MAG 5000?
SM 531 AI 8xU/I/RTD/TC ST (order number 6ES7531-7KF00-0AB0) is the standard 16-bit 8-channel module. The HF variant SM 531 AI 4xU/I HF (6ES7531-7QD00-0AB0) is recommended for high-bandwidth proportional-valve control because it supports 16.6 ms integration time versus 60 ms on the standard module.
What scaling formula should I use in TIA Portal for the 4-20 mA signal?
Use NORM_X to map the raw integer 0-27648 to a real 0.0-1.0, then SCALE_X with MIN = 0 and MAX = Qmax (in m³/h, L/s, or whatever engineering unit the proportional valve expects). The function block pattern and downloadable FB are documented in Siemens entry 77316903.
Why does the S7-1500 read 0 even though fluid is flowing through the MAG 5000?
The current output on a factory-fresh MAG 5000 is disabled by default. Access the device keypad, open the Output Setup menu, enable the 4-20 mA channel, and confirm Qmax. The S7-1500 should start tracking flow within one integration time of the SM 531 module.
Can I run HART or Profinet over the same pair as the 4-20 mA signal?
Yes. The MAG 5000 accepts add-on modules for HART 7, Profibus DP, and Modbus RTU that multiplex digital communications on top of the 4-20 mA loop or provide a separate bus interface. The 4-20 mA path continues to operate in parallel - the S7-1500 reads flow on the AI module while the HART or Profinet master reads diagnostics and configuration on the bus.