Siemens LOGO! 8 kWh Pulse Metering: Programming Guide

David Krause16 min read
PLC HardwareSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

Implementing energy metering on a Siemens LOGO! 8 requires a deterministic mapping between the meter's pulse output specification and the PLC's available function blocks. The pulse-output kWh meter used as the reference in this guide is a three-phase utility-grade instrument with the following primary output:

  • Primary output pulse constant: 1000 imp/MWh
  • Primary output pulse weight: 1 kWh per impulse
  • Maximum output pulse frequency: 0.4 Hz
  • Output pulse length: 80 ms

Typical site demand seen at the meter: 197 kW to 534 kW, with monthly consumption between 32,000 kWh and 79,577 kWh. The meter pulses must be wired to a digital input on the LOGO! base module (or an expansion DM8/DM16 digital module) that is configured for high-speed counting, and processed in LOGO! Soft Comfort (LSC).

This guide covers three implementation methods:

  1. Threshold trigger for instantaneous power
  2. Stopwatch for instantaneous power (preferred for low pulse rates)
  3. Counter chain for kWh and MWh accumulation

It also covers the 1 / 5 / 15 / 30 / 60 minute averaging windows required for the LOGO! Web View, and threshold alarms for demand monitoring.

Prerequisites

Item Specification
LOGO! 8 base module 6ED1052-1xxx08-0BA1 family (e.g. 6ED1052-1MD08-0BA2 for 24V/relay) with at least one fast digital input (I1-I4 on most 12/24 V versions) capable of 5 kHz counting
LOGO! Soft Comfort V8.3 or later (compatible with LOGO! 8.3 firmware 1.82.x and BM update)
Expansion I/O (optional) DM8 24 (6ED1055-1MB00-0BA2) for additional counters or alarms
Pulse-output kWh meter Open-collector or voltage SO output, 80 ms minimum pulse width, < 0.4 Hz at full scale
Power supply 24 V DC if meter output is S0 (passive); 230 V AC for relay-base LOGO!
Network Ethernet for LOGO! Web View access (built-in on LOGO! 8)
Wiring note: S0 (DIN 43864) outputs are passive open-collector/Opto-MOS. Connect the meter output between the LOGO! fast input and 24 V DC through a pull-up or the meter's internal supply, depending on meter type. Pulse length of 80 ms is well above the LOGO! digital input debounce; no external pulse stretching is required.

Pulse Output Specification Decoded

The meter's two specifications describe the same physical signal from different angles and must be reconciled before any block parameter is set:

Specification Value Engineering meaning
Pulse constant 1000 imp/MWh 1000 pulses represent 1 MWh = 1,000,000 Wh = 1,000 kWh
Pulse weight 1 kWh / imp Each rising edge = 1 kWh of consumed energy
Max pulse frequency 0.4 Hz Minimum spacing of 2.5 s between pulses at full scale load
Pulse length 80 ms Each active state is 80 ms wide (duty 0.032 at 0.4 Hz)

Both "1000 imp/MWh" and "1 kWh/imp" are arithmetically identical (1000 × 1 kWh = 1 MWh), so the counter implementation is identical: one rising edge = one kWh unit increment. This is the simplest pulse ratio to work with in LOGO! because no prescale counter is required. If the meter were specified as 500 imp/kWh, a divide-by-500 counter with auto-reset would be needed before the kWh register; the approach is described in Counter Chain for Higher-Resolution Meters below.

Power Range and Pulse Interval Analysis

For a 1 kWh/imp meter, the relationship between inter-pulse time and instantaneous power is:

P (kW) = 3600 / dt (seconds)
dt (seconds) = 3600 / P (kW)

Applied to the observed site demand envelope:

Power (kW) Pulse interval dt (s) Frequency (Hz) Within 0.4 Hz limit?
197 (min observed) 18.65 0.054 Yes
360 (midrange) 10.00 0.100 Yes
534 (max observed) 6.74 0.148 Yes
1440 (theoretical 0.4 Hz ceiling) 2.50 0.400 Limit
Engineering insight: Because the worst-case pulse interval (6.74 s) is 84 times longer than the 80 ms pulse width, the meter never produces overlapping pulses at this site. A single counter, threshold trigger, or stopwatch fed from one digital input is sufficient — no de-bounce or queueing is required.

The long pulse intervals at low load are exactly why the threshold trigger must be tuned: a 1 s gate time would miss the 0.054 Hz rate entirely, because the meter may produce only one pulse every 18.65 s. A 30 s gate time can capture at most one pulse per gate at minimum load, which is the binding design constraint that drives the stopwatch method preferred for low pulse rates.

Method 1: Threshold Trigger for Power

The LOGO! Threshold Trigger (Block ID Threshold Trigger) counts edges over a programmable gate time and outputs the count, which is then scaled to engineering units by an arithmetic block. The relationship is:

Power (kW) = (Pulses in gate) x (kWh per pulse) / (gate time in hours)
           = (Pulses in gate) x 1 kWh / (gate time in hours)
           = (Pulses in gate) x 3600 / (gate time in seconds)

Configuration for 1 s gate time (default):

  • Threshold Trigger B003
    • On = I1 (meter pulse input)
    • Gate time (GT) = 1.00 s (P2)
    • On delay / off delay: leave at 0
  • Arithmetic Trigger B012
    • Input 1: Par (Q of B003 / 10 ms pulses) — e.g. 0-1000 Hz if P2=0.01 s
    • Operator: x
    • Input 2: 3600 (if P2=1 s) or 360 (if P2=10 s) or 36 (if P2=100 s)
    • Result: instantaneous power in kW

Gate time selection matrix:

Site power range Recommended GT Arithmetic multiplier Decimal point Refresh
10 kW - 50 kW (very low) 60 s 60 2 60 s
50 kW - 200 kW (this site min) 20 s 180 1 20 s
200 kW - 600 kW (this site full range) 10 s 360 0 10 s
> 600 kW (high pulse rate) 1 s 3600 0 1 s
Consistency check: If GT is changed, the arithmetic multiplier must change in inverse proportion. A 20 s gate time and a 30 s averaging window with only 2 samples in memory are inconsistent — either set GT = window/n where n is an integer, or recalculate the multiplier. The two settings must always be dimensionally aligned so the output represents kW, not pulses.

Method 2: Stopwatch for Instantaneous Power

For low pulse rates the threshold trigger produces stale, steppy output because it requires multiple pulses per gate to converge. The Stopwatch block (rising-edge triggered) measures the time between two consecutive pulses, which gives true instantaneous power from a single pulse pair. The block outputs the elapsed time in 10 ms increments on output ET.

Wiring in LSC:

  1. Place a Stopwatch block; set trigger source to I1 (meter pulse).
  2. Place an AND block to re-arm the stopwatch: inputs are Q (latch of last measurement) and I1 inverted. OR connect the stopwatch's R (reset) input directly to I1; in this topology the block starts a new measurement on every rising edge and exposes the previous result on ET for the duration of the next pulse interval.
  3. Place an Arithmetic block: Operator = ÷, Input 1 = constant 360000, Input 2 = ET (10 ms units). The output is kW because:
    360000 / (ET x 0.01 s) = 3,600,000 / ET = 3600/dt = kW
Power_kW = 360000 / ET    (where ET is the Stopwatch elapsed-time register in 10 ms units)

Verification points:

  • At 197 kW: ET should converge to 360000 / 197 = 1827 (i.e. 18.27 s measured by the block).
  • At 534 kW: ET should converge to 360000 / 534 = 674 (6.74 s).
  • At 1440 kW: ET = 250 (2.5 s) — the absolute floor of the meter's output range.
Why stopwatch beats threshold trigger for this site: At 197 kW the meter produces one pulse every 18.65 s. A 10 s threshold trigger sees a pulse only in 1 of every 2 gate windows, so the power reading alternates between 0 kW and 360 kW. The stopwatch output is continuous and updated on every pulse edge, smoothing the display without sacrificing response.

kWh Accumulation with Counter Chain

The total kWh register is a simple Up counter driven directly by the meter pulse. The base counter range on LOGO! 8 is 0 to 999,999. With a 79,577 kWh/month peak and full site history, the counter will roll over in under a year. Two options exist:

Option A: 32-bit counter (LOGO! 8.2+)

LOGO! 8.2 firmware (FW 1.82.01 and later) exposes counters with a 32-bit value range, configurable in the counter block's Range parameter. This is the cleanest solution if the firmware is current.

Option B: kWh / MWh cascade (all firmware)

  1. Counter Cnt1 (kWh register): counts every pulse of I1; range 0 - 999999.
  2. Counter Cnt2 (MWh register): triggered by the carry-out of Cnt1, i.e. on a transition from 999999 → 0. This is achieved with a comparator block watching Cnt1's Q for the value 999999 and the previous scan value 999998; on the next pulse the carry increments Cnt2.

Counter chain for higher-resolution meters (e.g. 500 imp/kWh)

Counter Cnt0 (impulses): 0-500, auto-reset on reaching 500
Counter Cnt1 (kWh):      increments by 1 on every Cnt0 reset edge
Counter Cnt2 (MWh):      increments by 1 on every Cnt1 reset edge (every 1000 kWh)

For 1 kWh/imp meters, Cnt0 is unnecessary and the kWh register is wired directly to I1.

Time-Window Averaging (1 / 5 / 15 / 30 / 60 min)

LOGO! does not expose a native sliding-window average block, but the same effect is built from:

  • A clock-pulse generator (e.g. Hour counter with 1-min, 5-min, 15-min, 30-min, 60-min periods) generating a WindowTick flag.
  • A snapshot of the kWh counter captured at each tick (transfer the current Cnt1.Q to a holding word kWh_latch).
  • A second snapshot kWh_prev taken at the previous tick.
  • Arithmetic: Window_kWh = kWh_latch - kWh_prev.
  • Average power: Window_kW = Window_kWh / Window_hours where Window_hours = 1/60, 5/60, 0.25, 0.5, or 1.

Block diagram for one window

Hour counter (GT = 1 min)  ---tick--->  AND (with NOT reset)  ---> Move: kWh_curr → kWh_prev
                                                                  AND
                                                                  Move: Cnt1.Q → kWh_curr
                                                                  Subtract: kWh_curr - kWh_prev → kWh_window
                                                                  Divide: kWh_window / 0.01667 → kW_1min

Repeat the structure five times, parameterizing GT and the divisor as shown below. The latch moves must execute in a fixed order: first capture kWh_curr into kWh_prev, then capture Cnt1.Q into kWh_curr. The reverse order introduces a 1-tick error.

Window Hour counter GT Divisor (kWh → kW) Output tag
1 min 00:01:00 60.00 VW200 (kW_1min)
5 min 00:05:00 12.00 VW202 (kW_5min)
15 min 00:15:00 4.00 VW204 (kW_15min)
30 min 00:30:00 2.00 VW206 (kW_30min)
1 hour 01:00:00 1.00 VW208 (kW_60min)

Alarm Implementation

Two complementary alarm strategies are recommended:

  1. Sustained high demand alarm: Comparators (Analog Threshold Trigger or Comparator block) on the time-window kW tags. A 15 min demand > 450 kW is a typical threshold for this site. Wire the comparator output to a digital output or to a text-message block; on LOGO! 8.3, alarms can also trigger an e-mail through the integrated SMTP client.
  2. Zero-demand watchdog: A separate timer (On-delay or Watchdog) reset by every meter pulse. If no pulse arrives within a configurable dead-time (e.g. 60 s — i.e. less than 60 kW of demand for 1 kWh/imp meters), raise a "consumption has dropped to < 60 kW" or "meter failure" alarm. The dead-time must be set longer than the worst-case pulse interval for the alarm threshold.
On-delay:        I1 (pulse) ---|TRG|--Q--> R (reset of on-delay)  (re-armed on every pulse)
                  preset 60 s (alarm if 60 s elapsed without a pulse)

LOGO! Web View Configuration

  1. In LSC, open Tools → Web Editor and create a status page for energy.
  2. Drag a numeric field onto the page; bind it to the variable Cnt1.Q for live kWh, Cnt2.Q for MWh, and the five VW200-VW208 tags for the windowed kW values.
  3. Set update rate to 1 s (LOGO! 8 limit for Web View polling) and enable read-only access for the operator role.
  4. Add a bar graph bound to VW204 (15 min demand) with a high alarm color at 450 kW; this gives the operator a real-time demand indicator.
  5. Configure the LOGO! base module IP address under Network Settings; reserve an address in the plant DHCP range and enable Web server access.
Web View limit: Only variables mapped to VM (Variable Memory) addresses and selected tags are visible. Mark each block's Display in Web Editor checkbox in LSC for the binding to appear in the Web Editor's variable list.

Block Parameter Reference

Block Key parameter Recommended value (this site) Notes
Counter Cnt1 (kWh) Range / CV 0 - 999,999 (or 32-bit on 8.2+) Connected to I1; pulse weight 1 kWh/imp
Counter Cnt2 (MWh) Range / CV 0 - 9,999 Carry from Cnt1
Stopwatch Trigger / ET unit I1, 10 ms Output ET used by arithmetic divider
Arithmetic (power) Op / Par /, Par = 360000 Inputs: constant / ET
Hour counter (1 min) GT 00:01:00 Generates window tick
Hour counter (5 min) GT 00:05:00 Generates window tick
Hour counter (15 min) GT 00:15:00 Generates window tick
Hour counter (30 min) GT 00:30:00 Generates window tick
Hour counter (60 min) GT 01:00:00 Generates window tick
Analog comparator (alarm) A, B, Gain 450.0, 0.0, 1.0 15 min demand threshold
On-delay (watchdog) TH 00:01:00 (60 s) Triggered by I1 inverted; reset by I1

Verification and Commissioning Steps

  1. Pulse simulation in LSC: Use a Pulse Generator block (B001) configured for 1 Hz with 50% duty and connect it to I1. Power values should converge to 3600 kW. Disconnect after testing.
  2. Field cross-check: Compare the LOGO! Web View kWh value against the meter's mechanical or LCD register over a 1-hour window. Tolerance: ± 1 kWh (one pulse).
  3. Stopwatch sanity check: Read ET in LSC online mode; verify it falls in the band [250, 1827] for the expected power range [197, 534] kW.
  4. Window average verification: Inject a known 100 kW load (e.g. a 100 kW heater) and confirm the 1 min, 5 min, 15 min values all converge to 100 kW within one full window period after the load is applied.
  5. Alarm test: Force the comparator input to 500 kW in LSC simulation; the alarm output must change state and be visible in Web View.
  6. Counter roll test: In LSC simulation, pre-load Cnt1 with 999,998 and inject two pulses; verify Cnt2 increments by 1 and Cnt1 wraps to 1.
  7. Web View refresh: Open Web View in two browsers and confirm independent polling of all five kW tags at the expected 1 Hz refresh rate.

Troubleshooting Matrix

Symptom Probable cause Diagnostic Remediation
kWh counter increments but power reading = 0 Arithmetic block wired with wrong operator or Par Inspect B012 inputs in LSC online mode Set operator to ÷ (stopwatch) or × (threshold), set Par to 360000 / 3600 respectively
Power reads 0 then jumps to 360 kW then 0 (choppy) Threshold trigger gate time too short for pulse rate Measure pulse interval with LSC online monitor Switch to stopwatch method or extend GT to ≥ max observed pulse interval
kWh reading drifts low (e.g. reads 0.97 kWh per pulse) Mismatch between meter pulse weight (1 kWh/imp) and counter CV (0.97) Count actual pulses vs Cnt1 increment over 100 pulses Verify meter datasheet; remove any prescale division; confirm 1 kWh/imp
Counter overflow / wraps unexpectedly Cnt1 is 16-bit and demand high Check CV after 30 days; compare to billing Enable 32-bit counter (8.2+) or cascade to MWh register
Web View shows no energy tags Block not flagged "display in Web Editor" Open Web Editor; check variable tree Right-click block → Properties → Web Editor → enable
Stopwatch output stuck at full scale No second pulse after start; latch not rearmed Force I1 in simulation; observe ET Verify reset wiring; in LSC, connect R to I1 directly so each edge restarts the timer
15 min alarm always on Comparator threshold lower than baseline load Read VW204 baseline Raise threshold to 1.1 x normal max; confirm 15 min window period is reached before reading
Watchdog alarm never clears Pulse line inverted or noise-filtered out Scope I1; verify 80 ms pulse present Disable digital input filter; check pull-up/pull-down; verify meter S0 polarity

Field-Proven Notes

  • Pulse weight vs pulse constant: The first meter used in prototyping was 1 imp/kWh (i.e. 1000 imp/MWh with 1 kWh/imp specification — same as this site, only a 1:1 mapping). Meters with 500 imp/kWh, 1000 imp/kWh, or 10,000 imp/kWh are common in retrofit installs. The 1000 imp/kWh class requires a divide-by-1000 counter before the kWh register; the 10,000 imp/kWh class also requires a divide-by-10 then divide-by-1000, or a single divide-by-10,000 counter. Always reconcile both numbers on the meter nameplate before sizing the counter chain.
  • Stopwatch vs counter on a single pulse: The stopwatch output ET cannot be wired directly to a counter's Cnt input as a pulse source — ET is a value, not an edge. To convert ET to a kWh pulse train, use a comparator: when ET crosses a preset (e.g. when a new measurement has been latched), generate a one-cycle flag and feed that to the kWh counter. This pattern is the standard way to integrate the stopwatch's continuous measurement into a discrete energy register.
  • Gate-time drift in threshold trigger: When the threshold trigger is used as a frequency-to-power converter, the displayed power always lags real demand by exactly one gate time. On a 20 s gate this is a 20 s lag — unacceptable for some peak-shaving applications. The stopwatch method has a single-pulse lag of dt seconds (6-19 s at this site), which can be shorter than the threshold trigger's gate-time lag at low load.
  • LOGO! program memory: The 1/5/15/30/60 min window structure, plus the stopwatch arithmetic, threshold trigger, and counter chain, consumes roughly 60-80 function blocks. LOGO! 8 base modules support 200/400 blocks depending on variant; expansion is rarely required for this scope. The five window structures dominate the block count.

FAQ

How do I convert a 1000 imp/MWh meter specification into LOGO! counter parameters?

The pulse constant 1000 imp/MWh is identical to a pulse weight of 1 kWh/imp, because 1000 × 1 kWh = 1 MWh. Wire the meter's pulse output directly to a counter (Cnt) input; each rising edge increments the counter by 1 and the counter value is the live kWh reading. No prescale or divide-by counter is required.

Why does the threshold trigger power reading flicker between 0 and 360 kW at low load?

At 197 kW the meter produces one pulse every 18.65 s. If the gate time is shorter than the pulse interval, the trigger counts 0 pulses in some gates and 1 pulse in others, producing the 0/360 kW alternation. Either lengthen the gate time to 20 s or longer, or switch to the stopwatch method, which gives a continuous instantaneous power from a single pulse pair.

What arithmetic factor do I need for the stopwatch to read kW?

Power (kW) = 3600 / dt (seconds). Because the LOGO! Stopwatch block outputs ET in 10 ms units, the arithmetic becomes Power_kW = 360000 / ET. Place an Arithmetic block with operator = ÷, Input 1 = 360000 (constant), Input 2 = ET. The result is the live power in kW.

How do I build 1 min, 5 min, 15 min, 30 min, and 1 hour kWh averages on LOGO! 8?

Use five Hour Counter blocks set to 1, 5, 15, 30, and 60 minute periods to generate a tick for each window. On every tick, capture the current kWh counter to a holding word; compute the delta against the previous tick's capture; divide by the window length in hours. The five resulting words are bound to the LOGO! Web View page.

How do I prevent the kWh counter from rolling over before the next billing cycle?

On LOGO! 8.2 firmware or later, configure the counter with the 32-bit range (up to ~2.1 billion counts) and the 79,577 kWh/month site will not roll over for decades. On older firmware, cascade a second counter to count MWh carries from the kWh counter's overflow event, providing a 9,999,999 kWh effective range.

Back to blog