bevanweiss
Member
I'm currently working on an MES interface PLC which passes around a whole bunch of strings.
A lot of these strings are really just to allow for an identically named tag from a UDT to be put into a telegram and sent up to the MES.
i.e. there will be a UDT of 'ProcessValues' for a 'ProcessValue Telegram', one of the fields in this UDT will be 'TotalProductionCount'.
The telegram that is then sent to the MES will be something like
... header stuff ...
...
TOTALPRODUCTIONCOUNT: 954
...
What would have been really nice (both for code readability, memory usage etc etc) would have been if the UDTs could almost directly feed into the telegrams, so that it would have been possible to do like:
GSV (TagName, OutputTagNameString)
TelegramString := CONCAT(TelegramString, OutputTagNameString);
TelegramString := CONCAT(TelegramString, ": ");
DTOS(TagName, ValueString);
TelegramString := CONCAT(TelegramString, ValueString);
(which could have been wrapped up in an AOI to serialise our datatypes)
And that would get the tagname (ideally able to retrieve only the bit of importance, like the UDT field name portion).
At the moment there is a system where we keep the telegram format as a pre-made STRING and then have a loop to go through the number of elements in each UDT and populate the right locations in the telegram with the right data from the UDT fields (having to take into account formatting conversions etc).
These strings are obviously floating around in the controller in some manner already (maybe..) for the Tag Based CIP addressing thing to work (unless that purely works based on MD5/et al signatures, which would be a bit weird).
A lot of these strings are really just to allow for an identically named tag from a UDT to be put into a telegram and sent up to the MES.
i.e. there will be a UDT of 'ProcessValues' for a 'ProcessValue Telegram', one of the fields in this UDT will be 'TotalProductionCount'.
The telegram that is then sent to the MES will be something like
... header stuff ...
...
TOTALPRODUCTIONCOUNT: 954
...
What would have been really nice (both for code readability, memory usage etc etc) would have been if the UDTs could almost directly feed into the telegrams, so that it would have been possible to do like:
GSV (TagName, OutputTagNameString)
TelegramString := CONCAT(TelegramString, OutputTagNameString);
TelegramString := CONCAT(TelegramString, ": ");
DTOS(TagName, ValueString);
TelegramString := CONCAT(TelegramString, ValueString);
(which could have been wrapped up in an AOI to serialise our datatypes)
And that would get the tagname (ideally able to retrieve only the bit of importance, like the UDT field name portion).
At the moment there is a system where we keep the telegram format as a pre-made STRING and then have a loop to go through the number of elements in each UDT and populate the right locations in the telegram with the right data from the UDT fields (having to take into account formatting conversions etc).
These strings are obviously floating around in the controller in some manner already (maybe..) for the Tag Based CIP addressing thing to work (unless that purely works based on MD5/et al signatures, which would be a bit weird).