The crowcon module

Autogenerated API documentation for crowcon

This module contains a driver for the Vortex gas alarm central

Copyright 2014 CINF (https://github.com/CINF)

This Vortex driver is part of PyExpLabSys.

PyExpLabSys is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PyExpLabSys is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PyExpLabSys. If not, see <http://www.gnu.org/licenses/>.

The documentation for the Vortex is the property of and copyrighted to Crowcon: http://www.crowcon.com/

class PyExpLabSys.drivers.crowcon.Status(code, value)

Bases: tuple

code

Alias for field number 0

value

Alias for field number 1

PyExpLabSys.drivers.crowcon.DetConfMap

alias of PyExpLabSys.drivers.crowcon.DetectorConfigurationMap

PyExpLabSys.drivers.crowcon.DetLev

alias of PyExpLabSys.drivers.crowcon.DetectorLevels

PyExpLabSys.drivers.crowcon.register_to_bool(register)[source]

Convert a register value to a boolean

0 is considered False, 65535 True and remaining integer values are invalid.

Parameters:register (int) – The register value
Returns:The boolean value
Return type:bool
class PyExpLabSys.drivers.crowcon.Vortex(serial_device, slave_address, debug=False, cache=True, retries=3)[source]

Bases: minimalmodbus.Instrument

Driver for the Vortex gas alarm central

Note

In the manual the register numbers are 1-based, but when sent to minimal modbus they need to be 0 based.

__init__(serial_device, slave_address, debug=False, cache=True, retries=3)[source]

Initialize the driver

Parameters:
  • serial_device (str) – The serial device to use
  • slave_address (int) – The address of the slave device
  • debug (bool) – Whether debugging output from minimal modbus should be enabled
  • cache (bool) – Whether system configuration values (which are expected not to change within the runtime of the program) should be cached
close()[source]

Close the serial communication connection

read_register(*args, **kwargs)[source]

Read register from instrument (with retries)

The argument definition is the same as for the minimalmodbus method, see the full documentation for read_register for details.

read_string(*args, **kwargs)[source]

Read string from instrument (with retries)

The argument definition is the same as for the minimalmodbus method, see the full documentation read_string for details.

read_bool(register)[source]

Read int from register and convert to boolean value

0 is considered False, 65535 True and remaining integer values are invalid.

Parameters:register (int) – The register to read from
Returns:The boolean value
Return type:bool
get_type()[source]

Get the device type

Returns:The type of the device e.g. ‘Vortex’
Return type:str
get_system_status()[source]

Get the system status

Returns:
[‘All OK’] if no status bits (section 5.1.1 in the manual) has been set,
otherwise one string for each of the status bits that was set.
Return type:list
get_system_power_status()[source]

Get the system power status

Returns:A Status named tuple containing status code and string
Return type:Status
get_serial_number()[source]

Get the serial number

Returns:The serial number
Return type:str
get_system_name()[source]

Get the serial number

Returns:The system name
Return type:str
get_number_installed_detectors()[source]

Get the number of installed detector inputs

This value is cached if requested. See docstring for __init__().

Returns:The number of installed detectors
Return type:int
get_number_installed_digital_outputs()[source]

Get the number of installed digital outputs

Returns:The number of installed digital inputs
Return type:int
detector_configuration(detector_number)[source]

Read detector configuration

This value is cached if requested. See docstring for __init__().

Parameters:detector_number (int) – The detector number. Detectors numbers are one based
Returns:Named tuple (DetConfMap) containing the detector configuration
Return type:DetConfMap
get_detector_levels(detector_number)[source]

Read detector levels

Parameters:detector_number (int) – The number of the detector to get the levels of
Returns:
DetLev named tuple containing the detector number, detector level,
a list of status messages and a boolean that describes whether the detector is inhibited
Return type:namedtuple
get_multiple_detector_levels(detector_numbers)[source]

Get the levels for multiple detectors in one communication call

Parameters:detector_numbers (sequence) – Sequence of integer detector numbers (remembe they are 1 based)

Warning

This method uses “hidden” functions in the minimal modbus module for value conversion. As they are hidden, they are not guarantied to preserve their interface, which means that this method may break at any time

PyExpLabSys.drivers.crowcon.main()[source]

Main function, used to simple functional test