Config file for c++ pcwlx libraries via IComponent::LoadSettings
In the documentation of the c++ IComponent class (IComponent and IProgram (plcnext-community.net)) it states that the function
virtual void LoadSettings(const String& settingsPath);
is called with a path to either an *.acf.config or *.plm.config configuration file.
How would one include such a configuration file in a plcnext project that is built with plcncli deploy ...
such that it is deployed correctly and its path actually gets fed into the function?
Also how could a user edit the configuration? Is it safe to just open the *.pcwlx as an archive and edit the config file?
Thanks in advance for any suggestions.
This discussion has been closed.
Comments
This is an interesting question.
Firstly:
In the documentation of the c++ IComponent class (IComponent and IProgram (plcnext-community.net)) it states that the function
virtual void LoadSettings(const String& settingsPath);
is called with a path to either an *.acf.config or *.plm.config configuration file.
This is not quite what the Info Center says - the Info Center says:
The path to the settings (settingsPath) can be specified for the respective component instance in its *.acf.config or *.plm.config configuration file.
(Note that the
settingsPath
parameter is simply a string, and can be interpreted by theLoadSettings
function implementation any way it wants).So, that parameter is not a path to an *.acf.config or *.plm.config configuration file. Instead, the value of that parameter must be specified in the *.acf.config or *.plm.config configuration file. For ACF projects this is easy, because the
.acf.config
file is included in the source files for the project.But it turns out that this is not so easy for a PLM project that is deployed as a PLCnext Engineer library. The
.plm.config
file is not included in the template that is used to create the PLM project. Instead, that file is created as part of the "deploy" step and bundled into the PLCnext Engineer library without the user ever seeing it. This makes it impossible for the user to (easily) edit the.plm.config
file before it is packaged into the PLCnext Engineer library.One possibility is to edit the
.plm.config
file after it is copied to the PLC, but this is not a great solution for a number of reasons.As you suggest, you could try editing the
.plm.config
file in the.pcwlx
archive - I have never tried this, but it might just work.There is an example in Github showing how to to deploy a PLM project manually, without using the PLCnext Engineer library:
https://github.com/PLCnext/CppExamples/blob/master/Examples/NoEngineer/README.MD
That example includes a sample
.plm.config
file that could be edited to include the value of the settingsPath parameter that is passed to theLoadSettings
method.In short: The Info Center gives the correct information about PLM projects, but PLCnext Engineer has removed the ability for users to make use of this feature. I will raise this issue with the PLCnext Engineer developers, and see if there are plans to fix this.
So, that parameter is not a path to an *.acf.config or *.plm.config configuration file. Instead, the value of that parameter must be specified in the *.acf.config or *.plm.config configuration file.
Thanks, I should have read that more carefully...
The
.pcwlx
archive (at least mine) does not contain any*.plm.config
, instead it seems the PLCnext Engineer generates a globalpcwe.plm.config
for all libraries in the project, which (to my knowledge) I cannot influence or provide a settings path for.This generated file however links to all relevant project files by the environment variable
$ARP_PROJECT_CURRENT_DIR$
. Its value in turn can be read byArp::System::Commons::Environment::GetVariableValue(...)
and results to/opt/plcnext/projects/current
.From there I can build my own path to my custom settings file, that I have included via the
plcncli deploy --files ...
option into the project.Also I have not encountered problems with editing my custom config file within the
.pcwlx
archive, even though there seems to be a file within the archive (@IntegrityData@.xml
) containing file hashes of some sort.Anyways thanks again for your detailed answer
I have finally received an answer from the PLCnext Engineer development team.
This is a new requirement, so a new feature request has been created. Unfortunately I cannot say if/when this feature will appear in PLCnext Engineer. If this is an important feature for you, please get in touch with your sales contact in your local Phoenix Contact office.