detect_configuration (version 0.1)
index
c:\users\msuciu\desktop\new_gtc_demo\detect configuration\detect_configuration.py

Detect configuration module.
 
This module provide a simple way to detect the PLC/DCS configuration.
In this way the user can easy detect boards like:
    - CN0414 (Analog input and HART compatible)
    - CN0418 (Analog output and HART compatible)
The CN0416 (RS485 transceiver) needs to be used in a DCS configuration,
while for a PLC configuration is optional.
 
Only one comunication port is used and needs to be chosen by the user.

 
Modules
       
minimalmodbus
serial

 
Functions
       
print_table(register_address: int, register_count: int, labels: list, registers: list) -> None
Print data in a table.
 
Print registers addresses, description and
    current value in a colored table format.
 
Args:
    register_address: First register number
    register_count: Number of registers
    labels: Registers description
    registers: Registers values
 
Returns:
    None
request_info() -> str
Request input data.
 
List all serial devices detected in use and wait for the user to choose
which port/serial device want to use.
 
Args:
    None
 
Returns:
    Return requested port name
scan_system_config(port_name: str) -> None
Detect system configuration for each possible MODBUS node.
 
Create an instrument object for each MODBUS node and read 5 analog
input registers with function code 4 starting from address 0.
Print registers description and value in a colored table.
Convert first 4 registers value in binary format and check if the least
significant bit is 0 or 1. If 0 is found, an analog input board have been
detected, else, if 1 is found, an analog output board have been detected.
 
Args:
    port_name: COMPORT name
 
Returns:
    None
search_serial_port_id(device_description: str, view_device_description: bool = False) -> str
Search for a serial device description.
 
Args:
    device_description: Device description string
    view_device_description: flag to display device description
 
Returns:
    Device port name
serial_devices() -> tuple
Lists serial port names and description.
 
Search for all serial devices detected in use and return
their description and port name as a list with an index.
 
Args:
    None
 
Returns:
    Return a tuple of two lists, serial device(s) description(s)
    and serial device(s) port(s).
sleep(...)
sleep(seconds)
 
Delay execution for a given number of seconds.  The argument may be
a floating point number for subsecond precision.

 
Data
        Fore = <colorama.ansi.AnsiFore object>
__status__ = 'Development'

 
Author
        Mihai Ionut Suciu