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.

Parse a PLECS file

0 votes
118 views
I have noticed that .PLECS files (standalone) are human readable and that they contain the info of everything within the model. I'm thrilled that this is the case, but the syntax doesn't seem to conform to JSON or XML, so I was wondering if it is a custom format? I was hoping that it would be standard in some way so I can use an off-the-shelf parser to navigate the model tree and pull out certain pieces of information. I can write something to parse a .plecs file if I really have to but it would be lovely if something already existed. I'm planning on using python for this task if that matters at all.
asked Jun 7 by nhawes (17 points)

2 Answers

+1 vote
 
Best answer
Yes, it's a custom format and no, I'm not aware of any off-the-shelf parser that allows you to parse the model. Since it is human readable you can easily write your own, if you really have to. Please be aware, though, that we may add new syntax elements or change the format completely at any time.

Kind regards,

Oliver Schwartaz
answered Jun 7 by Oliver Schwartz (295 points)
selected Jun 19 by nhawes
0 votes
Hi

Im doing one to read out the parameter of initialization and use it to create a class in python for my model. what you need exactly? Otherwise I agree with oliver that is better to use the API

Another useful way to use directly the change of code is adding complex probe content, like 20-30 probe signals that have the same name, but maybe is only my need :)
answered Jun 21 by tinivella (85 points)
Thanks for the offer, but shortly after receiving the selected answer I wrote my own parser to walk the model tree and grab the data that I wanted. I use the API when possible, but the API doesn't offer everything. In this instance I wanted to collect all the paths to scopes into a list of scope objects, but there are other things I use it for as well.
...