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

copy online parameters to offline parameters

Anonymous
2017-01-31
2017-05-31
  • Anonymous - 2017-01-31

    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

    IMG: Python.png

     
  • mkeller - 2017-02-01

    Hi Kevin.

    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.

    Here some untested code:

    if data.can_access_online:
    Β  Β val = data.read_online_value()
    Β  Β data.value = val
    

    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]

     
  • Anonymous - 2017-03-01

    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

    IMG: Fehler.PNG

     
  • Anonymous - 2017-03-02

    Originally created by: Steffen_R.

    Perfect!!
    Thank you very much... That helps me

    Steffen

     
  • 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

     

Log in to post a comment.