Sofa.Unit : handling your simulation units #6199
hugtalbot
announced in
Announcement
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
A first discussion about how to manage the units of your simulation was open. The recent SOFA v26.06 release (#622) introduced a new Python utility to manage units of your simulation. This Python project provides a class defining the unit system of your scene while allowing the user to define each parameter in any units.
Required import
Declare your scene units
In case you want to make sure all units of your scene are expressed using the same base units (length, time and mass units) you can now specify these units as follows:
Define the scene parameters in any unit
For all scene parameters, you can now define them using any unit. The utility can scale these parameter units the scene units declared above!
As you can see, units can be composed naturally using multiplication, division and power operation to create a so called derived unit.
Finally, every unit type can then be scaled to create new faction of basic unit (like mm which is 1.0e-3*m). You might for instance want to create your own scaled unit, :
We hope this utility will help you making the units of your scene more robust!
Big up to @bakpaul
All reactions