Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
KevinR hat geschrieben:
can I copy all online parameters to the offline parameters with a python script?
A device parameter or data element in Scripting has the property "can_access_online" so you can check if it supports the online mode. If it is supported you can read the current value with the method "read_online_value(...)". If a timeout of 1000ms is enough to read the value from the PLC you can use the method without specifing that parameter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-03-02
Originally created by: Steffen_R.
Perfect!!
Thank you very much... That helps me
Steffen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-05-31
Originally created by: KevinR
Hi Martin,
I'm still looking for a solution, to get this to work.
First of all - Thank you for updating the example. The example still doesn't work for me, during I'm in the online mode.
I stay in contact with one of your colleague, who has also added the issue to jira (CDS-54028).
It seems like there is a problem with "read_online_value".
This functionality has a very high importance for us. So maybe there are also some other customers who have this requirement.
Thank you in advance.
BR
KevinR
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Originally created by: KevinR
Dear Community,
can I copy all online parameters to the offline parameters with a python script?
This will give me the opportunity to save the current online configuration values to my offline project file.
Visual concept:
Thank you in advance
Regards,
Kevin
Hi Kevin.
A device parameter or data element in Scripting has the property "can_access_online" so you can check if it supports the online mode. If it is supported you can read the current value with the method "read_online_value(...)". If a timeout of 1000ms is enough to read the value from the PLC you can use the method without specifing that parameter.
Here some untested code:
I also added a simple python script which prints the parameter tree to the Message view and change the value of one parameter.
BR
Martin
device_show_and_change_parameters.py [1.65 KiB]
Originally created by: Steffen_R.
Hi Martin,
i tried running the script but it does not work correctly. The attached picture shows the error. I think it is line 15 in the script.
Thank you
Steffen
Hi Steffen_R.
I fixed it.
BR
Martin
device_show_and_change_parameters.py [1.71 KiB]
Originally created by: Steffen_R.
Perfect!!
Thank you very much... That helps me
Steffen
Originally created by: KevinR
Hi Martin,
I'm still looking for a solution, to get this to work.
First of all - Thank you for updating the example. The example still doesn't work for me, during I'm in the online mode.
I stay in contact with one of your colleague, who has also added the issue to jira (CDS-54028).
It seems like there is a problem with "read_online_value".
This functionality has a very high importance for us. So maybe there are also some other customers who have this requirement.
Thank you in advance.
BR
KevinR