Represents a non-linear spring attached between two MassObjects, generates a Force which depends on how the SpringNonLinear1 is stretched. Damping is proportional to the relative velocity of the two objects.

The force equation is:

f(x) = S(6*Math.pow(x,-1) - Math.pow(x/2, -3))
x = distance between masses
S = resisting force constant

The potential energy is the integral of the force:

PE(x) = S(6 * Math.log(x) + 4*Math.pow(x, -2))

The minimum PE occurs where the force is zero:

S(6*Math.pow(x,-1) = Math.pow(x/2, -3))
6/x = 8 x^-3
3/4 = x^-2
x_min = sqrt(4/3) = 2/sqrt(3)

We subtract the minimum PE from the reported PE so that PE is zero at it's minimum.

To attach one end to a fixed point you can attach to an infinite mass MassObject or a Scrim.

Hierarchy (view full)

Implements

Constructors

  • Parameters

    • name: string

      language-independent name of this object

    • body1: MassObject

      body to attach to start point of the SpringNonLinear1

    • attach1_body: GenericVector

      attachment point in body coords of body1

    • body2: MassObject

      body to attach to end point of the SpringNonLinear1

    • attach2_body: GenericVector

      attachment point in body coords of body2

    • restLength: number

      length of spring when it has no force

    • Optional stiffness: number

      amount of force per unit distance of stretch

    Returns SpringNonLinear1

Properties

minPE_: number = 0

minimum potential energy

ID: number = 1

Counter used for naming SimObjects.

Methods

  • Returns the amount of damping for this spring. Damping is proportional to the relative velocity of the two points.

    Returns number

    amount of damping for this spring

  • Returns the expiration time, when this SimObject should be removed from the SimList. This is intended for temporary SimObjects that illustrate, for example, contact forces or collisions.

    Returns number

    the expiration time, in time frame of the Simulation clock

  • Returns the distance between start and end points of this spring

    Returns number

    the distance between start and end points of this spring

  • Name of this SimObject, either the language-independent name for scripting purposes or the localized name for display to user.

    The language-independent name should be the same as the English version but capitalized and with spaces and dashes replaced by underscore, see Util.toName, nameEquals.

    The name should give an idea of the role of the SimObject in the simulation. This allows us to to treat an object in a special way depending on its name. For example, we might use the name to decide what type of DisplayObject to create to represent the SimObject.

    Parameters

    • Optional opt_localized: boolean

      true means return the localized version of the name; default is false which means return the language independent name.

    Returns string

    name of this SimObject

  • Positive stretch means the spring is expanded, negative stretch means compressed.

    Returns number

    the amount that this line is stretched from its rest length

  • Returns length of spring that has minimum potential energy.

    Returns number

    length of spring that has minimum potential energy

  • Returns potential energy for a given length of spring.

    Parameters

    • len: number

      length of spring

    Returns number

    potential energy

  • Sets the value of damping for this spring. Damping is proportional to the relative velocity of the two points.

    Parameters

    • damping: number

      the value of damping for this spring

    Returns Spring

    this Spring to allow chaining of setters

  • Sets the expiration time, when this SimObject should be removed from the SimList. This is intended for temporary SimObjects that illustrate, for example, contact forces or collisions.

    Parameters

    Returns void

  • Sets the rest length of this spring, which is used for calculating the stretch. When length of spring is the rest length, then no force is applied at either end.

    Parameters

    • value: number

      the rest length of this spring

    Returns void

  • Returns true if the given SimObject is similar to this SimObject for display purposes. SimObjects are similar when they are the same type and nearly the same size and location. Mainly used when showing forces - to avoid adding too many objects to the display. See SimList.getSimilar.

    Parameters

    • obj: SimObject

      the SimObject to compare to

    • Optional _opt_tolerance: number

      the amount the object components can differ by

    Returns boolean

    true if this SimObject is similar to obj for display purposes

  • 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'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc