CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Mon May 22, 2017 10:31 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Jan 31, 2017 6:24 pm 
Offline
User avatar

Joined: Tue Jun 28, 2016 2:45 pm
Posts: 27
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:
Attachment:
Python.png


Thank you in advance

Regards,
Kevin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Wed Feb 01, 2017 2:22 pm 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 192
Hi Kevin.

KevinR wrote:
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:
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


You do not have the required permissions to view the files attached to this post.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Wed Mar 01, 2017 2:49 pm 
Offline

Joined: Thu Feb 23, 2017 2:54 pm
Posts: 13
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


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Thu Mar 02, 2017 3:11 pm 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 192
Hi Steffen_R.

I fixed it.

BR
Martin


You do not have the required permissions to view the files attached to this post.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Thu Mar 02, 2017 3:21 pm 
Offline

Joined: Thu Feb 23, 2017 2:54 pm
Posts: 13
Perfect!!
Thank you very much... That helps me

Steffen


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited