wire_st_sdk.iolink package¶
Submodules¶
wire_st_sdk.iolink.iolink_device module¶
iolink_device
The iolink_device module represent a device capable of connecting to an IO-Link masterboard and sending/receiving data to it.
-
class
wire_st_sdk.iolink.iolink_device.IOLinkDevice(master, position, id, name=None)[source]¶ Bases:
objectIO-Link Device class.
This class manages the commands of a standard IO-Link device.
-
__init__(master, position, id, name=None)[source]¶ Constructor.
- Parameters
master (
wire_st_sdk.iolink.iolink_master.IOLinkMaster) – Masterboard object.position (int) – Device’s position according to the enumeration on the masterboard.
id (str) – Device’s identifier.
name (str) – Device’s name.
-
get_features()[source]¶ Get the list of features.
- Returns
A list with the available features.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
get_firmware()[source]¶ Get the version of the firmware.
- Returns
The version of the firmware as a string.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
wire_st_sdk.iolink.iolink_master module¶
iolink_master
The iolink_master module is responsible for managing IO-Link capable devices connected to an iolink masterboard and allocating the needed resources.
-
class
wire_st_sdk.iolink.iolink_master.IOLinkMaster(serial_port)[source]¶ Bases:
objectIO-Link Master class.
This class manages the communication between the host and the masterboard.
-
__init__(serial_port)[source]¶ Constructor.
- Parameters
serial_port (Serial) – Serial Port object. Refer to Serial for more information.
-
add_listener(listener)[source]¶ Add a listener.
- Parameters
listener (
wire_st_sdk.iolink.iolink_master.IOLinkMasterListener) – Listener to be added.
-
connect()[source]¶ Start the communication between the masterboard and the host to which it is connected.
- Returns
The status of the connection.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
disconnect()[source]¶ End the communication between the masterboard and the host to which it is connected.
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
-
get_device(device_id, device_name=None)[source]¶ Configure and get a connected device.
- Parameters
- Returns
IOLink connected device if the device identifier is correct, None otherwise.
- Return type
- Raises
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
get_device_by_position(device_position, device_name=None)[source]¶ Configure and get a connected device.
- Parameters
- Returns
IOLink connected device if there is a device connected at the given device position, None otherwise.
- Return type
- Raises
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
ValueError – if the device position is not allowed.
-
get_port()[source]¶ Get the serial port of the masterboard.
- Returns
Serial Port object. Refer to Serial for more information.
- Return type
Serial
-
is_connected()[source]¶ Check whether the master is connected.
- Returns
True if the master is connected, False otherwise.
- Return type
-
remove_listener(listener)[source]¶ Remove a listener.
- Parameters
listener (
wire_st_sdk.iolink.iolink_master.IOLinkMasterListener) – Listener to be removed.
-
-
class
wire_st_sdk.iolink.iolink_master.IOLinkMasterListener[source]¶ Bases:
objectInterface used by the
wire_st_sdk.iolink.IOLinkMasterclass to notify changes of a masterboard’s status.-
abstract
on_device_found(masterboard, device_id, device_position)[source]¶ To be called whenever a masterboard finds a new device connected.
- Parameters
masterboard (
wire_st_sdk.iolink.iolink_master.IOLinkMaster) – Masterboard that has found a new device.device_id (str) – New device found.
device_position (int) – Position of the new device found.
- Raises
NotImplementedError – is raised if the method is not implemented.
-
abstract
on_status_change(masterboard, new_status, old_status)[source]¶ To be called whenever a masterboard changes its status.
- Parameters
masterboard (
wire_st_sdk.iolink.iolink_master.IOLinkMaster) – Masterboard that has changed its status.new_status (
wire_st_sdk.iolink.iolink_master.IOLinkMasterStatus) – New status.old_status (
wire_st_sdk.iolink.iolink_master.IOLinkMasterStatus) – Old status.
- Raises
NotImplementedError – is raised if the method is not implemented.
-
abstract
-
class
wire_st_sdk.iolink.iolink_master.IOLinkMasterStatus[source]¶ Bases:
enum.EnumStatus of the masterboard.
-
CONNECTED= 'CONNECTED'¶ Connected to the host.
-
CONNECTING= 'CONNECTING'¶ Opening a connection with the host.
-
DISCONNECTING= 'DISCONNECTING'¶ Closing the connection to the host.
-
IDLE= 'IDLE'¶ Waiting for a connection.
-
INIT= 'INIT'¶ Dummy initial status.
-
wire_st_sdk.iolink.iolink_protocol module¶
iolink_protocol
The iolink_protocol module contains definitions related to the IO-Link protocol.
-
class
wire_st_sdk.iolink.iolink_protocol.FLS[source]¶ Bases:
enum.EnumAllowed parameters’ values for FLS. Accelerometer’s full scale.
-
FLS_16= 16¶
-
FLS_2= 2¶
-
FLS_4= 4¶
-
FLS_8= 8¶
-
-
class
wire_st_sdk.iolink.iolink_protocol.IOLinkProtocol[source]¶ Bases:
objectThis class lists the protocol’s commands used for IO-Link communication.
-
ACK= '1'¶ Acknowledgement.
-
BYTES_TRANSMISSION= True¶ If True, transmission of data is by bytes; by characters otherwise.
-
COMMAND_ACQ= 'ACQ\r\n'¶ Set accelerometer’s total acquisition time (all types of analysis).
-
COMMAND_END= 'COMMAND END\r\n'¶ Close actual programming mode and change node.
-
COMMAND_FLS= 'FLS\r\n'¶ Set accelerometer’s full scale.
-
COMMAND_GET= 'STS\r\n'¶ Get sensor’s status, vibration peak, RMS, or vibration overtoken.
-
COMMAND_GET_1= 'MCU\r\n'¶ Microcontroller’s identifier.
-
COMMAND_ICD= 'DEVICE\r\n'¶ IO-Link communication mode.
-
COMMAND_ICM= 'MASTER\r\n'¶ Master settings mode.
-
COMMAND_ID= 'IDS\r\n'¶ Get sensors list.
-
COMMAND_MEAS1= 'MSR\r\n'¶ Request for measurement.
-
COMMAND_MEAS1_1= 'RAW\r\n'¶ RAW data.
-
COMMAND_MEAS1_2= 'TDM\r\n'¶ Time domain data.
-
COMMAND_MEAS1_3= 'ENV\r\n'¶ Environmental data.
-
COMMAND_MEAS1_4= 'FFT\r\n'¶ Fast Fourier Transform data.
-
COMMAND_NEW= 'COMMAND NEW\r\n'¶ Continue programming on the same node.
-
COMMAND_ODR= 'ODR\r\n'¶ Set accelerometer’s output data rate.
-
COMMAND_OVL= 'OVL\r\n'¶ Set accelerometer’s overlapping percentage between two consecutive FFT analysis.
-
COMMAND_RDC= 'RD_C\r\n'¶ L6360 read curent mode.
-
COMMAND_RDS= 'RD_S\r\n'¶ L6360 read sequential mode.
-
COMMAND_SET= 'SET\r\n'¶ Set sensor parameter.
-
COMMAND_SET1= 'SENSOR CNF\r\n'¶ Sensor configuration parameters.
-
COMMAND_SET1_1= 'SENSOR ACC CNF\r\n'¶ Sensor configuration accelerometer parameters.
-
COMMAND_SET1_2= 'SENSOR ACC CPT\r\n'¶ Sensor configuration computation parameters.
-
COMMAND_SP= 'PRM\r\n'¶ Get sensor’s parameter.
-
COMMAND_SP1= 'SENSOR ACC PRM\r\n'¶ Get accelerometer’s data.
-
COMMAND_SP2= 'SENSOR ENV PRM\r\n'¶ Get evironmental data.
-
COMMAND_START= 'START\r\n'¶ Open RS485 communication.
-
COMMAND_SUB= 'SUB\r\n'¶ Set accelerometer’s number of subranges.
-
COMMAND_SZE= 'SZE\r\n'¶ Set accelerometer’s input array size for FFT.
-
COMMAND_WRC= 'WR_C\r\n'¶ L6360 write curent mode.
-
COMMAND_WRS= 'WR_S\r\n'¶ L6360 write sequential mode.
-
MESSAGE_CONNECTED= 'CONNECTED\r\n'¶
-
MESSAGE_PARAMETER_ERROR= 'PARAMETER ERROR\r\n'¶
-
MESSAGE_PARAMETER_UPDATED= 'PARAMETER UPDATED\r\n'¶
-
MESSAGE_PROGRAMMING_DONE= 'PROGRAMMING DONE\r\n\r\n'¶
-
MESSAGE_SENSOR_FAILED= 'SENSOR FAILED\r\n'¶
-
MESSAGE_TRANSMISSION_COMPLETED= 'TRANSMISSION COMPLETED\r\n'¶
-
NACK= '0'¶ Non-Acknowledgement.
-
REQUEST_IC= 'INSERT ADDRESS IC :\r\n'¶
-
REQUEST_MEASURE_TYPE= 'INSERT MEASURE TYPE :'¶
-
REQUEST_MOD= 'SELECT MASTER OR DEVICE\r\n'¶
-
REQUEST_OPM= 'INSERT OPERATING MODE :\r\n'¶
-
REQUEST_PARAMETER_NAME= 'INSERT PARAMETER NAME :'¶
-
REQUEST_PARAMETER_VALUE= 'INSERT PARAMETER VALUE :'¶
-
REQUEST_RADRS= 'INSERT REGISTER ADDRESS :\r\n'¶
-
REQUEST_RVAL= 'INSERT REGISTER VALUE :\r\n'¶
-
REQUEST_SENSOR_COMMAND= 'INSERT SENSOR COMMAND :'¶
-
REQUEST_SLAVE= 'INSERT SLAVE NODE :'¶
-
TERMINATOR_SEQ= '\r\n'¶ Terminator sequence.
-
-
class
wire_st_sdk.iolink.iolink_protocol.ODR[source]¶ Bases:
enum.EnumAllowed parameters’ values for ODR. Accelerometer’s output data rate.
-
ODR_104= 104¶
-
ODR_13= 13¶
-
ODR_1660= 1660¶
-
ODR_208= 208¶
-
ODR_26= 26¶
-
ODR_3330= 3330¶
-
ODR_416= 416¶
-
ODR_52= 52¶
-
ODR_6660= 6660¶
-
ODR_833= 833¶
-
wire_st_sdk.iolink.iolink_sensor module¶
iolink_sensor
The iolink_sensor module represents a device capable of connecting to an IOLink masterboard and sending/receiving data to it.
-
class
wire_st_sdk.iolink.iolink_sensor.IOLinkSensor(master, position, id, name=None)[source]¶ Bases:
wire_st_sdk.iolink.iolink_device.IOLinkDeviceIO-Link Sensor class.
This class manages the commands of a standard IO-Link sensor.
-
get_env()[source]¶ Get environmental data.
- Returns
A list with Pressure [mbar], Humidity [%], and Temperature [C] values.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
get_fft()[source]¶ Get Fast Fourier Transform of vibration data.
- Returns
A n-elements list, with each element being a list of four values: the first is a frequency [Hz] and the other three are the corresponding vibration values on the three axis [m/s2].
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
get_tdm()[source]¶ Get time domain data.
- Returns
A two-elements list, with a list of RMS Speed values on X,Y,Z axes [mm/s] as the first element, and a list of Peak Acceleration values on X,Y,Z axes [m/s2] as the second element.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
set_acq(acq)[source]¶ Set accelerometer’s total acquisition time, which is valid for all types of analysis.
- Parameters
acq (int) – Accelerometer’s total acquisition time (must be in the range [ACQ_MIN..ACQ_MAX]).
- Returns
True if the parameter has been set correctly, False otherwise.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
set_fls(fls)[source]¶ Set accelerometer’s full scale.
- Parameters
fls (
wire_st_sdk.iolink.iolink_protocol.FLS) – Accelerometer’s full scale.- Returns
True if the parameter has been set correctly, False otherwise.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
set_odr(odr)[source]¶ Set accelerometer’s output data rate.
- Parameters
odr (
wire_st_sdk.iolink.iolink_protocol.ODR) – Accelerometer’s output data rate.- Returns
True if the parameter has been set correctly, False otherwise.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
set_ovl(ovl)[source]¶ Set accelerometer’s overlapping percentage between two consecutive FFT analysis.
- Parameters
ovl (int) – Accelerometer’s overlapping percentage between two consecutive FFT analysis (must be in the range [OVL_MIN..OVL_MAX]).
- Returns
True if the parameter has been set correctly, False otherwise.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
set_sub(sub)[source]¶ Set accelerometer’s number of subranges.
- Parameters
sub (
wire_st_sdk.iolink.iolink_protocol.SUB) – Number of subranges.- Returns
True if the parameter has been set correctly, False otherwise.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-
set_sze(sze)[source]¶ Set accelerometer’s input array size for FFT.
- Parameters
sze (
wire_st_sdk.iolink.iolink_protocol.SZE) – Accelerometer’s input array size for FFT.- Returns
True if the parameter has been set correctly, False otherwise.
- Return type
- Raises
SerialException, SerialTimeoutException – are raised if something with the serial communication does not work.
WireSTInvalidOperationException – is raised if the command has not been executed successfully.
-