CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Tue Oct 17, 2017 5:03 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Jul 28, 2016 12:00 pm 
Offline

Joined: Wed Apr 20, 2016 5:18 pm
Posts: 3
Hello,

I am fresh man hier with SPS, and I just Need to use the dynamic date type such as "Array" in C to get a Analysis of a System structure in real time in order to calculate the Safety intergrity in Codesys.

Can you please tell me, how can I use the python script or C Modul in Codesys, so that a cooperation between the codesys and the script can be organised. I've no idea how works the scriping language and the c Modul with the SPS-Tasks. It is so Kind of you, if you can Show some examples for me.

Thank you very much.

Beste regards.

Haoming


Top
   
PostPosted: Fri Jul 29, 2016 7:02 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 216
Hi Haoming.

haoming wrote:
I am fresh man hier with SPS, and I just Need to use the dynamic date type such as "Array" in C to get a Analysis of a System structure in real time in order to calculate the Safety intergrity in Codesys.

Can you please tell me, how can I use the python script or C Modul in Codesys, so that a cooperation between the codesys and the script can be organised. I've no idea how works the scriping language and the c Modul with the SPS-Tasks. It is so Kind of you, if you can Show some examples for me.

I'm a bit confused. Do you want to test the IDE or the runtime of CODESYS? Or do you want to test your PLC application on the runtime?

BR
Martin

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

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


Top
   
PostPosted: Fri Jul 29, 2016 10:02 am 
Offline

Joined: Wed Apr 20, 2016 5:18 pm
Posts: 3
Hallo Martin,

I am writing the PLC now, and I've just found that there is no way to use the dynamic Array such as which in C++ STL according to DIN 61131-3, for the question how to use the C Code in PLC I've found a Webinar on your Website, and about the python I do have no idea, how does python work with codesys, as I see, there are couple use of Python which were be postet by Markus in the Forum, they may be:
1. starting the Project in Codesys
2. creating a Project in Codesys
3. test and Export the .XML data using python from codesys

For These, I'd like to ask, the codesys do has a main Task, how does python work in the LOOP. Can it work in the main Task, so that one can Change the variables in real time? Or it can work in multi-thread. Are there any systematic Tutorien in the Forum or Webinar?

I am so sorry for These silly queastions. And thank you a lot.

Best regards


Top
   
PostPosted: Fri Jul 29, 2016 1:45 pm 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 216
Hi Haoming.

We have some examples in the CODESYS Online Help. Search for "Executing Scripts".

The Scripting API is documented in the ScriptEngine.chm in the sub directory OnlineHelp of the CODESYS installation. Search for "Tips for Python Programmers regarding .NET API Documentation" to find some help how to read the Scripting API documentation.

haoming wrote:
For These, I'd like to ask, the codesys do has a main Task, how does python work in the LOOP. Can it work in the main Task, so that one can Change the variables in real time? Or it can work in multi-thread. Are there any systematic Tutorien in the Forum or Webinar?

The scripts are executed in the main thread of CODESYS. The methods, which require the message loop to be processed, take care of that themselves.

BR
Martin

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

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


Top
   
PostPosted: Tue Aug 02, 2016 9:07 pm 
Offline

Joined: Wed May 11, 2016 7:42 pm
Posts: 11
Good evening, I am trying to execute a python script but I keep getting "'LightException' object has no attribute 'GPIO'" error message. Am I missing some kind of configuration or something?


Top
   
PostPosted: Wed Aug 03, 2016 7:31 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 216
Hi FWosniak.

FWosniak wrote:
Good evening, I am trying to execute a python script but I keep getting "'LightException' object has no attribute 'GPIO'" error message. Am I missing some kind of configuration or something?

Can you show me your code or at least which the line of code which causes the exception?

BR
Martin

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

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


Top
   
PostPosted: Thu Aug 04, 2016 7:54 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi,

haoming wrote:
For These, I'd like to ask, the codesys do has a main Task, how does python work in the LOOP. Can it work in the main Task, so that one can Change the variables in real time? Or it can work in multi-thread. Are there any systematic Tutorien in the Forum or Webinar?


Just an additional note to make it clear:

The python scripts are running in the CODESYS IDE, not on the PLC. They use the monitoring mechanism to read and write variables.

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

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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 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