


{"id":50141,"date":"2020-11-26T11:15:58","date_gmt":"2020-11-26T11:15:58","guid":{"rendered":"\/forum\/forums\/topic\/ansysem-scripting-under-linux-with-already-opened-electronics-desktop\/"},"modified":"2020-11-26T11:15:58","modified_gmt":"2020-11-26T11:15:58","slug":"ansysem-scripting-under-linux-with-already-opened-electronics-desktop","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/ansysem-scripting-under-linux-with-already-opened-electronics-desktop\/","title":{"rendered":"AnsysEM scripting under Linux with already opened Electronics Desktop"},"content":{"rendered":"<p>Hello,nI&#8217;m trying to build a co-simulation with some control in Simulink and an electric engine in AnsysEM. This means I do some calculations in Simulink and get some parameters like e.g. currents for my electrical simulations. I then update my Ansys model, do an electromagnetic calculation and get some quantities like e.g. torque which I return to Simulink.nI have build up a model using 2019R2 under windows. There I opened the Ansys Electronical Desktop one time and started a simulation with the help of a VBS-Script. The VBS-Script didn&#8217;t open a new window and load the model but was able to directly modify the opened model and submit a calculation. I executed the script with the command system(&#8216;test.vbs&#8217;) from Matlab\/Simulink.nI&#8217;m now trying to move this procedure to a machine running Linux (CentOS 7). I&#8217;m now trying to port my scripts to Python which works fine except for one thing: I&#8217;m not able to modify an opened Ansys Electronical Desktop instance but have to start a new instance and load the model each time I want to do a simulation in AnsysEM. Since the simulation only takes about 10 seconds the startup and loading of the model makes the whole procedure much longer (about 40 seconds).nI only found a procedure on the forum to run a script without graphical output (\/forum\/discussion\/10365\/how-to-run-python-script-from-command-line). This cuts down the time a little bit but there is still much overhead for loading the model every time. I&#8217;m executing the script as below:n\/opt\/AnsysEM\/AnsysEM20.2\/Linux64\/ansysedt -features=beta -ng -runscriptandexit test.pynA direct execution of the script with python like python3 test.py is not possible, I guess because it is IronPython which is a little bit different than normal Python.nSo my question (at last): Is there a possibility to run a Python script from command line under Linux without opening a new instance of Ansys Electronical Desktop but attach to an existing instance? Or is there an even better approach to do a co-simulation between Simulink and AnsysEM?nThanks in advance!n<\/p>\n","protected":false},"template":"","class_list":["post-50141","topic","type-topic","status-closed","hentry","topic-tag-electronics","topic-tag-linux","topic-tag-python-scripting"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_old_topic_id":["22384"],"_bbp_old_topic_author_name_id":["Anonymous"],"_bbp_old_is_topic_anonymous_id":["false"],"_bbp_old_closed_status_id":["publish"],"_bbp_author_ip":["*\u0000\u0013?\u0003\u0000\u0003\t\u0000\u0000\u0000\u0000\u0000\u0000\u0010?"],"_bbp_old_sticky_status_id":["normal"],"_bbp_likes_count":["0"],"_btv_view_count":["715"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["50141"],"_bbp_forum_id":["27793"],"_bbp_engagement":["183619","186775"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["144485"],"_bbp_last_active_id":["144485"],"_bbp_last_active_time":["2021-03-02 17:40:33"]},"test":"albertwieland"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/50141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/50141\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=50141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}