Evaluate the AutomationView desktop suite free for 30 days. No credit card required. Claim trial key →
arrow_back Back to Articles

Inside AutomationView: Implementing GEMMA for Master State Coordination in PLC Sequences

calendar_month
person Carvalho Raphael

Inside AutomationView: Implementing GEMMA for Master State Coordination in PLC Sequences

AutomationView
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    A[GEMMA PC] -->|State Coordination| B[AutomationView]
    B -->|SFC Logic| C[PLC Hardware]
    B -->|Python Sim| D[Digital Twin]
    style A fill:#0d47a1,stroke:#1e88e5,stroke-width:2px,color:#fff
    style B fill:#1b5e20,stroke:#4caf50,stroke-width:2px,color:#fff
    style C fill:#424242,stroke:#757575,stroke-width:2px,color:#fff
    style D fill:#4a148c,stroke:#9c27b0,stroke-width:2px,color:#fff
AutomationView Icon AutomationView

Key Takeaways:

  • The GEMMA framework provides a standardized visual approach to managing machine states beyond normal production (stops, faults, preparations).
  • Integrating GEMMA directly into your AutomationView GEMMA implementation bridges the gap between high-level operational modes and low-level Sequential Function Charts (SFC).
  • By decoupling the master state logic from the physical actuators, engineers achieve significantly more robust and maintainable PLC architectures.

Most automation projects start with a pristine, linear sequence of operations. The machine starts, it performs its task, and it stops. But on the actual plant floor, operators hit emergency stops mid-cycle, sensors fail unpredictably, and maintenance teams require manual jogging of individual actuators. If your PLC logic relies purely on a single, monolithic SFC to handle all these edge cases, you are building a fragile “spaghetti” architecture. This is where the GEMMA (Guide d’Etude des Modes de Marche et d’Arrêt) comes into play.

The Paradox of “Normal” Operation

In industrial automation, “normal” operation is often the exception rather than the rule. A machine spends a vast amount of its lifecycle in transitional states: starting up, winding down, clearing jams, or running in degraded modes. Traditional SFC/Grafcet is excellent for defining step-by-step logic, but it struggles to cleanly express global state overrides. If you try to wire every possible fault condition into the transitions of your main production sequence, the chart becomes unreadable and prone to deadlocks.

The GEMMA methodology, originally developed in 1981 by ADEPA, solves this by defining three families of procedures for a powered system: F (Fonctionnement/Operation), A (Arrêt/Stop), and D (Défaillance/Failure). It provides a master coordination layer.

Structuring the GEMMA Layer in AutomationView

In AutomationView, you can elegantly implement this two-tiered architecture. Because AutomationView supports hierarchical SFCs (macro-steps) and Python-based sequence design, you can construct a “Master GEMMA Sequence” that oversees your localized “Operating Sequences”.

The Master-Slave Architecture

Instead of mixing state logic with actuator logic, the Master GEMMA SFC simply evaluates the current operational mode and sets global boolean flags (e.g., Mode_Auto, Mode_Manual, Fault_Active). The localized SFCs (the “slaves”) listen to these flags. If Fault_Active goes high, the localized SFC immediately forces itself into a safe macro-step, regardless of what it was currently doing.

stateDiagram-v2
    [*] --> Off: Power Down
    Off --> Initialization: Power On
    Initialization --> Production: Start Pressed
    Production --> Fault: Sensor Error
    Fault --> Manual: Reset Pressed
    Manual --> Initialization: Homing Complete
    
    state Production {
        [*] --> Filling
        Filling --> Sealing
        Sealing --> [*]
    }

This decoupling is critical. In the field, a failing analog level sensor might trigger a high-priority interrupt. If that interrupt logic is buried inside the “Filling” step, it’s hard to trace. By lifting it to the GEMMA layer, the system state is immediately visible during troubleshooting.

Comparing State Management Approaches

Feature Monolithic SFC GEMMA + Hierarchical SFC
Fault Handling Complex transition logic at every step Global state override forcing safe macro-steps
Readability Poor (spaghetti transitions) Excellent (clean separation of concerns)
Virtual Commissioning Difficult to simulate edge cases Easy to inject faults via Python in AutomationView
Maintenance High risk of introducing new bugs Modular; changes are isolated

Leveraging Python for State Validation

One of the most powerful features of an AutomationView GEMMA implementation is the ability to use Python to validate state transitions. During virtual commissioning, you can script simulated edge cases—such as randomly dropping the air pressure signal—to ensure the Master GEMMA SFC correctly transitions from the F1 (Normal Production) state to the D1 (Emergency Stop) state, and that all slave SFCs react accordingly within the required cycle time.

Conclusion

Structuring large-scale PLC projects requires moving beyond simple step-by-step logic. By integrating the GEMMA framework as a master coordination layer above your detailed SFCs, you create resilient, maintainable, and self-documenting code. AutomationView’s hierarchical design and Python simulation capabilities make it the perfect environment to architect and test these advanced control strategies before they ever reach the physical hardware.

FAQ

What is the difference between GEMMA and SFC?

SFC (Sequential Function Chart) defines the specific, step-by-step logic of a process (e.g., Open Valve, Wait 5s, Close Valve). GEMMA is a higher-level state machine that defines the global operating modes of the entire machine (e.g., Auto, Manual, Emergency Stop) and dictates which SFCs should be active.

Can GEMMA be applied to non-manufacturing systems?

Yes. While it was designed for manufacturing, the principles of defining Normal, Stop, and Fault states are universally applicable to any automated system, including process control, HVAC, and intralogistics.

How does AutomationView handle emergency stops?

While software-based GEMMA logic handles the orderly shutdown and state transition of the sequences, critical safety interlocks (like Emergency Stops) should always be hardwired or handled by a dedicated Safety PLC (SIL/PL rated) in parallel.

Share this article

Stay Updated with AutomationView

Get the latest articles and news delivered directly to your inbox.

Log in to Subscribe

You must be registered and logged in to manage subscriptions.

Recommended for you

Inside AutomationView: Implementing IEC 60848 Macro-Steps

AutomationView
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    M1["Macro-Step (M1)"]:::blueNode --> T1["Transition"]:::grayNode
    T1 --> E1["Enclosure (E1)"]:::greenNode
    
    classDef blueNode fill:#2563eb,stroke:#1d4ed8,color:#ffffff
    classDef grayNode fill:#6b7280,stroke:#4b5563,color:#ffffff
    classDef greenNode fill:#16a34a,stroke:#15803d,color:#ffffff
AutomationView Icon AutomationView
calendar_month

Inside AutomationView: Implementing IEC 60848 Macro-Steps

Key Takeaways Macro-steps hide sub-process complexity by encapsulating detailed expansions with strict single-input/single-output rules. Enclosures manage hierarchical state, controlling the activation of subordinate sub-GRAFCETs dynamically. AutomationView enforces these IEC 60848 rules natively, preventing race conditions in large-scale sequential logic. When an automation project scales beyond a few dozen states, a flat Sequential Function Chart (SFC) […]

Read Article arrow_forward

Inside AutomationView: Using Python to Procedurally Generate Complex SFC Sequences

AutomationView
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    A["Python Script"]:::blue --> B["AutomationView API"]:::green
    B --> C["Generated SFC / Grafcet"]:::red
    classDef blue fill:#2563eb,stroke:#1e40af,color:#ffffff
    classDef green fill:#16a34a,stroke:#166534,color:#ffffff
    classDef red fill:#dc2626,stroke:#991b1b,color:#ffffff
AutomationView Icon AutomationView
calendar_month

Inside AutomationView: Using Python to Procedurally Generate Complex SFC Sequences

Generating large, highly parameterized SFC (Sequential Function Chart) sequences by hand can quickly become a bottleneck in PLC engineering. Inside AutomationView: Using Python to Procedurally Generate Complex SFC Sequences explores how to eliminate manual drafting by utilizing the AutomationView Python API to script logic programmatically. The Paradox of Manual Sequence Design Modern machine builders often […]

Read Article arrow_forward

Inside AutomationView: Architecting Custom Python Simulation Models for Virtual Commissioning

AutomationView
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    subgraph automationview ["AutomationView IDE"]
        SFC["SFC Logic"]:::blue
        PY["Python Sim Model"]:::green
    end
    subgraph execution ["Validation Environment"]
        SIL["Software-in-the-Loop"]:::purple
        HIL["Hardware-in-the-Loop"]:::red
    end
    SFC -->|Validates| PY
    PY -->|Exports| SIL
    SIL -->|Tests| HIL
    classDef blue fill:#2563eb,color:#ffffff,stroke-width:0px;
    classDef green fill:#16a34a,color:#ffffff,stroke-width:0px;
    classDef purple fill:#9333ea,color:#ffffff,stroke-width:0px;
    classDef red fill:#dc2626,color:#ffffff,stroke-width:0px;
AutomationView Icon AutomationView
calendar_month

Inside AutomationView: Architecting Custom Python Simulation Models for Virtual Commissioning

Commissioning industrial control systems on the factory floor is notoriously fraught with delays. Hardware arrives late, field wiring requires troubleshooting, and unexpected edge cases in PLC code only surface when mechanical components fail to behave as assumed. Virtual commissioning mitigates these risks, but connecting proprietary logic environments to dynamic physical models often requires complex middleware. […]

Read Article arrow_forward