GCtrl: General Controls

A high-level programming language and IDE for control engineers.

General Controls: The Future of Control System Programming

General Controls (GC) is a visual-first, high-level programming language designed to help control engineers efficiently develop and deploy control logic on any processing unit. It eliminates the inefficiencies of low-level, fragmented codebases and enables structured, scalable automation.

🚨 The Problem

🚀 The Solution

📈 Why Now?

Code Example

The following code example implements a thermostat control system:

Screenshot of GCtrl IDE
namespace gctrl {
    function logistic {
        input float x;
        output float control_signal;

        operation {
            control_signal = 1.0 / (1.0 + exp(-x));
        }
    }

    element low_pass_filter {
        input float current_value;
        input float smoothing_factor;
        output float filtered;
        memory float previous_value = 0.0;

        operation {
            filtered = smoothing_factor * current_value 
                + (1.0 - smoothing_factor) 
                * previous_value;
            previous_value = filtered;
        }
    }

    element thermal_regulator {
        input float setpoint;
        input float temperature;
        output float heating;
        output float cooling;
        memory float error;

        operation {
            error = setpoint - temperature;
            heating = logistic(error) * max(0.0, error);
            cooling = logistic(error) * max(0.0, -error);
        }
    }

    element humidity_regulator {
        input float setpoint;
        input float humidity;
        output float command;
        memory float error;

        operation {
            error = setpoint - humidity;
            command = logistic(error) * max(0.0, error);
        }
    }

    controller thermal_controller {
        element thermal_regulator thermal;
        element low_pass_filter lpfc;

        connection thermal.setpoint -> lpfc.filtered;
        connection lpfc.current_value -> thermal.temperature;
    }

    controller humidity_controller {
        element humidity_regulator humid;
        element low_pass_filter lpfh;

        connection humid.setpoint -> lpfh.filtered;
        connection lpfh.current_value -> humid.humidity;
    }

    machine thermostat {
        controller thermal_controller tc;
        controller humidity_controller hc;

        connection tc.heating -> hc.command;
    }
}