Private
L1_distance from pivot 1 to pivot 2
Private
R1_distance from pivot 1 to the center of mass of pendulum 1
Private
R2_distance from pivot 2 to the center of mass of pendulum 2
Private
gamma1_Angle of R1 with respect to vertical in body coords of pendulum 1. Gamma adjustment angle is needed because vector R1 might not be vertical.
Private
gamma2_Angle of R2 with respect to vertical in body coords of pendulum 2.
Private
gravity_gravity
Protected
initialInitial values.
Private
omega1_initial angle of pendulum 1
Private
omega2_initial angle of pendulum 2
Private
pendulum1_upper pendulum
Private
pendulum2_lower pendulum
Private
phi_angle from vector r1 to vector l1
Private
pivot1_upper pivot, joins scrim and pendulum1
Private
pivot2_lower pivot, joins pendulum1 and pendulum2
Private
potentialpotential energy offset
Adds the given Observer to this Subject's list of Observers, so that the Observer
will be notified of changes in this Subject. An Observer may call Subject.addObserver
during its observe
method.
the Observer to add
Adds the Parameter to the list of this Subject's available Parameters.
the Parameter to add
if a Parameter with the same name already exists.
Notifies all Observers that this Subject has changed by calling observe on each Observer.
An Observer may call addObserver or removeObserver during its observe
method.
a SubjectEvent with information relating to the change
Notifies all Observers that the Parameter with the given name has changed by calling observe on each Observer.
the language-independent or English name of the Parameter that has changed
if there is no Parameter with the given name
Defines the differential equations of this ODESim; for an input set of variables, returns the current rate of change for each variable (the first derivative of each variable with respect to time).
The timeStep
is the time since the state variables were last fully calculated, which
can be and often is zero. The current time can be regarded as getTime() + timeStep
.
The input variables correspond to the Simulation state at that time. Note that
timeStep
is different from the time step used to advance the Simulation (as in
AdvanceStrategy.advance).
The timeStep
is typically used when finding collisions in
CollisionSim.findCollisions.
the current array of state variables (input),
corresponding to the state at getTime() + timeStep
array of change rates for each variable (output), all values are zero on entry.
the current time step (might be zero)
null
if the evaluation succeeds, otherwise an object relating to the
error that occurred. The change
array contains the output results.
Protected
getReturns whether broadcasting is enabled for this Subject. See setBroadcast.
whether broadcasting is enabled for this Subject
Returns the current EnergyInfo for this system.
an EnergyInfo object representing the current energy of this system.
Returns the ParameterBoolean with the given name.
the language-independent or English name of the ParameterBoolean
the ParameterBoolean with the given name
if there is no ParameterBoolean with the given name
Returns the ParameterNumber with the given name.
the language-independent or English name of the ParameterNumber
the ParameterNumber with the given name
if there is no ParameterNumber with the given name
Returns the ParameterString with the given name.
the language-independent or English name of the ParameterString
the ParameterString with the given name
if there is no ParameterString with the given name
Private
moveRemoves the Observer from this Subject's list of Observers. An Observer may
call removeObserver
during its observe
method.
the Observer to detach from list of Observers
Removes the Parameter from the list of this Subject's available Parameters.
the Parameter to remove
Sets the Simulation back to its initial conditions, see saveInitialState, and calls modifyObjects. Broadcasts event named 'RESET'.
Restores the Simulation state that was saved with saveState.
Saves the current variables and time as the initial state, so that this initial state can be restored with reset. Broadcasts event named 'INITIAL_STATE_SAVED'.
Saves the current state of the Simulation, so that we can back up to this state later on. The state is defined mainly by the set of Simulation variables, see getVarsList, but can include other data. This state is typically used for collision detection as the before collision state, see CollisionSim.findCollisions.
Protected
setSets whether this Subject will broadcast events, typically used to temporarily disable broadcasting. Intended to be used in situations where a subclass overrides a method that broadcasts an event. This allows the subclass to prevent the superclass broadcasting that event, so that the subclass can broadcast the event when the method is completed.
whether this Subject should broadcast events
the previous value
Private
setSets the Terminal object that this simulation can print data into.
the Terminal object that this simulation can print data into.
Protected
setSets the VarsList for this simulation.
the VarsList to use in this simulation
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Static
getReturns angle between vertical (in body coordinates) and the vector from joint to
center of mass of the pendulum. If the pendulum were hanging at rest from the joint
with no forces other than gravity acting, then the angle of the pendulum would be
-gamma
.
angle between vertical (in body coordinates) and the vector from joint to center of mass of the pendulum
if the pendulum is not one of the bodies of the joint
Static
makeCreates a double pendulum with centered mass and joints. The two rectangular bodies are attached together as a double pendulum. The center of mass is at geometric center of each pendulum, and joints are along the vertical center line of each body.
angle at joint of scrim and pendulum1
angle at joint of pendulum1 and pendulum2
Optional
pivot: Vectorlocation of fixed joint connecting to Scrim, in world coords
Static
makeCreates a double pendulum with offset center of mass and offset joints. The two rectangular bodies are attached together as a double pendulum. The center of mass of the upper pendulum is offset from its geometric center. The joint connecting the two bodies is not along the vertical center line of either body, but is offset.
angle at joint of scrim and pendulum1
angle at joint of pendulum1 and pendulum2
Optional
pivot: Vectorlocation of fixed joint connecting to Scrim, in world coords
Generated using TypeDoc
Simulation of a double pendulum as two rigid bodies. This uses RigidBody's and Joint's, but only for geometry and display. This does not use the general physics engine ContactSim, instead this is a specialized simulation like DoublePendulumSim.
For derivation of equations of motion, see the paper Double Pendulum as Rigid Bodies by Erik Neumann, April 2, 2011.
TO DO: explain how and why the angle-1 variable is different from the angle-1 parameter. Perhaps rename the angle-1 parameter to be omega-1 to reduce confusion. Perhaps allow setting of the angle-1 variable directly, and then adapt accordingly.
TO DO: figure out what the real rest state is (it is not all zero angles), which will also fix the energy calculation.
TO DO: add damping
TO DO: derive equations of motion using Lagrangian method