Custom building

Config variables

PLC configuration YAML is pre-processed as Tera template which means it can contain logic blocks and variables.

E.g. let us define Modbus path with a variable in a Modbus I/O block:

# .....
  - id: modbus1
    kind: modbus
      proto: tcp
      path: "{{ modbus1_path }}"

Assigning the variables

If defined in PLC config, all the variables must be assigned otherwise the builder stops with an error. To assign the variables, put the following code into

fn main() {
    let mut builder = rplc::builder::Builder::new("plc.yml");
    builder.insert("modbus1_path", "");