wrps-demo-kit/03-plc/as-built/pou_FB_LEVEL_CTRL.cpp
Clio Liu 55279ca78f docs(plc): as-built copy, versions, and a getting-started guide
Adds what the folder was missing for someone picking it up cold.

as-built/  the STruC++ output copied out of the live container - the C++
           the PLC is actually executing, plus program.st and the Modbus
           buffer config. The running image was made with docker commit
           and exists in no registry, so this is the only other copy of
           the compiled form.

           Verified while copying: the deployed program.st matches
           build/wrps.st generated from src/. Identical POU structure,
           ZERO differences in non-declaration lines. src/ is genuinely
           canonical and the running PLC agrees with it.

VERSIONS.md         every version read from the running system, not from
                    documentation: runtime v4.1.10, STruC++ 0.6.2, Editor
                    4.2.11, Debian 12, g++ 12.2, pymodbus 3.11.2, CI
                    Server R1.03. Plus which plugins are enabled -
                    ethercat is on for no reason - and a v3-vs-v4 table,
                    since most OpenPLC guidance online is for v3 and the
                    %MW HR1024 change silently produces wrong data.

GETTING-STARTED.md  three questions answered in a page: how to modify the
                    program, how to stand up a new PLC container from
                    scratch, how to move this one. Includes the compose
                    file, the Editor steps that are not generated and are
                    always missed, and a symptom-to-document table.
2026-09-02 16:48:30 +10:00

43 lines
No EOL
1.1 KiB
C++

// Generated by STruC++ - IEC 61131-3 Structured Text to C++ Compiler
// Do not edit this file manually.
#include "generated.hpp"
namespace strucpp {
FB_LEVEL_CTRL::FB_LEVEL_CTRL()
: SCAN_S(0.1), KP(12.0), TI(120.0), INTEG(38.0)
{
// Initialize variables
}
void FB_LEVEL_CTRL::operator()() {
if (!ENABLE) {
INTEG = MINSPEED;
SPEED = MINSPEED;
} else {
ERR = LEVEL - SETPOINT;
RAW = KP * ERR + INTEG;
INTEGRATE = false;
if (((RAW > MINSPEED)) & ((RAW < MAXSPEED))) {
INTEGRATE = true;
} else if (((RAW >= MAXSPEED)) & ((ERR < 0.0))) {
INTEGRATE = true;
} else if (((RAW <= MINSPEED)) & ((ERR > 0.0))) {
INTEGRATE = true;
}
if (INTEGRATE) {
INTEG = INTEG + (KP / TI) * ERR * SCAN_S;
}
RAW = KP * ERR + INTEG;
if (RAW > MAXSPEED) {
SPEED = MAXSPEED;
} else if (RAW < MINSPEED) {
SPEED = MINSPEED;
} else {
SPEED = RAW;
}
}
}
} // namespace strucpp