Skip to content

Code Generator ‐ Configuration File Guide

Zeus Castillo edited this page Mar 23, 2026 · 5 revisions

The configuration file is a JSON file containing two types of data:

  1. the Sec Node structure (in the same format as the SEC Node would return in reply to a describe message)
  2. extra PLC information (also referenced throughout the documentation as PLC-tooling data or x-plc parameters) required by the code generator to generate PLC code, initialise the SEC Node correctly, and map process data to the SECoP layer correctly in real time

These two types of data live together in the same JSON tree. In other words, under each SECoP object, an extra x-plc object may be added to provide the additional PLC information required for that object.

The x-plc parameters exist at two levels:

  • SEC Node level: (<node>).x-plc
  • Module level: (<module>).x-plc

This page documents all x-plc parameters currently supported by the SECoP PLC code generator.

Each parameter is described using the following fields:

  1. Type — data type as defined in the configuration model
  2. When it applies — conditions under which the parameter is relevant
  3. Purpose — what the parameter represents and why it is needed
  4. Example value — taken from the demo configuration file when available
  5. Where it is used and how — reference to the generated PLC code (PRG / FB) and how the parameter is used

For concrete examples, refer to the configuration file of the demo project


1. SEC Node-level x-plc parameters

(<node>).x-plc.tcp.server_ip

  1. Type
    string containing an IP address

  2. When it applies
    Always

  3. Purpose
    IP address used by the SEC Node TCP server.

  4. Example value
    "192.168.1.10"

  5. Where it is used and how
    Used in PRG SecopInit:
    SECOP.GVL.G_st_SecNode.sTcpServerIp := '192.168.1.10';


(<node>).x-plc.tcp.server_port

  1. Type
    integer

  2. When it applies
    Always

  3. Purpose
    TCP server port used by the SEC Node.

  4. Example value
    10767

  5. Where it is used and how
    Used in PRG SecopInit:
    SECOP.GVL.G_st_SecNode.uiTcpServerPort := 10767;


(<node>).x-plc.tcp.interface_healthy_tag

  1. Type
    string containing a boolean expression

  2. When it applies
    Always

  3. Purpose
    PLC expression indicating whether the TCP interface is ready.

  4. Example value
    "G_stStatusPlc.G_xEthReady_If2"

  5. Where it is used and how
    Used in PRG SecopMapFromPlc:
    SECOP.GVL.G_st_SecNode.xTcpServerInterfaceReady := G_stStatusPlc.G_xEthReady_If2;


(<node>).x-plc.secop_version

  1. Type
    string

  2. When it applies
    Always

  3. Purpose
    SECoP protocol version used by the SEC Node, visible on the "describing" message

  4. Example value
    "V2019-09-16"

  5. Where it is used and how
    Used in PRG SecopInit:
    SECOP.GVL.G_st_SecNode.sSecopVersion := 'V2019-09-16';


(<node>).x-plc.plc_timestamp_tag

  1. Type
    Time string in Fractional Unix Time, like “1774003270.228”

  2. When it applies
    Always

  3. Purpose
    PLC timestamp used at SEC Node level.

  4. Example value
    "G_stStatusPlc.sSecSinceJan1970Hr"

  5. Where it is used and how
    Used in PRG SecopMapFromPlc:
    SECOP.GVL.G_st_SecNode.sTimestamp := G_stStatusPlc.sSecSinceJan1970Hr;


2. Module-level x-plc parameters

(<module>).x-plc.timestamp_tag

  1. Type
    Time string in Fractional Unix Time, like “1774003270.228”

  2. When it applies
    Always

  3. Purpose
    Timestamp used at module level. Provide the best you can e.g. if the module data is retrieved from an OPC UA connection, use the timestamp provided by the OPC UA server. If you can't retrieve an accurate timestamp from the data source, just use the actual PLC time to provide it.

  4. Example value
    "G_stStatusPlc.sSecSinceJan1970Hr"

  5. Where it is used and how
    Used in PRG SecopMapFromPlc:
    GVL_SecNode.G_st_mf.sTimestamp := G_stStatusPlc.sSecSinceJan1970Hr;


3. Value mapping

(<module>).x-plc.value.read_expr

  1. Type
    string

  2. When it applies
    Numeric or string modules

  3. Purpose
    PLC expression to read the process value. Use format conversion functions if needed

  4. Example value
    "REAL_TO_LREAL(G_rMf)"

  5. Where it is used and how
    Used in PRG SecopMapFromPlc:
    GVL_SecNode.G_st_mf.lrValue := REAL_TO_LREAL(G_rMf);


(<module>).x-plc.value.enum_tag

  1. Type
    string containing an enum tag

  2. When it applies
    Enum modules

  3. Purpose
    PLC variable containing enum state.

  4. Example value
    "G_iHeatSwitchStatus"

  5. Where it is used and how
    Used in PRG SecopMapFromPlc:

    CASE G_iHeatSwitchStatus OF

    0: GVL_SecNode.G_st_heatswitch.etValue := ET_Module_heatswitch_value.Off;

    1: GVL_SecNode.G_st_heatswitch.etValue := ET_Module_heatswitch_value.On;

    END_CASE


(<module>).x-plc.value.outofrange_min

  1. Type
    same as parameter "value"

  2. When it applies
    Numeric modules. Optional. Configure it if we need out of range errors to be generated.

  3. Purpose
    Lower out-of-range setpoint.

  4. Example value
    -25

  5. Where it is used and how
    Used in SecopInit:

    GVL_SecNode.G_st_mf.lrValueOutOfRangeL := -25;

    Used in module FB:

    // Return "OutOfRange" error

    IF (iq_lrValue < iq_lrValueOutOfRangeL OR iq_lrValue > iq_lrValueOutOfRangeH) THEN ...


(<module>).x-plc.value.outofrange_max

  1. Type
    same as parameter "value"

  2. When it applies
    Numeric modules. Optional. Configure if we need out of range errors to be generated.

  3. Purpose
    Upper out-of-range setpoint.

  4. Example value
    25

  5. Where it is used and how
    Used in SecopInit:

    GVL_SecNode.G_st_mf.lrValueOutOfRangeL := 25;

    Used in module FB:

    // Return "OutOfRange" error

    IF (iq_lrValue < iq_lrValueOutOfRangeL OR iq_lrValue > iq_lrValueOutOfRangeH) THEN ...


4. Status mapping

(<module>).x-plc.status.disabled_expr

  1. Type
    string containing a boolean expression

  2. When it applies
    When status DISABLED exists

  3. Purpose
    Disabled condition.

  4. Example value
    "G_xMfInMaintenance"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    IF G_xMfInMaintenance THEN ...


(<module>).x-plc.status.disabled_description

  1. Type
    string

  2. When it applies
    When status DISABLED exists

  3. Purpose
    Disabled description.

  4. Example value
    "Cryomagnet in maintenance mode"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    GVL_SecNode.G_st_mf.stErrorReport.sDescription := 'Cryomagnet in maintenance mode';


(<module>).x-plc.status.comm_error_expr

  1. Type
    string containing a boolean expression

  2. When it applies
    Optional

  3. Purpose
    Communication error condition.

  4. Example value
    "G_xTc1CommsError"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    IF G_xTc1CommsError THEN ...


(<module>).x-plc.status.comm_error_description

  1. Type
    string

  2. When it applies
    Optional

  3. Purpose
    Communication error description.

  4. Example value
    "Temperature controller 1 - Communication fault"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    GVL_SecNode.G_st_tc1.stErrorReport.sDescription := 'Temperature controller 1 - Communication fault';


(<module>).x-plc.status.hw_error_expr

  1. Type
    string containing a boolean expression

  2. When it applies
    Optional

  3. Purpose
    Hardware error condition.

  4. Example value
    "G_xMfHwError"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    IF G_xMfHwError THEN ...


(<module>).x-plc.status.hw_error_description

  1. Type
    string

  2. When it applies
    Optional

  3. Purpose
    Hardware error description.

  4. Example value
    "Cryomagnet fault"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    GVL_SecNode.G_st_mf.stErrorReport.sDescription := 'Cryomagnet in maintenance mode';


5. Target mapping

(<module>).x-plc.target.write_stmt

  1. Type
    string containing an assignment statement

  2. When it applies
    Numeric or String. Writable or Drivable.

  3. Purpose
    Write TargetChangeNewVal to PLC process tag.

  4. Example value
    "G_rMfSetpoint := LREAL_TO_REAL(GVL_SecNode.G_st_mf.lrTargetChangeNewVal)"

  5. Where it is used and how
    Used in SecopMapToPlc:

    IF fbRtrigApplyTarget_mf.Q THEN

    G_rMfSetpoint := LREAL_TO_REAL(GVL_SecNode.G_st_mf.lrTargetChangeNewVal);


(<module>).x-plc.target.enum_tag

  1. Type
    string containing an enum tag

  2. When it applies
    Enum. Writable or Drivable.

  3. Purpose
    Write TargetChangeNewVal to PLC process tag.

  4. Example value
    "G_iHeatSwitchCmd"

  5. Where it is used and how
    Used in SecopMapToPlc:

    IF fbRtrigApplyTarget_heatswitch.Q THEN

    CASE GVL_SecNode.G_st_heatswitch.etTargetChangeNewVal OF

      `   0: G_iHeatSwitchCmd :=ET_Module_heatswitch_value.Off;`
    
      `   1: G_iHeatSwitchCmd :=ET_Module_heatswitch_value.On;`
    

    END_CASE


(<module>).x-plc.target.change_possible_expr

  1. Type
    string containing a boolean expression

  2. When it applies
    Writable or Drivable

  3. Purpose
    Interlock condition for applying a new target value

  4. Example value
    "NOT G_xEquipLockedInLocal AND G_xRemoteSecopEnabled"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    // Target change interlock

    GVL_SecNode.G_st_mf.stTargetWrite.xPossible := NOT G_xEquipLockedInLocal AND G_xRemoteSecopEnabled;


(<module>).x-plc.target.reach_timeout_s

  1. Type
    integer (number of seconds)

  2. When it applies
    Drivable

  3. Purpose
    Timeout for reaching target.

  4. Example value
    300

  5. Where it is used and how
    Used in SecopInit:

    GVL_SecNode.G_st_mf.stTargetDrive.timTimeout := T#300S;


(<module>).x-plc.target.reach_abs_tolerance

  1. Type
    numeric

  2. When it applies
    Numeric Drivable

  3. Purpose
    Target tolerance.

  4. Example value
    0.1

  5. Where it is used and how
    Used in SecopInit:

    GVL_SecNode.G_st_mf.lrTargetDriveTolerance := 0.1;


6. Commands

(<module>).x-plc.clear_errors.cmd_stmt

  1. Type
    string containing PLC logic

  2. When it applies
    When clear_errors exists. Optional

  3. Purpose
    Extra PLC logic when clearing errors.

  4. Example value
    "IF G_xRemoteSecopEnabled AND NOT G_xEquipLockedInLocal THEN G_xDefaultAck := TRUE; END_IF"

  5. Where it is used and how
    Used in SecopMapToPlc:

    // Apply "clear_errors" command

    IF GVL_SecNode.G_st_mf.xClearErrors THEN

    GVL_SecNode.G_st_mf.stErrorReport.xActive := FALSE;

    GVL_SecNode.G_st_mf.stErrorReport.sClass := '';

    GVL_SecNode.G_st_mf.stErrorReport.sDescription := '';

    IF G_xRemoteSecopEnabled AND NOT G_xEquipLockedInLocal THEN G_xDefaultAck := TRUE; END_IF

    END_IF


7. Custom parameters

(<module>).x-plc.custom_parameters.<param>.read_expr

  1. Type
    string

  2. When it applies
    Numeric or string customised parameter

  3. Purpose
    Read custom parameter value

  4. Example value
    "G_sTc1ChannelATempSensorId"

  5. Where it is used and how
    Used in SecopMapFromPlc:

    // _sensor

    GVL_SecNode.G_st_tc1.s_Sensor := G_sTc1ChannelATempSensorId;


(<module>).x-plc.custom_parameters.<param>.enum_tag

  1. Type
    string

  2. When it applies
    Enum customised parameter

  3. Purpose
    Enum mapping.

  4. Example value "plc_tag_for_enum_custom_param"

  5. Where it is used and how Used in SecopMapFromPlc:

    CASE plc_tag_for_enum_custom_param OF

    value0: GVL_SecNode.G_st_moduleclass.et_customparam := ET_Module_moduleclass_customparam.key0;

    value1: GVL_SecNode.G_st_moduleclass.et_customparam := ET_Module_moduleclass_customparam.key1;

    ...

    END_CASE

Clone this wiki locally