sensors¶
- class AbsoluteRotaryEncoder(target: RotatingObject)
Bases:
SensorBaseAbsoluteRotaryEncoderobject.Attributes¶
targetRotatingObjectTarget rotating object whose angular position is probed by the sensor.
Methods¶
get_value()It gets the angular position of the
targetrotating object.
- get_value(unit: str | None = None) AngularPosition | float | int
It gets the angular position of the
targetrotating object.If a
unitis set, then it converts the angular position to that unit and returns only the numerical value as float or integer.Parameters¶
unitstr, optionalThe unit to which convert the
targetangular position. If specified, it converts the angular position and returns only the numerical value as float or integer, otherwise it returns anAngularPosition. Default isNone, so it returns anAngularPosition.
Returns¶
AngularPositionorfloatorintAngular position of the
targetrotating object.
Raises
TypeErrorIf
unitis not astr.
- property target: RotatingObject
Target rotating object whose angular position is probed by the sensor.
Returns¶
RotatingObjectTarget rotating object whose angular position is probed by the sensor.
Raises
TypeErrorIf
targetis not an instance ofRotatingObject.
- class Amperometer(target: MotorBase)
Bases:
SensorBaseAmperometerobject.Attributes¶
Methods¶
get_value()It gets the electric current of the
targetmotor object.
- class SensorBase
Bases:
ABCSensorBaseobject.Abstract base class for creating sensor objects.
- abstract property target: RotatingObject
- class Tachometer(target: RotatingObject)
Bases:
SensorBaseTachometerobject.Attributes¶
targetRotatingObjectTarget rotating object whose angular speed is probed by the sensor.
Methods¶
get_value()It gets the angular speed of the
targetrotating object.
- get_value(unit: str | None = None) AngularSpeed | float | int
It gets the angular speed of the
targetrotating object.If a
unitis set, then it converts the angular speed to that unit and returns only the numerical value as float or integer.Parameters¶
unitstr, optionalThe unit to which convert the
targetangular speed. If specified, it converts the angular speed and returns only the numerical value as float or integer, otherwise it returns anAngularSpeed. Default isNone, so it returns anAngularSpeed.
Returns¶
AngularSpeedorfloatorintAngular speed of the
targetrotating object.
Raises
TypeErrorIf
unitis not astr.
- property target: RotatingObject
Target rotating object whose angular speed is probed by the sensor.
Returns¶
RotatingObjectTarget rotating object whose angular speed is probed by the sensor.
Raises
TypeErrorIf
targetis not an instance ofRotatingObject.
- class Timer(start_time: Time, duration: TimeInterval)
Bases:
objectTimerobject.Attributes¶
start_timeTimeStart time after which the timer is active.
durationTimeIntervalTime duration of the timer, starting from
start_time.
Methods¶
is_active()It checks if the simulation
current_timeis greater than or equal tostart_timebut lower than or equal to the sum ofcurrent_timeandduration.
- property duration: TimeInterval
Time duration of the timer, starting from
start_time.Returns¶
TimeIntervalTime duration of the timer, starting from
start_time.
Raises
TypeErrorIf
durationis not an instance ofTimeInterval.
- is_active(current_time: Time) bool
It checks if the simulation
current_timeis greater than or equal tostart_timebut lower than or equal to the sum ofcurrent_timeandduration.Parameters¶
current_timeTimeCurrent time of the simulation, to be compared with
start_timeandduration.
Returns¶
boolWhether
current_timeis greater than or equal tostart_timebut lower than or equal to the sum ofstart_timeandduration.
Raises
TypeErrorIf
current_timeis not an instance ofTime.
- property start_time: Time
Start time after which the timer is active.
Returns¶
TimeStart time after which the timer is active.
Raises
TypeErrorIf
start_timeis not an instance ofTime.