Q: What is the difference between a Template definition and instance?
A: There are two parts to a Template
Template Definition
This metric will will contain all the member Metrics with their default values/properties,
as well as any Parameters with their default values. This metric is always only published
in the NBIRTH message
Template Instance This metric is one or more "instances" of the above definition. It will contain the any member metrics with values/properties that are overridden/different from the defaults in the Template Definition. They are published as you would normal tags (BIRTH/DAT/CMD). When published in a NDATA/DDATA/NCMD/DCMD message they may only contain a subset of the member Metrics (if those are the only values that have changed) Other template fields isdefinition True for a Template Definition metric, False for a Template Instance Metric templateref This is used by a Template Instance to specify the "name" of the Template Definition ishistorical Used to mark a Template Instance (or any Metric) as a historical (rather than a live) value. MQTT Engine may handle historical Metrics differently depending on how it is configured (see MQTT Engine documentation) istransient Not currently used, will be ignored by MQTT Engine, can be omitted or set to false version Not currently used, will be ignored by MQTT Engine, can be omitted or set to null
This template_samples.txt (see attachment) contains some sample template structures (in JSON) as well as some Java code for creating a Template. These should help show the basic Template structure and contain the important fields of a Template Definition and Instance. However, they are just references expressed in JSON, not actual protobuf representations (which may be a bit more verbose)
Diff:
Diff:
Diff:
Diff:
So in CODESYS land, Template Definition = Struct definition OR FB definition
Template instance = struct instance or FB instance
Nice work