CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed Oct 16, 2019 11:22 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Mar 26, 2019 12:24 pm 
Offline

Joined: Thu May 04, 2017 9:55 am
Posts: 1
Good day All,

I am currently busy with a project where I need to run a python script from a condition/trigger in my SoMachine (CoDeSys) project.

I was wondering if anyone could maybe inform me on a way to execute the file in Structured Text. Also I added the python file in my program (see attached). Keep in mind that it needs to execute while running on the PLC and the script might be executed multiple times in the program.

I would appreciate any help or advice.

Kind regards
Markus Oosthuizen


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


Top
   
PostPosted: Tue Mar 26, 2019 2:44 pm 
Offline

Joined: Sun Oct 29, 2017 10:50 am
Posts: 1
I am also trying to run a python script inside a schneider m251 plc but haven't figured how yet. The script runs perfectly on my pc.
Can anyone give a tip?
The python script is the following:
from twilio.rest import Client
account_sid = 'xxxxxxxxx'
auth_token = 'xxxxxxx'
client = Client(account_sid, auth_token)

message = client.messages \
.create(
body='Alarm',
from_='xxx',
to='xxxx'
)


Top
   
PostPosted: Wed Apr 17, 2019 8:07 pm 
Offline

Joined: Tue Apr 16, 2019 5:12 pm
Posts: 5
Did he do it?

I want to do the same, and I can not find the solution


Top
   
PostPosted: Thu Apr 18, 2019 8:31 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 254
Hi agrobot.

agrobot wrote:
Did he do it?

I want to do the same, and I can not find the solution

Take a look at the example for the Raspberry Pi and SenseHAT:

https://forum.codesys.com/viewtopic.php?f=23&t=6247&p=19932#p19941

This works because the Raspberry Pi has the python interpreter installed. If the PLC has not python interpreter it does not work.

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: Mon Apr 22, 2019 8:18 pm 
Offline

Joined: Tue Apr 16, 2019 5:12 pm
Posts: 5
I have doubts about how to call my python pwm script in the program, I did not have to do it, think you could help me


Top
   
PostPosted: Wed Jul 03, 2019 2:42 pm 
Offline

Joined: Thu Apr 23, 2015 4:51 pm
Posts: 32
you could try building the script as a .exe using pyinstaller and calling this as a process using the PLC?


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 3 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