Smimport implementation error line 173
63 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Im getting the folling error while trying to import a solidworks file:
Error in smimport (line 173)
smimport_implementation(multibodyDescription, varargin{:}); - Show complete stack trace
Caused by:
Error using smimport_implementation
Cannot reload workspace from non-existing data source file 'C:\Pendulum_DataFile.m' - Show complete stack trace
Displaying stack trace:
Error using smimport_implementation
• In smimport_implementation
• In smimport (line 173)
1 Kommentar
Antworten (1)
Walter iacomacci
am 16 Nov. 2020
I experienced this error and yes, this error is not so trivial. I have few recommendations to fix or avoid this type of errors when importing CAD models to Simulink:
- Try avoiding commas on the file names that are being imported to Sim-Mechanics, those files could be the xml you are importing and the CAD files generated from Inventor/SolidWorks. For example, if you have one of those files named like this: arm,2.STL this for sure will cause an error when importing, instead use names like arm_1, manipulator_2 and so on.
- Make sure your assembly joints (Rotational, rigid, slider ...) are well assembled and fully working.
If none of this recommendations fix your problem then you will have to do the following:
I can see that your problem is being generated because Simulink can't find the DataFile, but even so Simulink opens the model generated and then pops the error (At least when I had this type of errors it used to be like that), then if Simulink opens the model all you have to do is try to save that model and if you are lucky it will show a message asking if you want to save the DataFile in the MATLAB installation folder (for some reason it won't let you change that path), then all you have to do is find that DataFile (that now exists) and its supposed to be on the MATLAB installation folder depending on your installation but make sure to search inside the bin folder, there is where the DataFiles were located when I had this errors.
So if you found the DataFile try this first:
Open the Simulink model and go to Model Workspace it is located next to the Model Configuration parameters (Next to the gear), a window will appear so look on the left and expand your model so you can see the model workspace and click on it, the window will change and now on the right you will se the Workspace Data and Data Source with the following options: Model File, MAT-File, MATLAB File and MATLAB code. Since now you have your DataFile all you have to do is select MATLAB File and browse it then click reinitialize from source and close that window. Hopefully if everything is fine you can try running the model, if there are no errors it means everything is fixed.
If the potential solution showed above didn't work it means that you might be experiencing another error that I encountered when working with Sim-Mechanics, this error is troublesome but is fixable.
Go inside your DataFile using Matlab and look where the Solid data is declared, It looks like this for each solid:
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(3).mass = 3.368116026400727; % kg
smiData.Solid(3).CoM = [-150.00000000000006 5.4599278987250965 -199.99999999999997]; % mm
smiData.Solid(3).MoI = [46117.033527792737 71611.373376338379 25617.126119060009]; % kg*mm^2
smiData.Solid(3).PoI = [0 3.4924596548080443e-11 0]; % kg*mm^2
smiData.Solid(3).color = [0.95686274509803926 0.95686274509803926 0.95686274509803926];
smiData.Solid(3).opacity = 1;
smiData.Solid(3).ID = 'ground.ipt_{BD965F6F-4B39-995A-6EE8-02B1E8AF43B0}';
So now what you have to do is to check the solid ID {smiData.Solid(3).ID} and see if the extension is the actual Simulink is requesting inside the Solid block. For some reason sometimes the Data is generated wrong and the extensions were declared wrongly, for example in my case I use inventor, the solid extension for inventor is .ipt, so as you can see in the solid ID the string is clearly wrong since Simulink only accepts extensions such as STL or STEP and the error was being generated here. To fix that use the "Find" tool of the Matlab editor and search for the current extension that is written here (like in my case it was .ipt, I don't know SolidWork solids extension) and then use button "Replace All" with the actual extension you exported from SolidWorks that should be STL or STEP. Now the code should look like this for all the solids involved in the system:
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(3).mass = 3.368116026400727; % kg
smiData.Solid(3).CoM = [-150.00000000000006 5.4599278987250965 -199.99999999999997]; % mm
smiData.Solid(3).MoI = [46117.033527792737 71611.373376338379 25617.126119060009]; % kg*mm^2
smiData.Solid(3).PoI = [0 3.4924596548080443e-11 0]; % kg*mm^2
smiData.Solid(3).color = [0.95686274509803926 0.95686274509803926 0.95686274509803926];
smiData.Solid(3).opacity = 1;
smiData.Solid(3).ID = 'ground.STEP_{BD965F6F-4B39-995A-6EE8-02B1E8AF43B0}';
After that you can save the DataFile and run again the Model, If the error was generated because of this then this should fix it.
I hope this will help to fix your problem. Note that these solutions are based on the errors I encountered when working with the toolbox, but the errors were pretty similar and there is not much information about it.
2 Kommentare
Yatish Chandra Chitluri
am 19 Jan. 2021
Hello @Walter iacomacci I have the same problem now. I use Inventor 2020 and Matlab 2020b and I use the Add-In Simscape Multibody Link in Inventor.
Your solution helps. Thank you.
Cheers!
Yatish.
Siehe auch
Kategorien
Mehr zu Bodies finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!