Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System Variable Monitoring on B&R Automation Runtime

Overview

This document is a survival guide for automation engineers maintaining B&R X20CP1584 (and related CP15xx/CP35xx) PLCs from defunct OEMs with zero documentation. It covers every system variable you can read from a running B&R Automation Runtime (AR) controller, how to access them without the original project, and how to interpret abnormal values for proactive failure detection.

B&R AR exposes system health through three distinct mechanisms:

  1. CPU I/O Mapping / General Data Points – hardware-level registers available in the controller’s I/O tree (temperature, battery status)
  2. System Library Function Blocks (FUBs) – software functions from BRSystem, AsArProf, and other standard libraries (CPU usage, task cycle times, memory diagnostics)
  3. System Diagnostics Manager (SDM) – built-in web server providing real-time dashboards without any development tools

Cross-references: See custom-diagnostic-tools.md for building external monitoring scripts, hardware-monitoring.md for physical inspection procedures, and execution-model.md for task class architecture details.


X20CP1584 Hardware Reference

ParameterValue
ProcessorIntel Atom E640T @ 0.6 GHz
System RAM256 MB DDR2 SDRAM
User RAM (SRAM)1 MB (minus configured remanent variables)
Remanent VariablesMax 256 kB (configurable)
Shortest Task Class Cycle400 us
Typical Instruction Cycle0.0075 us
CompactFlashRemovable, ordered separately
Battery3 V / 950 mAh lithium (Renata CR2477N)
Battery LifeMin. 2 years at 23 C ambient
CoolingFanless
Operating Temp (horizontal)-25 to 60 C
Operating Temp (vertical)-25 to 50 C
Storage Temp-40 to 85 C
Power Consumption8.6 W (without interface module)
B&R ID Code0xC370
Integrated I/O ProcessorProcesses I/O data points in the background

Thermal Protection

Protection LevelTemperatureAction
CPU overtemperature shutdown110 C (processor die)PLC enters reset state, error 9204 logged
Board overtemperature shutdown95 C (PCB)PLC enters reset state, error 9204 logged
Software thermal protection105 C (component)Controller enters SERVICE mode to self-protect

LED Status Indicators

LEDColorStateMeaning
RDY/FGreenOnApplication running
RDY/FGreenBlinkingSystem startup (initializing)
RDY/FGreenDouble flashFirmware update in progress
RDY/FYellowOnSERVICE or BOOT mode
R/ERedOnSERVICE or BOOT mode
R/ERedDouble flashInstallation error (AR 4.93+)
S/EGreenOnPOWERLINK running, no errors
S/ERedOnSystem error (check logbook)
S/EGreen+RedAlternating blinkPOWERLINK managing node failed
S/ERedBlinking (off/green)System stop error code
PLKGreenOnPOWERLINK link established
ETHGreenOnEthernet link established
CFGreenOnCompactFlash detected
CFYellowOnCF read/write active
DCRedOnBattery empty
DCYellowOnCPU power supply OK
CodePatternDescription
RAM errorShort-Short-Short-LongRAM failure – device defective, replace
Hardware errorShort-Short-Long-LongHardware failure – device defective, replace

Pattern encoding: 4 phases of short (150 ms) or long (600 ms) pulses, repeated every 2 seconds.


System Variable Categories

1. CPU Temperature

Source: I/O Mapping (controller data points) / General Data Points

The X20CP1584 provides two temperature measurement points in its I/O mapping:

Data PointLocationDescription
CPU TemperatureOn-die / CPU packageDirect CPU silicon temperature
Housing TemperatureNear circuit board inside housingInternal ambient reference

Note: There is no direct ambient/cabinet temperature sensor on the CPU. For external ambient monitoring, B&R offers X20CMR010/011/111/100 climate measurement modules.

Temperature RangeStatusAction
40 - 55 CNormal (at 20-25 C ambient)No action
55 - 75 CElevated (cabinet 35-45 C)Verify ventilation, check cabinet temp
75 - 89 CWarning zoneAlert operator, investigate airflow
89 - 100 CCriticalPlan maintenance window, check cooling
> 105 CShutdown imminentCPU enters SERVICE mode automatically
>= 110 CHard shutdownError 9204 logged, PLC enters reset state

Temperature delta rule: A 10 C rise in ambient temperature produces approximately a 10 C rise in both CPU and housing temperature.

Abnormal values indicate:

SymptomLikely Cause
CPU 70+ C at 20 C ambient on deskMounting orientation wrong (flat on table blocks airflow)
Steady climb over hoursCabinet cooling failure (fan dead, filter clogged)
Sudden spike after software changeNew task consuming excess CPU cycles
Temperature oscillates rapidlyIntermittent high-priority task blocking idle time

2. CPU Usage (Idle Time)

Source: LogIdleShow FUB from AsArProf library / SDM web interface

CPU usage is NOT available as a direct I/O data point. It must be read via software or the SDM.

The LogIdleShow function block from the AsArProf library calculates CPU usage from task idle time – the percentage of time when cyclic tasks are not consuming their allocated time slices. This is a measured average over a time interval, not an instantaneous value.

(* Example: LogIdleShow instantiation *)
fbIdleTime : LogIdleShow;

(* In cyclic task *)
fbIdleTime();
cpuIdlePercent := fbIdleShow.idle;   (* Higher = more idle = lower CPU usage *)
CPU Usage (100% - idle%)StatusInterpretation
0 - 40%HealthyPlenty of headroom for communication and events
40 - 70%ModerateNormal for loaded applications
70 - 85%ElevatedWatch for cycle time creep, limit new features
85 - 95%Danger zoneRisk of cycle time violations, watchdog trips
> 95%CriticalImminent SERVICE mode entry from watchdog

Abnormal values indicate:

SymptomLikely Cause
Usage jumps from 40% to 90%Blocking operation in fast task (File I/O, TCP socket, string ops in <10 ms class)
Gradual increase over weeks/monthsMemory leak consuming resources, growing data structures
Usage spikes every N cyclesPeriodic task with variable execution time
High usage only when SDM is openSDM cyclic data transfer overhead (significant on smaller CPUs, ~10% on X20CP13xx)

Cross-reference: See execution-model.md for task class priority and time-slice allocation details.


3. Task Cycle Times

Source: RTInfo FUB from BRSystem library / Profiler / SDM Task Monitor

Each task class (Cyc0, Cyc1, Cyc2, Cyc3, and event tasks) is assigned a fixed time slice. When execution exceeds this slice, the watchdog timer triggers and can place the controller in SERVICE mode.

The RTInfo function block from the BRSystem library returns real-time task information:

(* Example: RTInfo for task monitoring *)
fbRTInfo : RTInfo;

(* In cyclic task -- pass task class name *)
fbRTInfo(pTask := 'Cyclic#1');    (* or 'Cyclic#2', 'Cyclic#3', etc. *)
fbRTInfo();
currentCycleTime := fbRTInfo.cycTime;   (* Current cycle execution time in us *)
minCycleTime    := fbRTInfo.cycTimeMin; (* Minimum observed cycle time *)
maxCycleTime    := fbRTInfo.cycTimeMax; (* Maximum observed cycle time *)
Task ClassTypical Default CycleTypical Use
Cyclic#1 (Cyc0)1 ms (fastest possible: 400 us on CP1584)Motion control, high-speed I/O
Cyclic#2 (Cyc1)10 msProcess control, regulation loops
Cyclic#3 (Cyc2)100 msSequencing, HMI updates
Cyclic#4 (Cyc3)ConfigurableSlow background tasks
Event tasksOn-triggerAlarm handling, state machines

Cycle time monitoring thresholds:

MetricWarningCritical
Cycle time / allocated slice> 60%> 85%
Jitter (max - min)> 30% of slice> 50% of slice
Consecutive near-misses3+ cycles > 70%1+ cycle > 90%

Abnormal values indicate:

SymptomLikely Cause
Cycle time suddenly 2-3x normalInfinite loop (while/for without exit condition), stuck state machine
Gradual increase over shiftGrowing string buffer operations, memory fragmentation
Spikes every few minutesGarbage collection, File I/O flush, OPC UA communication
Max cycle >> averageRare code path hit (error handling branch, first-cycle initialization)

Key fact: Approximately 80% of all B&R SERVICE mode entries are caused by cycle time violations.


4. Memory Usage

Source: sys_br_get_info / I/O mapping / SDM

The X20CP1584 has 256 MB DDR2 SDRAM system RAM and 1 MB SRAM for user data. Memory usage can be monitored through:

  • The SDM System page (web browser, no tools needed)
  • sys_br system variable structures (if accessible in your runtime)
  • Automation Studio memory diagnostic tools (with project)
Memory RegionSize (CP1584)Purpose
DDR2 SDRAM (System RAM)256 MBOS, libraries, application code, runtime objects
SRAM (User RAM)1 MBFast user variables, data processing
Remanent VariablesUp to 256 kBPersistent data across power cycles (FRAM/battery-backed)
CompactFlash16 MB - 8 GB (card dependent)Application storage, file system
Battery-backedSystem RAM + User RAM + RTCMaintained by lithium battery

Memory pressure indicators:

SymptomInterpretation
SRAM approaching 100%Add more variables -> reduce available headroom
SDRAM > 80% consumedLarge arrays, string buffers, or memory leak
CompactFlash > 90% fullLog files accumulating, limit log rotation
Remanent variable space fullCannot add new persistent variables

Abnormal values indicate:

SymptomLikely Cause
SDRAM usage climbing steadilyMemory leak (dynamically allocated objects never freed)
SRAM exhausted after downloadProject too large for this CPU model
CompactFlash writes every cycleApplication logging in fast task class

5. Watchdog Status

Source: System configuration / SDM / Error logbook

B&R AR implements per-task-class watchdog timers. Each task class has a configurable watchdog timeout that defaults to slightly longer than the configured cycle time.

Watchdog EventResultError Code
Cycle time violationTask watchdog triggersVaries by AR version
Watchdog after cycle exceed (task in safe state)SERVICE mode9210 (halt/service after watchdog)
Continuous violationsPLC enters reset state9204

Watchdog configuration is in the Hardware Configuration -> Task Settings. Each task class can have its watchdog timeout independently adjusted.

Abnormal values / events indicate:

SymptomLikely Cause
Intermittent watchdog trips (random intervals)Network-induced blocking, garbage collection, priority inversion
Consistent watchdog trip at startupConfiguration mismatch between cycle time and task content
Watchdog trip only when HMI connectedCommunication overload from visualization

6. Battery Status

Source: BatteryInfo system library function / CPU I/O mapping / DC LED

Battery status is available both as a software-readable value and via the front-panel DC LED.

Battery Info ValueStatusAction
Battery OKGreenNormal operation
Battery lowWarningSchedule replacement within maintenance window
Battery emptyDC LED red, error loggedImmediate replacement required (replace within 1 min if power removed)

What battery backup covers:

  • Remanent variables
  • User RAM
  • System RAM
  • Real-time clock (RTC)

Replacement: Renata CR2477N only. Replace every 4 years. Can be hot-swapped under power, or within 1 minute without power. Never use a different battery model number.

Abnormal values indicate:

SymptomLikely Cause
Battery low warningNormal aging (replace every 4 years)
Battery low after 1 yearExtreme temperature cycling, poor storage conditions
Battery OK but RTC driftingCrystal oscillator issue (separate from battery)
Loss of remanent variables after power cycleBattery completely depleted, FRAM failure

7. I/O Status

Source: I/O mapping / SDM Hardware page / LED indicators

The X20CP1584 uses an integrated I/O processor that handles I/O data points in the background, independently from the main CPU task execution.

I/O DiagnosticSourceDescription
Module Run/ErrorLED + softwarePer-module operational status
X2X Link statusLED + SDMBus communication health
I/O power supply overloadRed LED (l)X2X Link power overloaded
I/O power supply undervoltageRed LED (r) double flashInput voltage too low
Module insertion/removalSDM eventHot-swap detection

The I/O mapping in the controller configuration automatically provides status structures for each connected module. When accessed through SDM or PVI, these data points are available without the project.

Abnormal values indicate:

SymptomLikely Cause
Intermittent I/O dropout on single moduleLoose bus connector, damaged X2X cable
All modules showing errorsX2X Link power supply issue, bus termination problem
Module error after power cycleFirmware mismatch, hardware fault on module
I/O values frozenTask stopped (SERVICE mode), I/O processor still running

8. Network Statistics

Source: SDM Network page / Ethernet & POWERLINK LED indicators

Network ParameterInterfaceHow to Monitor
Link status (up/down)ETH (IF2)Green LED, SDM
Link activity (tx/rx)ETH (IF2)LED blinking, SDM
POWERLINK statePLK (IF3)S/E LED pattern, SDM
POWERLINK cyclic data exchangePLK (IF3)S/E LED (OPERATIONAL = data flowing)
Ethernet collisions/errorsETH (IF2)SDM diagnostics
POWERLINK frame timeoutPLK (IF3)Auto fallback to BASIC_ETHERNET

POWERLINK S/E LED State Machine (V2 mode):

S/E LED PatternStateDescription
Off/OffNOT_ACTIVEPowered off, startup, or misconfigured
Flickering ~10 Hz / OffBASIC_ETHERNETEthernet fallback (CN only, auto-recover)
Single flash ~1 Hz / OffPRE_OPERATIONAL_1MN: reduced cycle / CN: waiting for SoC
Double flash ~1 Hz / OffPRE_OPERATIONAL_2MN: cyclic starting / CN: configured
Triple flash ~1 Hz / OffREADY_TO_OPERATECyclic data flowing but not yet evaluated
Blinking ~2.5 Hz / OffOPERATIONALFull cyclic communication active
Off / Blinking redSTOPPEDCN stopped by MN command
Off / OnError modeFailed frames, collisions
Blinking (green+red) / OnError with stateError in PREOP/READYTOOP state

Abnormal values indicate:

SymptomLikely Cause
POWERLINK cycling between PREOP1 and BASIC_ETHERNETCable issue, MN not running, wrong node address
ETH LED offCable unplugged, switch port failure, wrong VLAN
Frequent POWERLINK reconnectionsElectromagnetic interference, marginal cable
S/E solid redCheck PLC logbook for specific error

Reading System Variables Without the Project

This is the critical section for engineers working with defunct OEM equipment.

Method 1: System Diagnostics Manager (SDM) – No Tools Required

The SDM is a built-in web server on every B&R controller running AR V3.0 or higher. It requires only a web browser and TCP/IP connectivity.

Access: http://<PLC_IP_ADDRESS>/sdm

SDM FeatureInformation AvailableRequires Project?
System pageCPU usage, task cycle times, memory usage, uptimeNo
Hardware pageAll I/O modules, temperatures, bus status, module errorsNo
Network pageEthernet/POWERLINK status, IP configurationNo
Error logbookHistorical errors, exceptions, SERVICE mode entriesNo
ProfilerTask runtime profiling, cycle time analysisNo
Software pageInstalled modules, versions, license statusNo

Procedure:

  1. Connect PC to same network as PLC (or directly via crossover cable)
  2. Ping the PLC IP address to verify connectivity
  3. Open browser: http://<PLC_IP>/sdm
  4. Navigate System / Hardware / Network tabs for diagnostics
  5. Use the Error logbook tab for historical fault analysis

Tip: The SDM is always running in the background (even when the web page is not loaded). It provides historical CPU usage data for time intervals when no browser was connected. On smaller CPUs, opening the SDM can increase CPU usage by ~10%.

Cross-reference: See custom-diagnostic-tools.md for automating SDM data collection via scripts.

Method 2: PVI (Process Visualization Interface) – No Project Required

B&R’s PVI protocol can enumerate and read all controller variables (including system data points) without the source project. PVI tools ship with the B&R Runtime installation.

ToolPurposeProject Required?
PVI ManagerEstablish connections to PLCsNo
PVI MonitorReal-time variable monitoring and exportNo
Runtime Utility Center (RUC)Save all controller variables to fileNo
PVIservices DLL.NET library for custom applicationsNo
OPC ServerOPC UA/DA access to all variablesNo (if configured)

Procedure with PVI Monitor:

  1. Install B&R Runtime components (includes PVI tools)
  2. Open PVI Manager
  3. Create new device connection (Ethernet: enter PLC IP; or RS232 for serial)
  4. Launch PVI Monitor from the Runtime group
  5. Browse the variable tree – system data points and I/O mapping are visible
  6. Export variable list to CSV for documentation

Procedure with PVIservices (.NET):

// Conceptual -- PVIservices connects via PVI protocol
PVIConnection pvi = new PVIConnection();
pvi.Connect("192.168.1.100", PVIProtocol.ANSL);
foreach(var variable in pvi.GetAllVariables()) {
    Console.WriteLine($"{variable.Name}: {variable.Address}");
}

Procedure with OPC:

  1. If OPC server is enabled on the PLC, connect with any OPC client
  2. Browse the address space – system variables appear in the tree
  3. No source code needed

Note: On legacy B&R PLCs (CP476 era), PVI communications do not require authentication. On newer AR versions, authentication may be configured.

Method 3: Automation Studio Online Mode – No Project Required

Even without the project source, Automation Studio can connect to a running PLC in online mode:

  1. Install Automation Studio
  2. Open AS without a project
  3. Use Online -> Connect to Target (enter PLC IP)
  4. Logger shows real-time and historical events
  5. Watch Window can monitor variables by entering their names/addresses manually
  6. Trace (oscilloscope) can capture variable values over time
  7. Profiler captures task runtime behavior

Method 4: PLC I/O Mapping Direct Access

System data points (temperature, battery status) are in the controller’s own I/O mapping – not in the application project. They are always accessible through:

  • SDM Hardware page
  • PVI Monitor (browse to controller -> I/O mapping)
  • Automation Studio I/O assignment in monitor mode

Trending System Variables Over Time

Built-in: Profiler

The Automation Studio Profiler captures task runtime behavior over extended periods:

  1. Connect to PLC via Automation Studio (no project needed for basic profiling)
  2. Open Tools -> Profiler
  3. Configure which task classes to profile
  4. Set recording duration (supports multi-hour captures)
  5. Download and analyze in Automation Studio
  6. Profiler logs can also be uploaded via SDM

Built-in: Trace (Variable Oscilloscope)

Automation Studio’s Trace function records variable values over time at high resolution:

  1. Connect to PLC
  2. Open Tools -> Trace
  3. Add variables to trace (enter names manually if no project)
  4. Set trigger conditions and recording depth
  5. Supports continuous recording up to available memory
  6. Export captured data for analysis

Limitation: Trace duration is limited by capture buffer size. For continuous 1-hour traces, the buffer must be sized appropriately.

Built-in: SDM Historical Data

The SDM automatically maintains historical data for:

  • CPU usage (time-series graphs in System page)
  • Error logbook entries with timestamps

This data persists across browser sessions and power cycles (stored in controller memory).

External: PVI + Custom Data Logger

For continuous, long-term trending without Automation Studio:

  1. Use PVIservices DLL (.NET/C#) or Python (via ANSL protocol)
  2. Create a service that polls system variables at regular intervals
  3. Log to CSV, database, or time-series database (InfluxDB, Grafana)
  4. Create dashboards for trend visualization

Key variables to poll:

  • CPU idle percentage (via LogIdleShow if callable, or SDM)
  • Task cycle times (via RTInfo or SDM)
  • CPU and housing temperature (via I/O mapping data points)
  • Battery status (via BatteryInfo or I/O mapping)
  • POWERLINK state (via S/E LED or SDM)
  • Error logbook entries

Cross-reference: See custom-diagnostic-tools.md for sample code and architecture for external monitoring systems.

External: OPC UA Subscriptions

If OPC UA is configured on the PLC:

  1. Set up OPC UA subscriptions for system variables
  2. Use any OPC UA client (free: Prosys Simulation, UA Expert)
  3. Subscription-based monitoring provides real-time updates without polling

System Variable Quick Reference Tables

All Monitorable Variables (No Project Required)

VariableCategoryAccess MethodUnitTypical Range
CPU TemperatureThermalI/O mapping, SDM, PVIC40 - 70
Housing TemperatureThermalI/O mapping, SDMC35 - 60
CPU UsagePerformanceLogIdleShow, SDM%5 - 60
Task Cycle Time (per class)PerformanceRTInfo, Profiler, SDMus/msVaries
Task Cycle Time Min/MaxPerformanceRTInfo, Profilerus/msVaries
Battery StatusPowerBatteryInfo, I/O mapping, DC LEDBooleanOK / Low
System RAM UsageMemorySDM% or MB40 - 70
User RAM (SRAM) UsageMemorySDM, ASkBVaries
Remanent Variable UsageMemorySDM, ASkBVaries
CompactFlash Free SpaceStorageSDMMBVaries
POWERLINK StateNetworkS/E LED, SDMEnumOPERATIONAL
Ethernet Link StatusNetworkETH LED, SDMBooleanUp/Down
Module Run/Error (per module)I/OLED, SDM, I/O mappingBooleanOK/Error
X2X Link StatusBusSDM, I/O mappingEnumOK/Error
I/O Power OverloadPowerLED, SDM, I/O mappingBooleanOK/Overload
Error Logbook EntriesDiagnosticsSDM, LoggerText
System UptimeDiagnosticsSDMSeconds
Operating StateDiagnosticsRDY/F LED, SDMEnumRUN/SERVICE/BOOT

Key System Library Function Blocks

LibraryFUBPurposeReturns
BRSystemRTInfoReal-time task infocycTime, cycTimeMin, cycTimeMax
BRSystemBatteryInfoBattery statusOK/Low/Empty
AsArProfLogIdleShowCPU idle percentageidle (%)
BRSystemsys_br_get_infoSystem info structureVarious system parameters
BRSystemMcBaseInfoMotion control base infoAxis diagnostics
BRSystemMpAlarmXCoreInfomapp alarm system infoActive alarms count
StandardFileDirFile system directory listingCompactFlash contents
StandardFileStatusFile size, attributesStorage info

Key System Variable Structures

StructureLibraryDescription
sys_brBRSystemBase runtime system info (AR version, build date, serial number, memory layout)
sys_taskBRSystemPer-task-class runtime info (current/minimum/maximum cycle times, overload count)
sys_br_get_infoBRSystemFunction to populate sys_br structure with current system data
sys_task_get_infoBRSystemFunction to populate sys_task structure for a specific task class

sys_br Structure Members (AR 4.x)

The sys_br structure from the BRSystem library provides system-level information. While the exact member layout varies by AR version, the following fields are consistent across AR 4.x:

FieldTypeDescription
sys_br.wARVersionMajorUSINTAR major version (e.g., 4)
sys_br.wARVersionMinorUSINTAR minor version (e.g., 93)
sys_br.wARVersionBuildUSINTAR build/patch version (e.g., 5)
sys_br.wARVersionSubUSINTAR sub-build version (e.g., 2)
sys_br.awSerialNumberARRAY[0..7] OF USINTCPU serial number (8 x USINT = 32 hex chars)
sys_br.aCPUNameSTRINGCPU model name (e.g., “X20CP1584”)
sys_br.wBRCpuIdUDINTB&R CPU ID code (e.g., 0xC370)
sys_br.bSystemStateUSINTCurrent operating state (0=INIT, 1=RUN, 2=SERVICE, 3=BOOT)
sys_br.dwSystemTickUDINTSystem tick counter (free-running timer)
sys_br.wSystemTickFreqUDINTSystem tick frequency in Hz
sys_br.wMaxCyclicTasksUSINTMaximum number of cyclic task classes (typically 8)
sys_br.wUsedCyclicTasksUSINTNumber of cyclic task classes in use
sys_br.dwTotalSDRAMUDINTTotal SDRAM in kB (256000 for CP1584)
sys_br.dwFreeSDRAMUDINTFree SDRAM in kB
sys_br.dwTotalSRAMUDINTTotal SRAM in kB (1024 for CP1584)
sys_br.dwFreeSRAMUDINTFree SRAM in kB
sys_br.dwRemanentSizeUDINTConfigured remanent variable space in kB
sys_br.bBatteryStatusUSINTBattery status (0=OK, 1=Low, 2=Empty)
sys_br.wCpuTemperatureSINTCPU temperature in 0.1 C units (e.g., 520 = 52.0 C)
sys_br.wBoardTemperatureSINTBoard/housing temperature in 0.1 C units
sys_br.bOvertemperatureShutdownBOOLTRUE if CPU/board overtemperature shutdown has occurred

Reading sys_br in IEC code:

PROGRAM ReadSystemInfo
VAR
    sysInfo : sys_br;
END_VAR

sys_br_get_info();  (* Populate the structure *)

    (* Log system info to diagnostic string *)
    diagString := CONCAT(
        'AR Version: ', USINT_TO_STRING(sysInfo.wARVersionMajor), '.',
        USINT_TO_STRING(sysInfo.wARVersionMinor),
        ' Build: ', USINT_TO_STRING(sysInfo.wARVersionBuild), '.',
        USINT_TO_STRING(sysInfo.wARVersionSub),
        '\r\nCPU: ', sysInfo.aCPUName,
        '\r\nState: ',
        IF sysInfo.bSystemState = 0 THEN 'INIT'
        ELSIF sysInfo.bSystemState = 1 THEN 'RUN'
        ELSIF sysInfo.bSystemState = 2 THEN 'SERVICE'
        ELSIF sysInfo.bSystemState = 3 THEN 'BOOT'
        END_IF,
        '\r\nCPU Temp: ', REAL_TO_STRING(sysInfo.wCpuTemperature / 10.0, 1), ' C',
        '\r\nBattery: ',
        IF sysInfo.bBatteryStatus = 0 THEN 'OK'
        ELSIF sysInfo.bBatteryStatus = 1 THEN 'LOW'
        ELSIF sysInfo.bBatteryStatus = 2 THEN 'EMPTY'
        END_IF
    );

sys_task Structure Members (AR 4.x)

The sys_task structure provides per-task-class performance data. Index by task class number (0 = Cyclic#1, 1 = Cyclic#2, etc.):

FieldTypeDescription
sys_task.wTaskClassNumberUSINTTask class number (0-7)
sys_task.wCycleTimeUDINTCurrent cycle execution time in us
sys_task.wMinCycleTimeUDINTMinimum cycle time observed (since last reset)
sys_task.wMaxCycleTimeUDINTMaximum cycle time observed (since last reset)
sys_task.wOverloadCountUDINTNumber of cycle time violations / overloads
sys_task.wJitterTimeUDINTCurrent jitter deviation in us
sys_task.wTaskLoadUSINTTask load as percentage (0-100)

Reading sys_task in IEC code:

PROGRAM MonitorAllTasks
VAR
    taskInfo : sys_task;
    i : USINT;
END_VAR

FOR i := 0 TO 7 DO
    sys_task_get_info(i);  (* Populate for task class i *)
    IF taskInfo.wTaskClassNumber = i THEN
        (* Task class is active *)
        diagMsg := CONCAT(
            'TC#', USINT_TO_STRING(i + 1),
            ': cycle=', UDINT_TO_STRING(taskInfo.wCycleTime), 'us',
            ' max=', UDINT_TO_STRING(taskInfo.wMaxCycleTime), 'us',
            ' load=', USINT_TO_STRING(taskInfo.wTaskLoad), '%',
            ' overloads=', UDINT_TO_STRING(taskInfo.wOverloadCount)
        );
        (* Log or send via OPC-UA *)
    END_IF
END_FOR

These structures are defined in the BRSystem library header files. To use them in your own diagnostic code, reference the BRSystem library in Automation Studio.

Note: The sys_br and sys_task structures are available within the AR runtime but their exact member layout varies by AR version. Consult the BRSystem library help in Automation Studio for the specific structure definition matching your controller’s AR version. The field names above are typical for AR 4.x but may differ slightly in AR 3.x or AR 6.x.

SysInfo Function Block (Community Discovery)

B&R community members have discovered that the SysInfo function block from the BRSystem library can detect whether the controller is in SERVICE mode or has recently rebooted. This is valuable for automated recovery scripts:

VAR
    fbSysInfo : SysInfo;
END_VAR

fbSysInfo();
IF fbSysInfo.bServiceMode THEN
    (* Controller is currently in SERVICE mode *)
    (* Implement automatic recovery or notification logic *)
END_IF

The SysInfo FUB provides additional fields beyond what is in sys_br, including flags for SERVICE mode, error state, and boot type (cold/warm/init).

Cross-reference: See custom-diagnostic-tools.md for building external monitoring systems that query these structures via PVI or OPC-UA.


Failure Mode Analysis: What Abnormal Values Really Mean

Failure Mode: Imminent SERVICE Mode (Watchdog Trip)

Leading indicators (detectable hours/days before failure):

IndicatorNormalWarningCritical
Task cycle time (Cyc0)< 60% of slice60-85% of slice> 85% of slice
CPU idle time> 30%15-30%< 15%
Cycle time jitter< 20% of slice20-40%> 40%
Max cycle / avg cycle ratio< 3x3-10x> 10x

Most common root causes:

  1. Infinite loop in cyclic code (~80% of SERVICE mode entries)
  2. Blocking I/O in fast task class (File I/O, TCP socket in Cyc0/Cyc1)
  3. Excessive string manipulation in time-critical task
  4. Memory leak gradually consuming resources
  5. ANSL (Automation Net) communication overload

Failure Mode: Thermal Shutdown

Leading indicators:

IndicatorNormalWarningCritical
CPU temperature40-60 C60-89 C89-105 C
Temperature rate of change< 1 C/min1-3 C/min> 3 C/min
CPU usage at elevated tempAnyHigher usage = more heat

Most common root causes:

  1. Cabinet ventilation failure (fan, filter)
  2. Blocked airflow (cables, debris over CPU)
  3. Incorrect mounting orientation (horizontal vs vertical derating)
  4. High ambient temperature (> 50 C)
  5. Elevated above 2000 m elevation (requires 0.5 C derating per 100 m)

Failure Mode: Battery Depletion

Leading indicators:

IndicatorNormalWarningCritical
Battery statusOKLowEmpty
RTC accuracy< 10 ppm drift10-50 ppm> 50 ppm
Remanent variable integrityStableOccasional resetVariables lost on power cycle

Failure Mode: Network Communication Loss

Leading indicators:

IndicatorNormalWarningCritical
POWERLINK stateOPERATIONALPREOP cyclingBASIC_ETHERNET fallback
POWERLINK reconnection count0 / hour1-5 / hour> 5 / hour
Ethernet frame errors0< 10 / hour> 10 / hour

Failure Mode: Memory Exhaustion

Leading indicators:

IndicatorNormalWarningCritical
System RAM usage< 70%70-85%> 85%
SRAM usage< 80%80-90%> 90%
CompactFlash free space> 20%10-20%< 10%

SERVICE Mode: Entry, Diagnosis, and Recovery

What Causes SERVICE Mode

Cause CategoryPercentageExamples
Cycle time violation (watchdog)~80%Infinite loop, blocking I/O, excessive computation
Page fault (memory access)~10%Array out of bounds, invalid pointer, buffer overflow
Divide by zero~5%Unvalidated divisor in calculation
Hardware fault~3%RAM error, module failure
Thermal protection~2%CPU/board overtemperature
Unknown / Other< 1%License violation, firmware corruption

Diagnostic Procedure When in SERVICE Mode

The PLC remains network-accessible in SERVICE mode. The IP address, SDM, and all diagnostic interfaces continue to function.

Step 1: Check the Logger / SDM Error Logbook

  • Open SDM at http://<PLC_IP>/sdm or use AS Logger
  • Find the timestamped error entry that caused SERVICE mode
  • Note the error code and backtrace (if available)

Step 2: Common Error Codes

Error CodeDescriptionLikely Fix
EXCEPTION Page Fault (25314)Invalid memory accessCheck array bounds, string operations
EXCEPTION Divide by ZeroDivision by zeroValidate divisor before division
Watchdog timeoutCycle time exceededReduce task content, move blocking ops to slower class
9204Temperature shutdownCheck cooling, wait for cooldown, warm restart
9210Halt after watchdogFix code, warm restart

Step 3: Recovery

  1. Identify and correct the root cause
  2. In Automation Studio: Online -> Warm Restart
  3. If no AS available, press the physical Reset button (enters SERVICE mode)
  4. If Reset -> RUN mode switch: set switch to RUN position for automatic restart

Critical: A PLC in SERVICE mode is NOT executing control logic. Verify process state before warm restart.

Cross-reference: See hardware-monitoring.md for physical troubleshooting procedures when software diagnostics are insufficient.


Minimum Viable Monitoring (No Code Changes)

MethodWhat You GetEffort
SDM web dashboard (weekly check)CPU usage, temperature, errors, task times15 min/week
DC LED visual inspection (shift walk)Battery status30 sec/shift
RDY/F LED visual inspectionApplication running vs. SERVICE modeInstant
SDM Error Logbook review (weekly)Historical faults15 min/week

Enhanced Monitoring (With PVI / External Script)

MethodWhat You GetEffort
PVI Monitor periodic exportAll variable values to CSVSetup once, automate
Custom Python/.NET serviceContinuous polling of key variables1-2 day setup
OPC UA subscriptionsReal-time variable updates1 day setup
Grafana dashboardVisual trending over weeks/months1 day setup

Full Instrumentation (Requires Code Deployment)

MethodWhat You GetEffort
Deploy LogIdleShow in each task classReal-time CPU usage per taskModify existing program
Deploy RTInfo for all task classesCycle time monitoring with min/maxModify existing program
Deploy custom alarm logicAutomatic alerts on threshold breachModify existing program
File-based data loggingLong-term trend data on CompactFlashNew task class
mapp AlarmX integrationStandard alarm managementModify existing program

Important: Without the project source, you CANNOT modify the PLC program. Methods 1 and 2 are your only options. See custom-diagnostic-tools.md for building external monitoring that requires no PLC code changes.


Key Findings

  1. SDM is your primary lifeline. Available at http://<PLC_IP>/sdm with zero tools, it provides CPU usage, task cycle times, memory usage, temperature, I/O status, network status, and the complete error logbook – all without the project source code.

  2. CPU temperature is available as an I/O data point. Two sensors (CPU die + housing) are in the controller’s I/O mapping and readable via PVI, SDM, or direct I/O access. Shutdown occurs at 110 C (CPU) / 95 C (board). Normal operating range is 40-70 C at typical ambient temperatures.

  3. CPU usage is NOT an I/O data point. It requires the LogIdleShow FUB from the AsArProf library (code deployment) or reading from the SDM (no code needed). Opening the SDM itself increases CPU usage by ~5-10% on smaller CPUs.

  4. Task cycle times are the #1 failure indicator. ~80% of all SERVICE mode entries are caused by cycle time violations. Monitor via RTInfo FUB (BRSystem library), Profiler, or SDM Task Monitor. Watch for cycle time exceeding 85% of the configured time slice.

  5. All system variables are readable via PVI without the project. PVI Monitor, Runtime Utility Center, and PVIservices DLL can enumerate and read every variable on the controller, including system data points, I/O mapping, and application variables. This is the recommended path for defunct OEM scenarios.

  6. Battery status is dual-indicated (software register + DC LED). The battery buffers remanent variables, user RAM, system RAM, and the RTC. Replace every 4 years with Renata CR2477N only. Battery depletion causes loss of all persistent data on power cycle.

  7. The sys_br and sys_task system variable structures from the BRSystem library provide structured access to runtime information (AR version, memory layout, per-task cycle statistics). Their exact member layout varies by AR version – consult the library help in Automation Studio.

  8. POWERLINK state is fully diagnosable from the S/E LED. The 6-state LED pattern machine (NOT_ACTIVE -> BASIC_ETHERNET -> PREOP1 -> PREOP2 -> READY -> OPERATIONAL) provides immediate visual diagnostics without any tools.

  9. For continuous external trending, use PVI + custom data logger (Python/.NET) or OPC UA subscriptions to push system variables into a time-series database. This requires zero PLC code changes and provides long-term trend analysis.

  10. Thermal protection is automatic and aggressive. Per the official B&R datasheet, the X20CP1584 hard-shuts down (reset state) at 110°C CPU temperature or 95°C board temperature (error 9204). B&R may enter SERVICE mode at a lower temperature (~105°C estimated) before the hard shutdown. This is not configurable. Proper cabinet ventilation is the only mitigation.


Python Script: Comprehensive System Health Check

This script connects to a B&R CP1584 via OPC-UA and reads all accessible system variables for a complete health snapshot. It requires no project files or Automation Studio:

"""
B&R CP1584 System Health Check via OPC-UA.
Usage: python system_health_check.py <PLC_IP>
Requires: pip install asyncua
"""
import asyncio, sys
from datetime import datetime
from asyncua import Client

PLC_IP = sys.argv[1] if len(sys.argv) > 1 else "192.168.0.1"

async def check_health():
    url = f"opc.tcp://{PLC_IP}:4840"
    print(f"B&R CP1584 System Health Check")
    print(f"Connecting to {url}...")
    print("=" * 60)

    async with Client(url=url) as client:
        root = client.get_root_node()
        print("Connected. Scanning address space...\n")

        children = await root.get_children()
        all_vars = {}

        async def scan_node(node, depth=0):
            if depth > 5:
                return
            try:
                for child in await node.get_children():
                    name = (await child.get_browse_name()).Name
                    node_id = child.nodeid.to_string()
                    dtype = (await child.get_data_type()).to_string()

                    keywords = [
                        "temperature", "cpu", "battery", "cycle", "load",
                        "task", "memory", "ram", "status", "error",
                        "uptime", "state", "power", "link", "plk",
                        "idle", "free", "watchdog"
                    ]

                    if any(kw in name.lower() for kw in keywords):
                        try:
                            val = await child.get_value()
                            all_vars[node_id] = {
                                "path": node_id,
                                "name": name,
                                "value": val,
                                "type": dtype
                            }
                        except Exception:
                            all_vars[node_id] = {
                                "path": node_id,
                                "name": name,
                                "value": "READ_ERROR",
                                "type": dtype
                            }
                    await scan_node(child, depth + 1)
            except Exception:
                pass

        await scan_node(root)

        if not all_vars:
            print("No system variables found in OPC-UA namespace.")
            print("Possible causes:")
            print("  - OPC-UA server not configured")
            print("  - System variables not exposed in address space")
            print("  - Authentication required (try credentials)")
            print("\nAlternative: Use SDM at http://<PLC_IP>/sdm")
            return

        print(f"Found {len(all_vars)} system variables\n")

        for node_id, info in sorted(all_vars.items(),
                                    key=lambda x: x[1]["name"]):
            val = info["value"]
            status = "  "
            if isinstance(val, (int, float)):
                if "temp" in info["name"].lower():
                    if val > 89:
                        status = "!!"
                    elif val > 75:
                        status = "! "
                elif "load" in info["name"].lower() or "usage" in info["name"].lower():
                    if val > 85:
                        status = "!!"
                    elif val > 70:
                        status = "! "
                elif "error" in info["name"].lower():
                    if val != 0:
                        status = "!!"

            print(f"  {status} {info['name']:40s} = {val}")

        print(f"\nLegend:  = normal, ! = warning, !! = critical")
        print(f"\nTimestamp: {datetime.now():%Y-%m-%d %H:%M:%S}")
        print(f"Total variables scanned: {len(all_vars)}")

asyncio.run(check_health())

SNMP-Based System Monitoring

For continuous monitoring without OPC-UA or PVI, the B&R SNMP agent exposes system variables via standard SNMP MIB:

# Install brsnmp for B&R device discovery and SNMP queries
pip install brsnmp

# Quick system health check via SNMP
brsnmp --walk 192.168.0.1

# Monitor CPU temperature via SNMP (OID varies by AR version)
snmpget -v2c -c public 192.168.0.1 1.3.6.1.4.1.2808.1.2.1

# Monitor system uptime
snmpget -v2c -c public 192.168.0.1 sysUpTime.0

See iiot-retrofit.md for full SNMP configuration and access-recovery.md for brsnmp discovery procedures.


Cross-References

Related FileRelevance
execution-model.mdTask class priority, cycle time configuration, watchdog behavior, exception codes
diagnostics-sdm.mdSDM web interface for reading all system variables without any tools
hardware-monitoring.mdPhysical temperature monitoring, fan diagnostics, voltage rail monitoring
custom-diagnostic-tools.mdBuilding diagnostic programs that run ON the PLC using system variables
python-diagnostics.mdPython + PVI/OPC-UA scripts for automated system monitoring
opcua.mdOPC-UA server configuration and address space browsing
pvi-api.mdPVI protocol for reading system data points programmatically
cp1584-forensics.mdExtracting system info from an unknown PLC via network discovery
firmware.mdAR version identification and firmware architecture
memory-map.mdCPU memory layout and direct memory access for IO data
alarm-logging.mdException and watchdog event logging
ebpf-telemetry.mdAdvanced performance profiling with eBPF (Linux-based controllers)
retentive-data.mdBattery-backed data management and battery replacement procedures
cp1584-hardware-ref.mdComplete CP1584 hardware specifications and physical indicators
troubleshooting-index.mdScenario-based index for system variable-related diagnostics
access-recovery.mdbrwatch and Pvi.py tools for no-project variable monitoring

Document generated from research across B&R official documentation, B&R Community forums, Automation Runtime training materials, X20CP158x datasheets, and field engineering sources. Applicable to X20CP1583/1584/1585/1586 and X20CP358x series with Intel Atom processors running Automation Runtime V3.0+.