Oriental Motor BLH Agent

This agent is designed to interface with Oriental Motor’s BLH series motor controllers. Only controllers with a model number that includes ‘-KD’ are compatible with this agent. The controller is identified as a serial port, and you can specify the device file using the –port option in the argument. On Ubuntu, the device is recognized without requiring any driver installation and will appear as /dev/ttyACM* (e.g., /dev/ttyACM0, /dev/ttyACM1, etc.), where the number varies depending on the system. A symbolic link to the device file is also available under /dev/serial/by-id/ as usb-ORIENTAL_MOTOR_CO._LTD._ORIENTAL_MOTOR_USB-Deviice_0000000000-if00.

usage: python3 agent.py [-h] [--port PORT]

Agent Options

--port

Default: “/dev/ttyACM0”

Configuration File Examples

Below are configuration examples for the ocs config file.

OCS Site Config

An example site-config-file block:

{'agent-class': 'BLHAgent',
 'instance-id': 'blh',
 'arguments': [ '--port', '/dev/ttyACM0']
 },

Description

The LAT stimulator employs a BLH-series motor controller to rotate the chopper. This agent is responsible for starting and stopping the motor, monitoring the rotation speed,and controlling operational parameters such as the rotation speed. To prevent the controller from stopping the rotation due to inactivity over a certain period, this agent continuously reads the rotation speed during its operation.

The acceleration and deceleration of the motor can be controlled by specifying the time required to reach the desired rotation speed.

Agent API

class socs.agents.orientalmotor_blh.agent.BLHAgent(agent, port='/dev/ttyACM0')[source]

OCS agent class for BLH motor driver

Parameters:

port (string) – Port to connect, default to /dev/ttyACM0

init_blh()[source]

Task - Initialize motor driver.

acq()[source]

Process - Monitor status of the motor.

Parameters:

sampling_frequency (float, optional) – Sampling frequency in Hz, defaults to 2.5 Hz

Notes

An example of the session data:

>>> response.session['data']

{'RPM': 0.0,
 'timestamp': 1736541796.779634
}
set_values(speed=None, accl_time=None, decl_time=None)[source]

Task - Set parameters for BLH motor driver.

Parameters:
  • speed (int, optional) – Motor rotation speed in RPM. Values must be in range [50, 3000].

  • accl_time (float, optional) – Acceleration time. Values must be in range [0.5, 15]

  • decl_time (float, optional) – Deceleration time. Values must be in range [0.5, 15]

start_rotation(forward=True)[source]

Task - Start motor rotation.

Parameters:

forward (bool, default True) – Move forward if True

stop_rotation()[source]

Task - Stop motor rotation.

clear_alarm()[source]

Task - Clear alarm of the driver.

Supporting APIs

class socs.agents.orientalmotor_blh.drivers.BLH(port='/dev/ttyACM0')[source]

BLH motor driver controller

connect()[source]

Make connection to BLH

set_op_number(num)[source]

Set operation number

Parameter

numint

Operation number

set_speed(speed)[source]

Set speed

Parameter

speedint

Speed in RPM

set_accl_time(sec, accl=True)[source]

Set acceleration time

Parameters:
  • sec (float) – Acceleration time in seconds

  • accl (bool, default True) – True: Acceleration setting False: Decceleration setting

get_status()[source]

Get status.

Returns:

speed – Speed in RPM

Return type:

int

start(forward=True)[source]

Start rotation.

Parameter

forwardbool, default True

Move forward if True

returns:

result – True if rotation command published correctly.

rtype:

bool

stop()[source]

Stop rotation

Returns:

result – True if stop command published correctly.

Return type:

bool

clear_alarm()[source]

Clear alarm