Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Is there a remotely way to stop a Plecs simulation? Is there a way to extract Outport data during simulation?

0 votes

 wrote a script to control soome simulation form Python and this is the code to start the simulation:

data = server.plecs.simulate(modelName, opts)

How does the API works? Does it get data at every Plecs step and then it displays the last values registered at the last step? I tried using a new thread to initialize an empty data list and then try to catch the data from it at every couple of seconds but it appears that only the last data is displayed.

{'Time': [], 'Values': []}

Is there a workaround. Is it there a possibility to catch data from Outport while python is executing server.plecs.simulate(modelName, opts) command?

Also is there a command in Python that can remotely stop a Plecs simulation from running. Maybe a manual with all the XML-RPC commands for Plecs standalone?

Thank you.
asked May 9 by Darius (14 points)

1 Answer

0 votes
The plecs.simulate() call is a blocking, which means that you are not able pass any other command until the current plecs.simulate() has finished executing.  There is not a command to halt the simulation or access the data before the simulation is complete.

One workaround is to use a "To File" block which will update continuously as the simulation proceeds.  You can then read the text file in another thread.
answered May 15 by Bryan Lieblick (1,949 points)