Class SimMotorState

java.lang.Object
org.ironmaple.simulation.motorsims.SimMotorState

public class SimMotorState extends Object

Represents the state of a simulated motor at a given point in time.

This record holds the final angular position and velocity of the motor. It is used to track the motor's state during each simulation step.

  • Field Details

    • mechanismAngularPosition

      public Angle mechanismAngularPosition
    • mechanismAngularVelocity

      public AngularVelocity mechanismAngularVelocity
  • Constructor Details

    • SimMotorState

      public SimMotorState(Angle mechanismAngularPosition, AngularVelocity mechanismAngularVelocity)

      Constructs a new sim motor state with initial angle and velocity

      Parameters:
      mechanismAngularPosition - the final angular position of the motor, in radians
      mechanismAngularVelocity - the final angular velocity of the motor, in radians per second
  • Method Details

    • step

      public void step(Torque finalElectricTorque, Torque finalFrictionTorque, MomentOfInertia loadMOI, Time dt)

      Simulates a step in the motor's motion based on the applied forces.

      This method calculates the new angular position and velocity of the motor after applying electric and frictional torques over a time step.

      The method follows these steps:

      • Convert all units to SI units for calculation.
      • Apply the electric torque to the current angular velocity.
      • Compute the change in angular velocity due to friction.
      • If friction reverses the direction of angular velocity, the velocity is set to zero.
      • Integrate the angular velocity to find the new position.
      Parameters:
      finalElectricTorque - the final applied electric torque, in Newton-meters
      finalFrictionTorque - the final frictional torque, in Newton-meters
      loadMOI - the moment of inertia of the load, in kilogram square meters
      dt - the time step for the simulation, in seconds