Physics Introduction

ProtoTwin includes a powerful rigid-body physics engine capable of simulating collisions, friction, restitution, compliant (soft) contacts, sensors, joints and more. Computational multi-body physics is a core part of ProtoTwin and understanding how rigid bodies are simulated can help you become more proficient with the software.

Simulation Pipeline

Computational physics simulation involves discretizing time into time-steps (frames). The following operations are performed each time-step:

  1. Update functions
  2. Collision detection
  3. Constraint solving
  4. Dynamic response
  5. Post update functions

ProtoTwin uses a 10ms (100Hz) time-step by default, but this can be easily changed through the physics settings. Reducing the time-step will improve the accuracy and stability of the physics simulation, but reduce the maximum speed at which the simulation can run. The default 10ms time-step provides a good balance between simulation quality and performance. Simulation of small parts or fast moving machinery may require the use of a smaller time-step.

Update Functions

Component update functions are executed at the start of the time-step. This allows any component to take actions, such as applying forces or setting motor properties, that will affect the physics simulation. You can create your own custom components and provide update functions for those components.

Collision Detection

Intersections between physics colliders are detected, generating a set of contact points between each pair. Each contact point provides a non-penetration constraint and a friction constraint. The computational cost of detecting collisions depends on the number of colliders in the scene along with the types of colliders. Primitive colliders, such as sphere, box and plane colliders are generally more efficient then convex colliders. Non-convex (mesh) colliders are the most computationally expensive and should generally be avoided wherever possible.s

Constraint Solving

All the constraints generated during the collision detection stage, along with the constraints provided by any joints, are solved using an efficient iterative solver. ProtoTwin uses 16 positional and 2 velocity solver iterations by default, balancing simulation quality and performance. The number of iterations can be changed through the physics settings. A higher number of iterations may be required when there are interactions between rigid bodies with large mass ratios. It is recommended to try increasing the number of iterations before reducing the time-step, since the computation cost for increased iteration counts is less than the cost of reducing the time-step.

Dynamic Response

The result of solving the constraints is a set of impulses, which are applied to the rigid bodies to resolve the constraints. External forces, such as gravity, are also applied. The resulting accelerations are integrated to determine the velocities and the velocities are integrated to update the positions of all rigid bodies.

Post Update Functions

Component postUpdate functions are executed at the end of the time-step. This allows any component to take actions after the physics has been updated. This is generally used to update signals so that the most recent values may be accessed by connected PLCs or a Python client for reinforcement learning.

Physics Fidelity

The accuracy and stability of the physics simulation can be controlled using the time-step and solver iteration settings. ProtoTwin is able to simulate very small time-steps, making it ideal for simulating small parts and fast moving machinery. Parts with dimensions as small as a few tens of microns can be simulated reliably if the time-step is set appropriately. This capibility sets ProtoTwin apart from other industrial simulation software, making it an ideal choice for machine builders.