FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Post by josegegas »

barrti wrote: Mon Apr 05, 2021 1:14 pm Hi Jose,

I'm working through the Tennis Racket model where we shift the relative centre of mass after shifting the structural node from 0,0,-374 mm to 0,0,0.

Pressing Recalculate didn't work.

I shifted the structural node but could not change the relative centre of mass?

Any ideas?
Hello. Please consider that:

*In both cases, stable and un-stable rotation, the node is at the center of mass of the racket. In these examples you do not have to move the node, so the relative center of mass in both examples is (0,0,0).

*if you move any node, the software will automatically re-caluclate the relative center of mass, you do not have to recompute the model. But for these examples you have to leave the nodes at the center of mass of their rigid bodies.

*What causes the unstable rotation is the momments of inertia of the tennis racket (intermediate axis theorem), not the position of the node relative to the center of mass. Have a look at the initial conditions (the initial angular velocity) of the nodes in both examples. Compare the moments of inertia relative to these initial conditions...

I hope this helps.
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Post by josegegas »

Hi.

I´ve made a video in which I show how to set-up the simulation of the double wishbone car suspension that is in Gitlab:

https://www.youtube.com/watch?v=_UCaIGkBevA

I start from scratch, assuming only the CAD model is available.

The idea is to depict the workflow I have arrived to, encourage people to try the example, and of course, open to suggestions on how to improve the workflow...
toni_lv
Posts: 11
Joined: Tue Nov 03, 2020 8:10 pm
Location: Spain

Re: FreeCAD as pre-post processor for MBDyn

Post by toni_lv »

josegegas wrote: Wed Apr 07, 2021 12:09 am Hi.

I´ve made a video in which I show how to set-up the simulation of the double wishbone car suspension that is in Gitlab:

https://www.youtube.com/watch?v=_UCaIGkBevA

I start from scratch, assuming only the CAD model is available.

The idea is to depict the workflow I have arrived to, encourage people to try the example, and of course, open to suggestions on how to improve the workflow...
Hello,

First of all, congratulations for your enormous workbench, it looks quite usable right now and with lots of functionalities.
I will start to try making my own projects to get used to its commands and find suggestions.
I have used in the past Motionview and Motionsolve, and I think it has a functionality that can be useful for current workflow, Motionview allows to use points referenced from geometry, or create directly in its interface. These points will be used as references to assign joints, coordinate systems, point masses... I think that it would be great allowing to create dummy points in Part or Part Design before, so later you can move joints or other elements into point and edit its orientation. I think maybe it is an easier way to operate with joints or another elements that need an application point.
Here is a simple implementaion video example using MotionSolve: https://www.youtube.com/watch?v=Fo_J1QK7Hrw

I hope this helps, thanks again for you work.
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Post by josegegas »

Hi. Yes any sugestion will be very welcome. Thanks.

I've made a couple of videos more, for the gyroscopic machine and the four-bar mechanism:

https://www.youtube.com/watch?v=Ej3FzVf1agU&t=9s

https://www.youtube.com/watch?v=QRWepZ2JPEs

I will continue to make some videos for the rest of examples...
SuperMarty
Posts: 24
Joined: Fri Mar 19, 2021 12:19 pm
Location: France

Re: FreeCAD as pre-post processor for MBDyn

Post by SuperMarty »

Hello @josegegas,

Thank you for your work on the dynamics Workbench. Your videos are awesome !

I want to test all of this with systems in my lab. But first I wanted to get my hands on some examples. I started with the gyroscope.

I used the CAD files provided. I created the first two links and the drive hinge joint. Unfortunately when I click to create the ".mbdyn" file I have the following error message :

14:10:24 Running the Python command 'MBdyn_AddMBD' failed:
Traceback (most recent call last):
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/MBdynGui.py", line 657, in Activated
dyn.WriteInputFile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/dynamics.py", line 562, in WriteInputFile
Writeinpfile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/writeinpfile.py", line 134, in __init__
if(StructuralNodes[x].type=='dynamic'):#Write all structural dynamic nodes

'FeaturePython' object has no attribute 'type'

Capture d’écran du 2021-04-09 15-47-15.png
Capture d’écran du 2021-04-09 15-47-15.png (453.27 KiB) Viewed 2594 times
I would like to point out that the examples you provide work well on my installation (except Robot Gripper). I use MBDyn develop branch and I copied your Workbench two days ago.


I attach the file :
Tuto-GyroscopicPrecessionCAD.FCStd
(62.36 KiB) Downloaded 56 times
Can you tell me what's wrong?
Thank you for your help.


OS: Linux Mint 20 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: French/France (fr_FR)
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Post by josegegas »

SuperMarty wrote: Fri Apr 09, 2021 3:15 pm Hello @josegegas,

Thank you for your work on the dynamics Workbench. Your videos are awesome !

I want to test all of this with systems in my lab. But first I wanted to get my hands on some examples. I started with the gyroscope.

I used the CAD files provided. I created the first two links and the drive hinge joint. Unfortunately when I click to create the ".mbdyn" file I have the following error message :

14:10:24 Running the Python command 'MBdyn_AddMBD' failed:
Traceback (most recent call last):
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/MBdynGui.py", line 657, in Activated
dyn.WriteInputFile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/dynamics.py", line 562, in WriteInputFile
Writeinpfile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/writeinpfile.py", line 134, in __init__
if(StructuralNodes[x].type=='dynamic'):#Write all structural dynamic nodes

'FeaturePython' object has no attribute 'type'


Capture d’écran du 2021-04-09 15-47-15.png

I would like to point out that the examples you provide work well on my installation (except Robot Gripper). I use MBDyn develop branch and I copied your Workbench two days ago.


I attach the file : Tuto-GyroscopicPrecessionCAD.FCStd

Can you tell me what's wrong?
Thank you for your help.


OS: Linux Mint 20 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: French/France (fr_FR)
Hello.

There may be two reasosn that come to my mind.

1.- Have you re-named any object in the tree view? The naming of the objects is important for the workflow and when the input file is created. The error is telling me that there is a structural node that does not have a type (dynamic, static or dummy), and this should not happen unless the user has renamed an object.

2.- Are you using the latest version of the software? I have made some changes to the algorithm that writes the input file lately. If you use old examples with a late version of the software you may get these kind of errors. My advice is to dowload the lastes version regularly, as I am updating it two or three times a week (yes, the software is still in an early stage).

If you can run the precessio example I´ve uploaded then this means the first option could be true.

Hope this helps.
SuperMarty
Posts: 24
Joined: Fri Mar 19, 2021 12:19 pm
Location: France

Re: FreeCAD as pre-post processor for MBDyn

Post by SuperMarty »

Thank @josegegas you for your quick reply.
I did not rename an object in the tree view. But I deleted rigid bodies and structural nodes in order to restart the example from zero.

In addition, I have just updated the version of the Workbench. Now the error message, with the same file, has changed :

19:28:05 Running the Python command 'MBdyn_AddMBD' failed:
Traceback (most recent call last):
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/MBdynGui.py", line 657, in Activated
dyn.WriteInputFile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/dynamics.py", line 562, in WriteInputFile
Writeinpfile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/writeinpfile.py", line 98, in __init__
listlines.append(' derivatives coefficient: '+MBDyn.derivatives_coefficient+';\n')

'FeaturePython' object has no attribute 'derivatives_coefficient'


Do I need to restart from scratch ? Do you need more info for your debbuging ?
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Post by josegegas »

SuperMarty wrote: Fri Apr 09, 2021 5:41 pm Thank @josegegas you for your quick reply.
I did not rename an object in the tree view. But I deleted rigid bodies and structural nodes in order to restart the example from zero.

In addition, I have just updated the version of the Workbench. Now the error message, with the same file, has changed :

19:28:05 Running the Python command 'MBdyn_AddMBD' failed:
Traceback (most recent call last):
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/MBdynGui.py", line 657, in Activated
dyn.WriteInputFile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/dynamics.py", line 562, in WriteInputFile
Writeinpfile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/writeinpfile.py", line 98, in __init__
listlines.append(' derivatives coefficient: '+MBDyn.derivatives_coefficient+';\n')

'FeaturePython' object has no attribute 'derivatives_coefficient'


Do I need to restart from scratch ? Do you need more info for your debbuging ?

I think that since it takes only a few minutes the easiest solution would be to do it again. If you want you can also share the broken model with me, I´ll have a look and probably add a try/catch for this error.

Are you able to run the examples I have provided? You may also compare your file with the example, to see what´s missing...
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Post by josegegas »

SuperMarty wrote: Fri Apr 09, 2021 5:41 pm Thank @josegegas you for your quick reply.
I did not rename an object in the tree view. But I deleted rigid bodies and structural nodes in order to restart the example from zero.

In addition, I have just updated the version of the Workbench. Now the error message, with the same file, has changed :

19:28:05 Running the Python command 'MBdyn_AddMBD' failed:
Traceback (most recent call last):
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/MBdynGui.py", line 657, in Activated
dyn.WriteInputFile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/dynamics.py", line 562, in WriteInputFile
Writeinpfile()
File "/home/martial/.FreeCAD/Mod/freecad-mbdyn-dynamics-workbench-master/writeinpfile.py", line 98, in __init__
listlines.append(' derivatives coefficient: '+MBDyn.derivatives_coefficient+';\n')

'FeaturePython' object has no attribute 'derivatives_coefficient'


Do I need to restart from scratch ? Do you need more info for your debbuging ?
Ok I got your file. There were two errors.

First, 'FeaturePython' object has no attribute 'derivatives_coefficient' was because you created the file with an earlier version of the software, in which the variable 'derivatives_coefficient' was not implemented yet.

Second, you had a material object floating around without any body or node.

I have fixed both problems (see attached) so you can continue....
Attachments
Tuto-GyroscopicPrecessionCAD.FCStd
(62.62 KiB) Downloaded 48 times
Error.png
Error.png (356.96 KiB) Viewed 2502 times
SuperMarty
Posts: 24
Joined: Fri Mar 19, 2021 12:19 pm
Location: France

Re: FreeCAD as pre-post processor for MBDyn

Post by SuperMarty »

Wonderful @josegegas. It works perfectely !
Post Reply