Skip to main content

Vehicle

A class to represent a Vehicle.

Vehicles are specialized Resources used for material transport and logistics operations. They represent mobile equipment such as automated guided vehicles (AGVs), forklifts, manual transport vehicles, or any other mobile equipment used for moving parts and products. The Vehicle class extends the Resource class to include vehicle-specific capabilities and parameters for movement, energy management, and load handling.

Vehicles are connected to various components in the manufacturing system:

  • Routes they can traverse
  • Locations they move between
  • Products or Parts they can transport
  • Actions they should perform
  • Sensors monitoring their status
  • Workers authorized to operate them

Best Practices:

  • Monitor battery levels and charging status
  • Track vehicle location in real-time
  • Maintain load capacity constraints
  • Schedule preventive maintenance
  • Monitor environmental impact
  • Optimize route selection
  • Ensure safety compliance

Attributes:

NameData TypeDescription
namestrHuman-readable name of the Vehicle
vehicle_typeVehicleTypeType of vehicle. See VehicleType
georeferenceList[float]Current location coordinates [x, y] or [x, y, z]
idstrUnique identifier
statusResourceStatusCurrent operational status. See ResourceStatus
power_typestrPower source
power_consumptionfloatPower usage in kWh
maintenance_intervalintHours between required maintenance
last_maintenancedatetimeTimestamp of last maintenance
hours_usedfloatTotal hours of use since last maintenance
actorsList[Actor]Workers authorized to operate this vehicle
sensorsList[Sensor]Sensors on-board this vehicle
actionsList[Action]Actions associated with this vehicle
constraintsList[constraints]Operating constraints
fuelstrType of fuel or power source
average_fuel_consumptionfloatAverage fuel consumption rate
emission_standardstrApplicable emission standard
load_capacitiesdictMaximum load capacity specifications
lengthfloatVehicle length in meters
heightfloatVehicle height in meters
widthfloatVehicle width in meters
license_platestrVehicle identification plate
empty_weightfloatWeight without load in kg
average_speedfloatNormal operating speed in meters/second
speedfloatCurrent actual speed in meters/second
co2_emissionfloatCO2 emissions in g/km
nox_emissionfloatNOx emissions in g/km
noise_pollutionfloatNoise level in dB
land_usefloatSpace requirement in m²
battery_capacityfloatTotal battery capacity in kWh
battery_thresholdfloatMinimum battery level for operation
battery_charging_ratefloatCharging rate in kW
energy_consumption_movingfloatEnergy use while moving in kWh/km
energy_consumption_idlingfloatEnergy use while idle in kWh/h
creation_datedatetimeTimestamp when vehicle was created
last_modifieddatetimeTimestamp of last modification

Example Configuration:

vehicle = Vehicle(
name="AGV-001",
vehicle_type=VehicleType.AUTOMATED_MOBILE_ROBOT,
average_speed=1.0, # m/s
battery_capacity=10.0, # kWh
battery_threshold=0.2, # 20%
load_capacities={"weight": 150} # kg
)
note

The Vehicle class inherits base attributes from the Resource class while adding specialized capabilities for transport operations. Use this class for any mobile equipment used in material handling and logistics.

Inheritance

Inherits from: Resource

Constructor

def __init__(self, name: str, vehicle_type: omm.VehicleType, georeference: List[float], status: omm.ResourceStatus = <ResourceStatus.IDLE: 4>, id: Optional[str] = None, power_type: Optional[str] = 'electric', power_consumption: float = 0, maintenance_interval: float = 0, last_maintenance: Optional[datetime.datetime] = None, actors: Optional[List[~ActorT]] = None, sensors: Optional[List[~SensorT]] = None, actions: Optional[List[~ActionT]] = None, constraints: Optional[List[~ConstraintT]] = None, fuel: Optional[str] = None, average_fuel_consumption: Optional[float] = None, emission_standard: Optional[str] = None, load_capacities: Optional[dict] = None, length: Optional[float] = None, height: Optional[float] = None, width: Optional[float] = None, license_plate: Optional[str] = None, empty_weight: Optional[float] = None, average_speed: float = 1.0, co2_emission: float = 0, nox_emission: float = 0, noise_pollution: float = 0, land_use: float = 0, battery_capacity: float = 0, battery_threshold: float = 0, battery_charging_rate: float = 0, energy_consumption_moving: float = 0, energy_consumption_idling: float = 0) -> None:

Initialize a Vehicle instance.

Properties

actions

Return a copy of the resource's actions.

@property
def actions(self):
# Returns typing.List[~ActionT]

actors

Return a copy of the resource's actors.

@property
def actors(self):
# Returns typing.List[~ActorT]

battery_threshold

Return the vehicle's battery threshold.

@property
def battery_threshold(self):
# Returns <class 'float'>

constraints

Return the resource's constraints.

@property
def constraints(self):
# Returns typing.Optional[typing.List[~ConstraintT]]

entries

Return the number of entries for the resource.

@property
def entries(self):
# Returns <class 'int'>

exits

Return the number of exits for the resource.

@property
def exits(self):
# Returns <class 'int'>

georeference

Return the resource's georeference.

@property
def georeference(self):
# Returns typing.List[float]

last_modified

Return the last modified timestamp.

@property
def last_modified(self):
# Returns <class 'datetime.datetime'>

sensors

Return a copy of the resource's sensors.

@property
def sensors(self):
# Returns typing.List[~SensorT]

speed

Return the vehicle's actual speed.

@property
def speed(self):
# Returns <class 'float'>

status

Return the status of the resource.

@property
def status(self):
# Returns <enum 'ResourceStatus'>

Methods

add_action

Add a single action to the resource's actions.

def add_action(self, action: ~ActionT) -> None:

add_actor

Add an actor to the resource.

def add_actor(self, actor: ~ActorT) -> None:

add_constraint

Add a single constraint to the resource's constraints.

def add_constraint(self, constraint: ~ConstraintT) -> None:

get_current_action

Get the current in-progress action.

def get_current_action(self) -> Optional[~ActionT]:

needs_maintenance

Check if tool needs maintenance based on usage hours.

def needs_maintenance(self) -> bool:

operate

Operate Resource.

def operate(self) -> None:

perform_maintenance

Perform maintenance on the tool.

def perform_maintenance(self) -> None:

remove_action

Remove a specific action from the resource's actions.

def remove_action(self, action: ~ActionT) -> None:

remove_actor

Remove an actor from the resource.

def remove_actor(self, actor: ~ActorT) -> None:

remove_constraint

Remove a specific constraint from the resource's constraints.

def remove_constraint(self, constraint: ~ConstraintT) -> None:

start_charging

Start charging the vehicle.

def start_charging(self) -> None:

stop_charging

Stop charging the vehicle.

def stop_charging(self) -> None:

to_dict

Convert the vehicle instance to a dictionary representation.

def to_dict(self) -> Dict[str, Any]:

update_actor

Replace an existing actor with a new actor.

def update_actor(self, old_actor: ~ActorT, new_actor: ~ActorT) -> None:

Example Usage

# Example: Creating an automated guided vehicle (AGV)
agv = Vehicle(
name='AGV_01',
vehicle_type=VehicleType.AUTOMATED_MOBILE_ROBOT,
georeference=[0.0, 0.0, 0.0],
average_speed=1.5, # meters/second
battery_capacity=24.0, # kWh
battery_threshold=20.0, # Minimum battery percentage
battery_charging_rate=4.0, # kW
load_capacities={'max_weight': 500}, # kg
sensors=[
Sensor('battery_level'),
Sensor('proximity'),
Sensor('path_detection')
],
energy_consumption_moving=0.5, # kWh per hour while moving
energy_consumption_idling=0.1 # kWh per hour while idle
)

# Monitor vehicle status and start charging if needed
if agv.battery_threshold > 20:
agv.start_charging()
print(f'Charging vehicle at {agv.battery_charging_rate}kW')

# Adjust speed based on load
agv.speed = agv.average_speed * 0.8 # Reduce speed to 80% for heavy load
print(f'Current speed: {agv.speed} m/s')