Motor (hwx.inspire.motion)#

class Motor(self, connection=None, **kwds)#

Bases: MotionConnector

Creates a Motor.

Motors drive parts in a rotational manner, and can be defined in terms of angle, speed, acceleration, or torque. It’s a convenient way to apply a time-dependent torque to your model.

Attribute Table#

Name

Type

Function

tuple

averageValue

EnumUnion

axis

property

baseRotation

Double

baseScale

Double

bodyType

Enum

centerlineJoint

Enum

connectorMode

str

controller

Bool

controllerType

Enum

cyclic

Double

direction

Direction

dtValue

Double

duration

Double

dwellTime

Double

dwellX

UnitsUnion

dxValue

UnitsUnion

entity1

Reference

entity2

Reference

finalFrequency

Double

folder

str

frequency

Double

function

Enum

icVelocity

Double

icon

str

indVarComp

Enum

indVarEntity

Reference

initialFrequency

Double

isHoleBased

property

kd

Double

ki

Double

kp

Double

location1

Location

location2

Location

locked

Bool

mountColor

Color

mountConnection

Reference

penalty

Double

penalty1

Double

phaseShift

Double

profile

ProfileAttribute

profileMode

Enum

restrainCenterline

Bool

reverseDirection

Bool

rotation

Double

sdProfile

SDProfileAttribute

shaftColor

Color

shaftConnection

Reference

shaftDirection

Direction

shaftLocation

Location

shaftRadius

Double

shaftRotation

Double

signalsProfile

EnumUnion

solverVariables

list

span

UnitsUnion

spline

ProfileSpline

splineMethod

Enum

startTime

Double

stepOff

UnitsUnion

stepOn

UnitsUnion

sweepInterval

Double

type

Enum

userFunction

String

userFunctionScale

Double

userFunctionUnits

String

value

EnumUnion

x0

UnitsUnion

x1

UnitsUnion

y0

EnumUnion

y1

EnumUnion

Method Table#

Name

Description

getRotationalValue (self)

Returns the speed angle or acceleration depending on the type of motor.

getShaftRadius (self)

Return the shafts hole radius or the computed radius.

isValidConnection (connection)

Determines if a motor can be created from the Joint.

Example

from hwx import inspire
from hwx.inspire import motion

model = inspire.openTutorialFile("Motion/M01_FourBar.x_t")
shaftFt = model.getChild('Link Crank').features[26]
mountFt = model.getChild('Assembly-Base').getChild('Mount Crank').features[102]
mountFt.part.ground = True

motor = motion.Motor(
   shaftConnection = shaftFt,
   shaftLocation   = shaftFt.location,
   mountConnection = mountFt,
   restrainCenterline = True
)

print("motor.value", motor.value.guiValue)

# Hide irrelevant parts
for part in set(model.parts) - set(motor.getReferences()):
   part.active = False

inspire.fitView()
property type#

Specifies the type of motor, it can be Speed, Angle, Acceleration and Torque. Defaults to a Speed motor.

property controller#

If True, sets the behavior of the Motor specified by function and value properties, else the behavior of the motor will be driven with hand of god type motion.

property value#

Specifies the absolute rotational value of the motor depending of its type. If type of motor is:

  • Angle then the default value is 45 deg,

  • Speed then the default value is 60 rpm,

  • Acceleration then the default value is 1 rad/s2,

  • Torque then the default value is 1 N*m.

property reverseDirection#

If True, reverses the direction of the rotational force, defaults to False.

property locked#

If True, the motor does not rotate during a Motion Analysis (useful for debugging), defaults to False.

property restrainCenterline#

Use to restrain the axis of the motor so it does not move relative to the motor base (or the ground part if no second part is defined).

Choices are Cylindrical or Revolute.

By default, this property is enabled for a motor attached to holes, and disabled for motors attached to surfaces. Disabling this option may result in unexpected part movement, warnings, or errors.

property centerlineJoint#

Specifies what type of joint to be created if Restrain Centerline is enabled.

property icVelocity#

The initial angular velocity of the motor, defaults to 0 rpm.

This is specifiable when the type of motor is Acceleration.

property entity1#

The feature entity motor is attached to.

property location1#

The location of the motor wrt shaftConnection.

property entity2#

The second feature entity motor is attached to.

property location2#

The location of the motor wrt mounttConnection.

property direction#

The direction of the motor wrt shaftConnection.

property shaftConnection#

The feature entity motor is attached to.

property shaftLocation#

The location of the motor wrt shaftConnection.

property shaftDirection#

The direction of the motor wrt shaftConnection.

property mountConnection#

The second feature entity motor is attached to.

property function#

The type of profile function to change how the shaft rotates as time elapses.

The function can be a Step, Step Dwell Step, Single Wave, Oscillating, Swept Sine, Impulse, Ramp, Solver Expression and Table, defaults to Step.

property startTime#

The time at which the motor begins to rotate move during a Motion Analysis.

This is not specifiable when motor function is of type Solver Expression.

property duration#

The amount of time the function will take for Step and Impulse.

For Ramp function duration is defined as the amount of time taken by the motor to achieve the value, defaults to 0.5 s.

property cyclic#

The number of revolution of State dependent variable, when the variable component is cyclic motion.

property initialFrequency#

The initial frequency for the motor function Swept Sine, defaults to 1Hz.

property finalFrequency#

The final frequency for the motor function Swept Sine, defaults to 1Hz.

property sweepInterval#

The amount of time that should be spent transitioning between the initialFrequency and finalFrequency of a Swept Sine function, defaults to 1s.

property averageValue#

The average value for the motor when the function is set to Oscillating, defaults to 0.

property phaseShift#

The angular phase shift of the motor when the function is set to Oscillating, defaults to 0 deg.

property frequency#

Specifies the frequency value in Hz, when the function is set to Oscillating, defaults to 1Hz.

property span#

Specifies the duration of the oscillation, when the function is set to Oscillating or Single Wave.

property dtValue#

Specifies the amount of time allowed to blend in and out of the motor profile.

Specifiable when function is set to Single Wave, Oscillating and Table.

property dxValue#

Specifies the amount of x allowed to blend in and out of the motor profile.

Specifiable when function is set to Single Wave, Oscillating and Table.

property dwellTime#

The amount time of the motor profile dwells.

Specifiable when function is set to Step Dwell Step, defaults to 1 s.

property dwellX#

The amount x of the motor profile dwells.

Specifiable when function is set to Step Dwell Step, defaults to 1 s.

property stepOn#

The amount of x taken to ramp up the Step Dwell Step function

property stepOff#

The amount of x taken to ramp up the Step Dwell Step function

property userFunction#

A motionsolve user expression that will define the behavior of the motor.

Specifiable when function is set to Solver Expression, defaults to TIME.

property userFunctionScale#

The scaling factor for the user expression.

Specifiable when function is set to Solver Expression.

property userFunctionUnits#

The units for the user expression.

Specifiable when function is set to Solver Expression.

property splineMethod#

Specifies the interpolation method for the motor profile.

Interpolation methods can be Akima, Cubic, Linear. Specifiable when function is set to Table.

property controllerType#

The type of controller used to achieve the behavior specified by function and value. Controller type can be PID or Soft Constraint.

Specifiable when motor is of type Displacement or Velocity and controller is set to True.

property kp#

The amount of restoring force that should be applied to overcome position error. Specifiable only when controller type is set to PID.

property ki#

This term multiplied by accumulated error represents the integral term of a PID. Having an integral term minimizes the steady state error.

property kd#

The derivative action of a PID controller enhances stability of the control system by predicting the future behavior.

property penalty#

The proportional factor used in the calculation of the restoring force.

Specifiable only when controller type is set to Soft Constraint.

property penalty1#

The derivative factor used in the calculation of the restoring force.

Specifiable only when controller type is set to Soft Constraint.

property shaftRadius#

Use to adjust the overall size of the motor shaft. This property is not available for motors applied to holes.

property shaftColor#

Specifies the color of the motor shaft.

property mountColor#

Specifies the color of the motor mount.

property bodyType#

Specifies the body type of the motor.

The body type can be Servo, Front Facing, Back Facing, With Mount.

property shaftRotation#

The rotational offset of the motor shaft, defaults to 0 deg.

property rotation#

The rotational offset of the motor base, defaults to 0 deg.

property baseRotation#

The rotational offset of the motor base, defaults to 0 deg.

property baseScale#

Use to change the appearance of the motor shaft and base.

The baseScale property allows you to change the size of the motor; enter a value between 0.5 and 2.0, defaults to 1.

property axis#

Specifies two points along the connector.

This affects the connectors location and position.

getShaftRadius()#

Return the shafts hole radius or the computed radius.

getRotationalValue()#

Returns the speed angle or acceleration depending on the type of motor.