specifies the names of the HTML elementId's to look for in the HTML document; these elements are where the user interface of the simulation is created.
length of ReactionPendulumSim
Private
radiusradius of rigid body pendulum disk
distance between the pendulum anchor points
Add the control to the set of simulation controls.
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
Protected
getReturns whether broadcasting is enabled for this Subject. See setBroadcast.
whether broadcasting is enabled for this Subject
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
Notifies this Observer that a change has occurred in the Subject.
contains information about what has changed in the Subject: typically either a one-time GenericEvent, or a change to the value of a Parameter
Removes 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
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
Set length of ReactionPendulumSim rod, and set length of classic pendulum to equivalent length. See classicLength.
length of ReactionPendulumSim rod
Set radius of ReactionPendulumSim bob, and set length of classic pendulum to according equivalent length. See classicLength.
radius of ReactionPendulumSim bob
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.
Generated using TypeDoc
Displays the reaction forces pendulum simulation ReactionPendulumSim and compares it to the classic pendulum simulation PendulumSim which is shown alongside. The simultaneous simulations show that the two pendulums are equivalent in their motion. This also confirms that the calculation for equivalent arm length (see below) is correct.
Something to notice is that the reaction force diverges more from the stick vector as the size of disk increases. This is because a smaller disk is closer to the ideal of a point mass in the classic pendulum simulation.
Keep Parameters Synchronized
We keep the parameters for gravity, mass and length of pendulum synchronized between the two simulations (though length is slightly different, see below).
The damping model is different for the two simulations so we don't try to synchronize the damping; we just leave both simulations with zero damping.
Length of Equivalent Classic Pendulum
To match the motion of the two simulations, the lengths are slightly different. The ReactionPendulumSim simulation models the pendulum as a rigid disc with mass distributed evenly. The classic ideal PendulumSim models the pendulum as a point mass at the end of a massless rod.
We want to find the length of the simple ideal pendulum that is equivalent to the rigid body disk pendulum.
Rotation of a solid cylinder of radius
r
about its cylinder axis has rotational inertiaUse parallel axis theorem, where the CM (center of mass) is at distance
h
from the pivot point, to get rotational inertia of:Use rotational analog of Newton's second law of motion about a fixed axis which is
Here the only torque is from gravity at the CM:
expand this using the value for I found above
what would be the equivalent length of a simple point mass pendulum? Let
then we have
equating the two we get
So the equivalent ideal pendulum is longer:
R > h
Another Way to Calculate Equivalent Length
Here's another way to calculate equivalent classic ideal pendulum length. Suppose we have rotational inertia about the pivot point (not about the CM) is
I
, and length to the CM ish
.What would be the equivalent length
R
of an ideal (point mass) pendulum? For ideal pendulum, as above:Equating these gives:
If we put in the value for
I
above:which is the same as the previous answer.
App Setup
Creates instance objects such as the simulation and display objects; defines regular expressions for easy Terminal scripting of these objects using short names instead of fully qualified property names.
The constructor takes an argument that specifies the names of the HTML elementId's to look for in the HTML document; these elements are where the user interface of the simulation is created. This allows for having two separate simulation apps running concurrently on a single page.
A global variable is created for this application instance outside of this file in the HTML where the constructor is called. The name of that global variable holding the application is passed to defineNames() method so that short-names in scripts can be properly expanded.