Library for solving a system of strong coupled physical subsystems. Aimed to use in co-simulation, where each slave has mechanical connector points.
The library has support for a number of constraints, see subclasses of sc::Constraint. These can be used to mechanically constrain the connectors to each other.
The code is typically used like so:
- Create slaves (sc::Slave instances). These correspond to subsystems in your co-simulation.
- Create connectors (sc::Connector instances) and add them to the slaves. The connectors are points on which you can connect to other subsystem connectors.
- Constrain two connectors by creating instances of sc::Constraint.
- Add slaves, connectors, constraints to the solver (sc::Solver).
- For each time step in your stepping loop:
- Set position, quaternion, velocity and angular velocity of the connectors.
- Set future velocity and angular velocity of the connectors (you get this by stepping your system one time step forward).
- Set the jacobian for each equation in the system (each sc::Constraint contains at least one sc::Equation). The Jacobian can be imagined as the connector inertia in the constraint directions.
- Solve the system (sc::Solver::solve()).
- Get resulting constraint force and torque from the connectors. Apply these forces to your co-simulation slaves and then do a final step.
Sample code can be found in test/rigid.cpp
To make an out-of-source build in CMake, make a build directory and make it current:
mkdir build;
cd build;
cmake ..;
You need UMFPACK to continue. When running cmake, pass the locations of its include and library paths using -D flags:
cmake .. -DUMFPACK_INCLUDE_DIR=<path> -DUMFPACK_LIBRARY_DIR=<path>
In Ubuntu, UMFPACK is included in the suitesparse package.
Install suitesparse using the following command.
sudo apt-get install suitesparse
And then try running cmake like this:
cmake .. -DUMFPACK_INCLUDE_DIR=/usr/include/suitesparse -DUMFPACK_LIBRARY_DIR=/usr/lib
Finally, run make to compile the code.
make
make install # optional
Install SuiteSparse via MacPorts
port install SuiteSparse;
CMakeLists.txt should add /opt/local/include and /opt/local/lib to the paths for you. Run:
mkdir build;
cd build;
cmake .. && make;
TODO
You need Doxygen to generate the documentation. Build the documentation by doing this:
doxygen Doxyfile;
The HTML files will end up in docs/.
Funded in part by VINNOVA through project Simovate (dnr 2012-01235) and Umeå University, Umeå, Sweden.
0.2
- Added class sc::HingeMotorConstraint
- Added method sc::Equation::setRelativeVelocity
0.1
- Started change log