Flux-MATLAB/Simulink Cosimulation Failed at the beginning

sx1995
sx1995 Altair Community Member
edited October 2020 in Community Q&A

I've got license for Altair HyperWorks Student Edition 2018 and installed Flux 2018.1. Then I coupled the software with Matlab R2017b and set the necessary path in Matlab. When I tried to run co-simulation using Flux with simulink, however, it  failed and the following message was shown:

image.png.cbf8dc65322a8013cff04121ea2b3998.png

:(/emoticons/default_sad.png' srcset='/emoticons/sad@2x.png 2x' title=':(' width='20' />Could anyone tell me how can i solve this problem? thx

Tagged:

Answers

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited December 2018

    Hello,

    It seems that there is a path in Simulink that is not well parametrized. Maybe, that is the reason why your S-function is not able to find Flux.

    I think Flux path should be indicated in Simulkin in order to properly do the coupling.

    Best regards,

  • sx1995
    sx1995 Altair Community Member
    edited December 2018

    Hello,

    It seems that there is a path in Simulink that is not well parametrized. Maybe, that is the reason why your S-function is not able to find Flux.

    I think Flux path should be indicated in Simulkin in order to properly do the coupling.

    Best regards,

    Hello,

    Thank you for your respond.

    I have added Flux path into the matlab path , as shown below. The error is still there :-( 

    Do you know why it 'cannnot find installation file' in simulink?

    Many thanks.

    image.png.4835512ff7009f15530d075202dc27c0.png

  • sx1995
    sx1995 Altair Community Member
    edited December 2018

    By the way, does Flux 2018.1 support coupling with MATLAB R2017b? I think maybe I use a wrong version...

  • asoualmi
    asoualmi
    Altair Employee
    edited December 2018

    Hi,

    Yes Flux 2018.1 support coupling with Matlab 2017b. you need to check the path in Simulink.

     

    Best regards.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2019

    Hi sx1995, 

    Is your problem solved? if Yes can you please write how it worked.  I am also having the same problem. 

  • sx1995
    sx1995 Altair Community Member
    edited March 2019

    Hi,

    Yes Flux 2018.1 support coupling with Matlab 2017b. you need to check the path in Simulink.

     

    Best regards.

    It doesn't work yet. I think maybe you should test the co-simulation or give a detailed technical brochure in the next version of the software.

    It seems that I am not the only one encountering the problem...

    Hi sx1995, 

    Is your problem solved? if Yes can you please write how it worked.  I am also having the same problem. 

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2019

    I am trying to do a cosimulation with Altair flux with LMS Amesim

    i get the following error at the beginning of solving 

    Initiziating flux server

    Unable to start flux server

    FMP_close project

    FMP_stop server

  • Amina
    Amina Altair Community Member
    edited February 2020

    Hi,

    I have the same problem

    The path in Matlab is true, but still show this error

    I tested it in both 2017b & 2019b Matlab versions!

    Please Help us!

    Thanks

    <?xml version="1.0" encoding="UTF-8"?>1.thumb.png.6a591209c8ed039d940f0f1b234d7eb6.png

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited March 2020

    Hello Amina,

    It seems that Simulink is not able to find Flux.

    To properly run this coupling there are some actions you should do:

    ·       You should launch a file to activate the API. The default path to this file is:  C:\Program Files\Altair\2019\flux\Flux\Bin\prg\win64\Active_Distributed_Computation_and_API. Please, run this file with administrator rights.

    ·       After this, open Matlab/Simulink from Flux Supervisor. Go to Supervisor Options -> Access paths -> Coupled software. There you should put your Matlab directory path. Then open Matlab using the button with an arrow (see image).

    image.png

    Please, try this. If your error persists, I will need additional information to solve it.

    Best regards,

  • Mostafa Ahmadi
    Mostafa Ahmadi Altair Community Member
    edited March 2020

    Hello Amina,

     

     

    It seems that Simulink is not able to find Flux.

     

     

    To properly run this coupling there are some actions you should do:

     

     

    ·       You should launch a file to activate the API. The default path to this file is:  C:\Program Files\Altair\2019\flux\Flux\Bin\prg\win64\Active_Distributed_Computation_and_API. Please, run this file with administrator rights.

     

     

    ·       After this, open Matlab/Simulink from Flux Supervisor. Go to Supervisor Options -> Access paths -> Coupled software. There you should put your Matlab directory path. Then open Matlab using the button with an arrow (see image).

     

     

    <?xml version="1.0" encoding="UTF-8"?>image.png

     

     

     

     

     

    Please, try this. If your error persists, I will need additional information to solve it.

     

     

    Best regards,

     

     

    Hi 

    I have done what you explained but I still have the problem. 

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.ed9f3e5f627eba3656754eacf0c16b95.png

     

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.37bf8d3d392053603c70fc2038f7c9c3.png

     

    Is it related to the version of MATLAB?

     

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited March 2020

    Hi Mostafa,

    Unfortunately, I think you are right, this problem is probably related with Matlab version compatibility.

    For the moment, Matlab R2019a is not qualified for coupling with Flux.

    Please, see the table below to check versions compatibility.

    image.png

    Best regards,

  • Amina
    Amina Altair Community Member
    edited March 2020

    Hi Alejandro,

    I did what you explained & my problem solved!

    Thank you very much for your help & your respond!

    I used Matlab 2019b

    Best regards,

     

    Hello Amina,

     

     

    It seems that Simulink is not able to find Flux.

     

     

    To properly run this coupling there are some actions you should do:

     

     

    ·       You should launch a file to activate the API. The default path to this file is:  C:\Program Files\Altair\2019\flux\Flux\Bin\prg\win64\Active_Distributed_Computation_and_API. Please, run this file with administrator rights.

     

     

    ·       After this, open Matlab/Simulink from Flux Supervisor. Go to Supervisor Options -> Access paths -> Coupled software. There you should put your Matlab directory path. Then open Matlab using the button with an arrow (see image).

     

     

    <?xml version="1.0" encoding="UTF-8"?>image.png

     

     

     

     

     

    Please, try this. If your error persists, I will need additional information to solve it.

     

     

    Best regards,

     

     

     

  • Aravind Venugopal
    Aravind Venugopal Altair Community Member
    edited March 2020

    Hello Amina,

     

     

    It seems that Simulink is not able to find Flux.

     

     

    To properly run this coupling there are some actions you should do:

     

     

    ·       You should launch a file to activate the API. The default path to this file is:  C:\Program Files\Altair\2019\flux\Flux\Bin\prg\win64\Active_Distributed_Computation_and_API. Please, run this file with administrator rights.

     

     

    ·       After this, open Matlab/Simulink from Flux Supervisor. Go to Supervisor Options -> Access paths -> Coupled software. There you should put your Matlab directory path. Then open Matlab using the button with an arrow (see image).

     

     

    <?xml version="1.0" encoding="UTF-8"?>image.png

     

     

     

     

     

    Please, try this. If your error persists, I will need additional information to solve it.

     

     

    Best regards,

     

     

     

    Hi Alejandro,

     

    I have been trying to do this Flux-Simulink coupling too. I have generated the 'component for Matlab-Simulink coupling'. Then as you mentioned in this thread, I activated the API running the application file as administrator. Then I added my MATLAB directory (which contains the matlab.exe file) by browsing in 'Options' in Flux supervisor. But, when I try to open MATLAB via the arrow that you mentioned, it is giving me error. I'm attaching the screenshot of the same. Even though I chose the correct directory (C:\Program Files\MATLAB\R2018a\bin), the error dialog box is giving a wrong directory address (C:\Program Files\MATLAB\R2018a\bin\bin\win64\matlab.exe) too! How can I fix this?

     

    Thanks and regards,

    Aravind

    <?xml version="1.0" encoding="UTF-8"?>Screenshot (22).png

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited March 2020

    Hello Aravind,

    I think the problem is that you have indicated as directory C:\Program Files\MATLAB\R2018a\bin, it should be C:\Program Files\MATLAB\R2018a, instead.

    Try this, I think it is going to work.

    Best regards,

    Alejandro

  • Aravind Venugopal
    Aravind Venugopal Altair Community Member
    edited March 2020

    Hello Aravind,

    I think the problem is that you have indicated as directory C:\Program Files\MATLAB\R2018a\bin, it should be C:\Program Files\MATLAB\R2018a, instead.

    Try this, I think it is going to work.

    Best regards,

    Alejandro

     

    Hi Alejandro,

     

    Thanks. Your suggestion worked. I opened MATLAB Simulink via Flux and added the 'Coupling with Flux' block. But when I gave my .F2MS file name in the block parameters, I got an error which says, 'Error reported by S-function 'Flux_Simulink' in 'untitled/Coupling with Flux': Cannot read F2MS file'. I double checked with the .F2MS filename (which has the same name as the project) and it was right. What should I do to proceed further?

     

    Thanks and regards

    Aravind

     

    P.S: I really appreciate you taking your time for answering my flurry of most basic questions with patience.

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited March 2020

    Hi Aravind,

    You are welcome.

    I have not a clue about why your simulink is not able to read your F2MS file, since now your Flux and your Simulink versions are compatible.

    Please, try to generate a new file with another name just to be sure this is not a path problem.

    Best regards,

    Alejandro

  • Aravind Venugopal
    Aravind Venugopal Altair Community Member
    edited March 2020

    Hi Aravind,

    You are welcome.

    I have not a clue about why your simulink is not able to read your F2MS file, since now your Flux and your Simulink versions are compatible.

    Please, try to generate a new file with another name just to be sure this is not a path problem.

    Best regards,

    Alejandro

     

    Hi Alejandro,

     

    It was a path error and I fixed it. Now I can configure my 'Coupling with Flux' block in MATLAB.

     

    However, I was not able to connect other components from the Simulink library like voltage source and resistance to the coupling block. But I can connect components like sine wave and scope. Why is it so? My input parameters (defined in Flux) were positive and negative copper conductors of my laminated busbar (with polyamide as the insulator in between the conductors), and output was current through the busbar and I just want to connect a dc voltage source and a resistance across those conductors in MATLAB. I'm attaching a screenshot of my model here for your reference.

     

    Also, in Flux, I have defined volume regions and face regions for my conductors. But how do I link the I/O parameters to my face regions (which I have defined for terminals of the conductors where I'm intending to apply the voltage) so that I'm sure that the voltage I'm giving is applied to those terminals only. I have tried to add terminals like in Flux PEEC, but I didn't find that option here. The only option is to edit the Electrical terminals, so I'm confused here. How should I proceed?

     

    Thanks and regards

    Aravind

    <?xml version="1.0" encoding="UTF-8"?>Screenshot (24).png

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited March 2020

    Hi Aravind,

    When you create your connector, you should decide which parameters will be fed from Simulink, then you can connect Simulink sources to them. You do not need to use voltage source directly in Simulink, rather you should define another input in Simulink (sine wave or any other) and them assign the parameter it is piloting as temporal value of your current source.

    Nearly everything is parametrizable in Flux: you can parametrize your voltage source value inside Flux and the resistance of your circuit component, including solid conductors.

    To simulate your device, you should define the blue and red volumes as solid conductors and then generate a circuit to link them to a circuit. Finally, you can choose which faces are the input and outputs of your solid conductor.

    Hope this helps.

    Best regards,

  • Aravind Venugopal
    Aravind Venugopal Altair Community Member
    edited March 2020

    Hi Alejandro,

     

    1)

    To simulate your device, you should define the blue and red volumes as solid conductors and then generate a circuit to link them to a circuit. Finally, you can choose which faces are the input and outputs of your solid conductor.

    This, I did and I have done the solving in Flux with 'transient magnetic 3D' application.

     

    2)

    rather you should define another input in Simulink (sine wave or any other) and them assign the parameter it is piloting as temporal value of your current source.

    Regarding this, I do not know how to do that. It would be great if you can elaborate.

     

    3)

    When you create your connector, you should decide which parameters will be fed from Simulink

     

    I suppose what you meant is the I/O parameters that I should be defining before generating the component for Matlab Simulink coupling. That I did, and I gave input parameters P1 and N1 with 'Parameter for multiphysical application' option and reference value 0. This means that these inputs are supposed to be from Simulink right? Even after that, I cannot connect voltage or current sources or components like resistors to Flux coupling block inputs/outputs. I can only connect scopes, sine wave etc. I just wish to connect a dc voltage source and a resistance to the busbar.  I'm attaching a simple drawing for your reference.

    <?xml version="1.0" encoding="UTF-8"?>Figure.thumb.png.7ca0f11715540020369e818b12c0c70b.png

    Here, the small diagram on top represents the busbar that I modeled and meshed in Flux. It is then coupled with matlab. The circuit diagram represents the model that I wish to make in Matlab. Also, I defined output parameters P2 and N2 (With 'Parameter controlled via a scenario' option with reference value 0) so that I can complete the circuit in Matlab. And I would like to visualize the current density through the busbar in Flux.  I mean, suppose that I'm able to make the model as I wished and I have simulated it. Do I need to import the data that I need (suppose current through the busbar here), back to flux or something, so that I can work on postprocessing of the results in Flux?

     

    Warm regards,

    Aravind

     

  • Aravind Venugopal
    Aravind Venugopal Altair Community Member
    edited April 2020

    Hi Aravind,

     

     

    When you create your connector, you should decide which parameters will be fed from Simulink, then you can connect Simulink sources to them. You do not need to use voltage source directly in Simulink, rather you should define another input in Simulink (sine wave or any other) and them assign the parameter it is piloting as temporal value of your current source.

     

     

    Nearly everything is parametrizable in Flux: you can parametrize your voltage source value inside Flux and the resistance of your circuit component, including solid conductors.

     

     

    To simulate your device, you should define the blue and red volumes as solid conductors and then generate a circuit to link them to a circuit. Finally, you can choose which faces are the input and outputs of your solid conductor.

     

     

    Hope this helps.

     

     

    Best regards,

     

     

    Hi Alejandro,

     

    Hope you and your folks are doing fine amidst this pandemic. I think you forgot about this thread and my query. Thus, I'm quoting you to remind you the same.

     

    Regards

    Aravind

  • Alejandro Rodríguez
    Alejandro Rodríguez
    Altair Employee
    edited April 2020

    Hi Aravind,

    I am sorry for this late answer.  In fact, situation in Europe is quite difficult at this moment.

    I hope you and your family and friends are also doing fine during this pandemic period.

    Regarding your problem, I think you should define a parameter inside FLux and to link it to a Simulink source, you will find a complete example of how to do this kind of connexions in the file attached (pdf file + flux project).

    Following this same logic, you can define your circuit in Flux (using, in this case, a transient simulation instead of a magnetostatic one, since circuit options are not available in magneto static). The circuit variables (such as the voltage of your source) can be defined as parameters and read from a simulink input, as explained in the pdf attached.

    A final advise is that you should start defining your project in Flux and make it works alone, without Simulink. At this stage, parameters coming from simulink can be defined as known variables or constants.

     In a second step you can make Flux works together with Simulink. I think this is the best way to get confidence in your project and to make the possible physical problems independent from coupling ones.

    Hope this example helps you in your own project definition.

    Best regards,

    Alejandro

    Unable to find an attachment - read this blog