Running a Python Script in a Constraint

Moderator: Moderators

Running a Python Script in a Constraint

Postby constantinos.florides@rwth-aachen.de » Thu Jun 03, 2021 3:02 pm

I want to run a python script in a constraint block in an ibd or par diagramm. My problem is that the python script has a lot of libraries such as pandas and others and i cannot connect it direct to the constraint block, so i can run it automatically, when i simulate my model.My purpose is to use the same values as input for the constraint block and these will be the same with the inputs in python. Then instead of an equation in the constraint will the python script run and after that the results from the python calculation will be in the output values showed.Is that possible or has someone hints?
I tried writting small python scripts in the constraint block and that was succesfull. Also i tried using opaque expressions or executing scripts like execfile() were not succesfull :/
constantinos.florides@rwth-aachen.de
Forum Newbie
Forum Newbie
 
Posts: 5
Posts Rating:0
Joined: Thu Jun 03, 2021 4:26 am

Re: Running a Python Script in a Constraint

Postby alecheld53@gmail.com » Sun Jun 06, 2021 10:21 pm

have you contacted customer support yet? jigsaw puzzle
alecheld53@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Sun Jun 06, 2021 9:58 pm

Re: Running a Python Script in a Constraint

Postby constantinos.florides@rwth-aachen.de » Mon Jun 07, 2021 2:59 am

Nope,but maybe this is a good idea!
constantinos.florides@rwth-aachen.de
Forum Newbie
Forum Newbie
 
Posts: 5
Posts Rating:0
Joined: Thu Jun 03, 2021 4:26 am

Re: Running a Python Script in a Constraint

Postby fahad » Wed Jun 09, 2021 9:23 pm

Have a look here, this might help

https://youtu.be/-9dbiLoyrUY
fahad
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Mon Dec 17, 2018 8:47 am

Re: Running a Python Script in a Constraint

Postby constantinos.florides@rwth-aachen.de » Thu Jun 10, 2021 7:13 am

Thanks, i have already tried it,but for some reason this execfile function has not worked :/
I donĀ“t understand exact why :(
constantinos.florides@rwth-aachen.de
Forum Newbie
Forum Newbie
 
Posts: 5
Posts Rating:0
Joined: Thu Jun 03, 2021 4:26 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests

cron