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.

Run multiple simulations in parallel using XML-RPC

+1 vote


after some trouble, I can now use the XML-RPC interface to open and run PLECS-simulations from an external tool. But it seems, I can only run one simulation at once: set one parameter, run, wait for the result, modify parameter again, run again, wait for result, ...

Is is possible, to start multiple simulations on a multicore-system in parallel? I'd need to start PLECS with command line parameters like -multipleinstance -rpcport 1081 -nogui

Is this possible?

asked Apr 23, 2019 by msta (13 points)

2 Answers

+1 vote


Unfortunately this is not possible currently.

EDITED: Parallel simulation is now available natively in PLECS Standalone. Look at the "PLECS: Buck Converter with Parameter Sweep" demo model.

Thank you,


answered Apr 23, 2019 by Kris Eberle (1,305 points)
edited Apr 27 by Kris Eberle
Well, I think, one could work around this by using a different user for each process. But this would cost too much extra-effort for my project.

So I would like to see such a feature soon :-)

One more idea: The float-to-string/string-to-float conversions and the XML parsing of the XML-RPC response costs a significant percentage of CPU-time. For transfering large result data arrays, a memory mapped buffer (shm_open+mmap for Linux, OpenFileMapping+MapViewOfFile for Windows) would be nice. The XML-RPC could then deliver the name and size of this file.
what happen if you run multiple file with different filename can be run in parallel?
*please delete this comment, I moved it to the the other sub-topic:

I've hat some other projects to work on during Corona... Now I'm back ;-)

Well, I read through the Buck Converter with Parameter Sweep. The Command to run the simulation looks like

plecs('simulate', simStructs, @(index, data) callback(index, data))

where simStructs is not just one set of parameters to be modified but an array of such structs. Then there is a third parameter, I guess a pointer to a callback function. But how is this call done in XML-RPC?

+1 vote

hi I wrote a workarund in python to do that you can find on my github

answered Oct 31, 2019 by tinivella (106 points)

I tried to clone the .plecs file with updated name-attribute. But when starting this in parallel, I get the error

Error: thread 1 Simulation error: method execution error:
       The server is busy executing the blocking command "simulate('test_0')".

test_0 is the file, generated by thread 0, which is running without problems.
@tinivella What's the trick in your python-script?

I dont know if PLECS changed the server structure,

simply my Python script handle the program pointer to interact the Plecs GUI with python instead of using the XML server.

For this I use pyautogui and os.path to duplicate the simulation files.

if you need we can do a teams session
Interesting. Yes, you can find me on

Hope some of my contact ways work for you ;-)