Jump to content

Ruud

Members
  • Content Count

    7
  • Joined

  • Last visited

About Ruud

  • Rank
    Newbie

Profile Information

  • Are you University user?
    No

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Dear Alejandro, Do you know what argument options I have for the 'CONSOLE_LABEL' argument? It seems that it does not matter whether I set this argument to YES or NO, the console is displayed in both cases. For clarity, I would ultimately like to reduce the amount of information fed back to the user via the console window to either a bare minimum, or nothing at all. Is this possible? Thanks in advance and best regards, Ruud
  2. Thanks Alejandro! I managed to get the 'loadlibrary' command to work after installing Visual Studio 2019. However, I am still experiencing problems with the API. I am trying to run the following code: % Init Flux installation path installFlux = 'C:\Altair\2019\flux\Flux'; % Init Flux dll fluxmp = 'flux_mp'; if(~libisloaded(fluxmp)) [notfound,warnings] = loadlibrary(strcat(installFlux,'\Bin\dll\win64\flux_mp.dll'), strcat(installFlux,'\Api\win64\include\flux_mp_matlab.h')) end f = libfunctions(fluxmp); % Server type FLUX2D_64 ='FLUX2D_2019.1_64'; FLUX3D_64 ='FLUX3D_2019.1_64'; FLUXSKEWED_64='FLUXSKEWED_2019.1_64'; FLUXPEEC_64 ='FLUXPEEC_2019.1_64'; % Server arguments NUMERICAL_MEMORY_LABEL='MEMSIZN3='; CHARACTER_MEMORY_LABEL='MEMSIZC3='; GUI_MEMORY_LABEL ='JVM_MEMORY='; LANGUAGE_LABEL ='CAO_DEFLAN='; CONSOLE_LABEL ='CONSOLE_SERVER='; % Debug Mode RELEASEMODE=0; DEBUGMODE =1; % Error maxSizeErrorMessage = 2048; ME = MException(strcat(fluxmp,':dll'),strcat('Error connection to ',fluxmp)); % Error Code herror=0; % Server Uid serverUid = 0; % Functions to manage Server FMP_getServerVersion = 'FMP_getServerVersion_Matlab'; FMP_init = 'FMP_init_Matlab'; FMP_startLocaleServer = 'FMP_startLocaleServer_Matlab'; FMP_startRemoteServer = 'FMP_startRemoteServer_Matlab'; FMP_stopServer = 'FMP_stopServer_Matlab'; FMP_killServer = 'FMP_killServer_Matlab'; % Functions to manage Project FMP_loadProject = 'FMP_loadProject_Matlab'; FMP_closeProject = 'FMP_closeProject_Matlab'; FMP_saveProject = 'FMP_saveProject_Matlab'; FMP_saveProjectAs = 'FMP_saveProjectAs_Matlab'; % Functions to manage Jython command FMP_executeJythonCommand = 'FMP_executeJythonCommand_Matlab'; FMP_getJythonDoubleArrayValue = 'FMP_getJythonDoubleArrayValue_Matlab'; FMP_getJythonIntArrayValue = 'FMP_getJythonIntArrayValue_Matlab'; FMP_getJythonStringArrayValue = 'FMP_getJythonStringArrayValue_Matlab'; FMP_setJythonDoubleArrayValue = 'FMP_setJythonDoubleArrayValue_Matlab'; FMP_setJythonIntArrayValue = 'FMP_setJythonIntArrayValue_Matlab'; FMP_setJythonStringArrayValue = 'FMP_setJythonStringArrayValue_Matlab'; % Functions to manage Solver FMP_openMultiPhysicsSession = 'FMP_openMultiPhysicsSession_Matlab'; FMP_closeMultiPhysicsSession = 'FMP_closeMultiPhysicsSession_Matlab'; FMP_solve = 'FMP_solve_Matlab'; FMP_solveCurrentStep = 'FMP_solveCurrentStep_Matlab'; FMP_solveDefineNextStep = 'FMP_solveDefineNextStep_Matlab'; FMP_solveActiveNextStep = 'FMP_solveActiveNextStep_Matlab'; % Functions to manage Error FMP_getErrorMessage = 'FMP_getErrorMessage_Matlab'; FMP_freeError = 'FMP_freeError_Matlab'; % Init Flux API herror = calllib(fluxmp,FMP_init,[installFlux '\Bin\prg\win64\multiphys.wfg'],RELEASEMODE); if (herror ~= 0) throw(ME); end At the end, when I perform the calllib command, it returns with an error. Is there anyway to get more information about the error (currently it only return a numerical value in 'herror')?
  3. Hi, I am trying to set up communication between Matlab (version 2019a) and Flux2D (as a server, using version 2019.1). I have been able to do this succesfully in the past with older versions of Flux2D (12.3). However, for the new version, I found that a library needs to be loaded for this in Matlab using the following command: [notfound,warnings]=loadlibrary(strcat(installFlux,'\Bin\dll\win64\',fluxmp,'.dll'), strcat(installFlux,'\Api\win64\include\flux_mp_matlab.h')); I have made sure that the variable 'installFlux' is set correctly (manually checked the result of strcat). Also, I am using MinGW as a C/C++ compiler in Matlab (recommended by Matlab). However, when I try to run the command above, I get some errors: Error loading library intermediate output follows. The actual error is at the end of this output. ********* Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/struct([^;,{(]*){ <-- HERE (.*?)\}([^;])*;/ at C:\Program Files\MATLAB\R2019a\toolbox\matlab\general\private\prototypes.pl line 912. Failed to parse type '( __cdecl__ )) FMP_stopServer_Matlab ( int serverUid' original input '( __cdecl__ )) FMP_stopServer_Matlab ( int serverUid ' Found on line 12 of input from line 8 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_killServer_Matlab ( int serverUid' original input '( __cdecl__ )) FMP_killServer_Matlab ( int serverUid ' Found on line 13 of input from line 9 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_closeProject_Matlab ( int serverUid' original input '( __cdecl__ )) FMP_closeProject_Matlab ( int serverUid ' Found on line 17 of input from line 13 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_saveProject_Matlab ( int serverUid' original input '( __cdecl__ )) FMP_saveProject_Matlab ( int serverUid ' Found on line 18 of input from line 14 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_solveCurrentStep_Matlab ( int serverUid' original input '( __cdecl__ )) FMP_solveCurrentStep_Matlab ( int serverUid ' Found on line 34 of input from line 30 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_solveActiveNextStep_Matlab ( int serverUid' original input '( __cdecl__ )) FMP_solveActiveNextStep_Matlab ( int serverUid ' Found on line 36 of input from line 32 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_getErrorMessage_Matlab ( int errorId' original input '( __cdecl__ )) FMP_getErrorMessage_Matlab ( int errorId ' Found on line 43 of input from line 39 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. Failed to parse type '( __cdecl__ )) FMP_freeError_Matlab ( int errorId' original input '( __cdecl__ )) FMP_freeError_Matlab ( int errorId ' Found on line 44 of input from line 40 of file C:\\Altair\\2019\\flux\\Flux\\Api\\win64\\include\\flux_mp_matlab.h Error parsing argument for function __attribute__ function may be invalid. ********* Error using loadlibrary Building flux_mp_thunk_pcwin64 failed. Compiler output is: C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\mingw_w64.instrset\bin\gcc -I"C:\Program Files\MATLAB\R2019a\extern\include" -fexceptions -fno-omit-frame-pointer -I"C:\SIM_TOOLS\TOOLS\HSM_geometry_optimization" -I"C:\Altair\2019\flux\Flux\Api\win64\include" "flux_mp_thunk_pcwin64.c" -o "flux_mp_thunk_pcwin64.dll" -shared flux_mp_thunk_pcwin64.c:33:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token EXPORT_EXTERN_C long long(__cdecl__))FMP_stopServer_Matlab(intserverUidThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c:42:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token EXPORT_EXTERN_C long long(__cdecl__))FMP_killServer_Matlab(intserverUidThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c:51:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token EXPORT_EXTERN_C long long(__cdecl__))FMP_closeProject_Matlab(intserverUidThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c:60:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token EXPORT_EXTERN_C long long(__cdecl__))FMP_saveProject_Matlab(intserverUidThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c:69:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token EXPORT_EXTERN_C long long(__cdecl__))FMP_solveCurrentStep_Matlab(intserverUidThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c:78:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before ')' token EXPORT_EXTERN_C long long(__cdecl__))FMP_solveActiveNextStep_Matlab(intserverUidThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c: In function 'cstring': flux_mp_thunk_pcwin64.c:87:42: error: expected declaration specifiers before ')' token EXPORT_EXTERN_C char * cstring(__cdecl__))FMP_getErrorMessage_Matlab(interrorIdThunk(void fcn(),const char *callstack,int stacksize) ^ flux_mp_thunk_pcwin64.c:5:26: error: expected declaration specifiers before '__attribute__' #define DLL_EXPORT_SYM __declspec(dllexport) ^ flux_mp_thunk_pcwin64.c:19:25: note: in expansion of macro 'DLL_EXPORT_SYM' #define EXPORT_EXTERN_C DLL_EXPORT_SYM ^~~~~~~~~~~~~~ flux_mp_thunk_pcwin64.c:96:1: note: in expansion of macro 'EXPORT_EXTERN_C' EXPORT_EXTERN_C long long(__cdecl__))FMP_freeError_Matlab(interrorIdThunk(void fcn(),const char *callstack,int stacksize) ^~~~~~~~~~~~~~~ flux_mp_thunk_pcwin64.c:87:24: warning: type of '__cdecl__' defaults to 'int' [-Wimplicit-int] EXPORT_EXTERN_C char * cstring(__cdecl__))FMP_getErrorMessage_Matlab(interrorIdThunk(void fcn(),const char *callstack,int stacksize) ^~~~~~~ flux_mp_thunk_pcwin64.c:102:1: error: expected '{' at end of input } ^ Error in flux_link (line 9) [notfound,warnings]=loadlibrary(strcat(installFlux,'\Bin\dll\win64\',fluxmp,'.dll'), strcat(installFlux,'\Api\win64\include\flux_mp_matlab.h')); Do you have any idea what is causing this problem? Is MinGW the right compiler for loading this library, or do I need a different one? Thanks in advance for the reply. Best regards, Ruud
  4. Okay, too bad, but thanks for the quick reply! Best regards, Ruud
  5. Hi, Is it possible to control FluxMotor from Matlab (set parameters, run simulation, retrieve results into Matlab)? If so, is there any documentation available on how to set up the communication? Thanks in advance and best regards, Ruud
  6. Hello Alejandro, Indeed, this solves my problem. Thanks and regards, Ruud
  7. Hello, I am trying to calculate the flux density at the top surface of a magnet, which is placed in the rotor of an electric machine. Therefore, I have defined a support path at the outer top edge of the magnet. For now, I am only interested in the component of the flux density normal to the support path. I have created a local coordinate system with the y-axis aligned with the normal vector of the support path, such that I can transform the component of B in the global coordinate system to the local one and select on the the second component. This method works when the rotor does not move. However, I would also like to investigate the influence of rotor movement. When the rotor moves, the local coordinate system does not move along with the rotor and therefore, the calculation described above does not work anymore. Is there a way to have the local coordinate system rotate along with the rotor? Or is there a different way to obtain the desired value. Thanks in advance and best regards, Ruud
×
×
  • Create New...