Parameters: |
---|
This is the base class for all potential energies in a System. It should never be created directly. Potential energies are created by instantiating a specific type of potential energy.
See trep.potentials - Potential Energies for the built-in types of potential energy. Additional potentials can be added through either the Python or C-API.
Potential energies represent conservative forces in a mechanical system like gravity and springs. Implementing these forces as potentials energies instead of generalized forces will result in improved simulations with better energetic and momentum conserving properties.
The name of this potential energy or None.
Return type: | Float |
---|
Return the value of this potential energy at the system’s current state. This function should be implemented by derived Potentials.
Desired Calculation | Required |
---|---|
Continuous Dynamics | n |
1st Derivative | n |
2nd Derivative | n |
Discrete Dynamics | n |
1st Derivative | n |
2nd Derivative | n |
Note
This actual potential value is not used in discrete or continuous time dynamics/derivatives, so you do not need to implement it unless you need it for your own calculations. However, implementing it allows one to compare the derivative V_dq() with a numeric approximation based on V() to help debug your potential.
Parameters: | q1 (Config) – Derivative variable |
---|---|
Return type: | Float |
Return the derivative of V with respect to q1.
Desired Calculation | Required |
---|---|
Continuous Dynamics | Y |
1st Derivative | Y |
2nd Derivative | Y |
Discrete Dynamics | Y |
1st Derivative | Y |
2nd Derivative | Y |
Parameters: | |
---|---|
Return type: | Float |
Return the second derivative of V with respect to q1 and q2.
Desired Calculation | Required |
---|---|
Continuous Dynamics | n |
1st Derivative | Y |
2nd Derivative | Y |
Discrete Dynamics | Y |
1st Derivative | Y |
2nd Derivative | Y |
Parameters: | |
---|---|
Return type: | Float |
Return the third derivative of V with respect to q1, q2, and q3.
Desired Calculation | Required |
---|---|
Continuous Dynamics | n |
1st Derivative | n |
2nd Derivative | Y |
Discrete Dynamics | n |
1st Derivative | n |
2nd Derivative | Y |
It is important that the derivatives of V() are correct. The easiest way to check their correctness is to approximate each derivative using numeric differentiation. These methods are provided to perform this test. The derivatives are only compared at the current configuration of the system. For improved coverage, try running each test several times at different configurations.
Parameters: |
|
---|---|
Return type: | Boolean indicating if all tests passed |
Check the derivatives against the approximate numeric derivative calculated from one less derivative (i.e,, approximate V_dq() from V() and V_dqdq() from V_dq()).
See System.test_derivative_dq() for details of the approximation and comparison.