Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype System class. #81

Merged
merged 18 commits into from
Aug 7, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix bug with mass spring damper kwarg.
  • Loading branch information
chrisdembia committed Jul 30, 2014
commit 418c1fca8ec025d3b4f3ed0bf1dd7680d60f9dce
13 changes: 11 additions & 2 deletions pydy/codegen/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import sympy.physics.mechanics as me


def generate_mass_spring_damper_equations_of_motion(external_force=True, kane=False):
def generate_mass_spring_damper_equations_of_motion(external_force=True,
only_return_kane=False):
"""Returns the symbolic equations of motion and associated variables for a
simple one degree of freedom mass, spring, damper system with gravity
and an optional external specified force.
Expand All @@ -26,8 +27,16 @@ def generate_mass_spring_damper_equations_of_motion(external_force=True, kane=Fa
| F
V

Parameters
----------
only_return_kane : bool, optional (default: False)
If True, this method only returns the KanesMethod object.

Returns
-------
kane : KanesMethod
If the keyword argument `only_return_kane` is True, this is the only
object returned.
mass_matrix : sympy.MutableMatrix, shape(2,2)
The symbolic mass matrix of the system which are linear in
derivatives of the states.
Expand Down Expand Up @@ -90,7 +99,7 @@ def generate_mass_spring_damper_equations_of_motion(external_force=True, kane=Fa
else:
specified = None

if kane:
if only_return_kane:
return kane
else:
return (mass_matrix, forcing_vector, constants, coordinates, speeds,
Expand Down