Skip to content

Eitol/ansi_isa_51_decoder

Repository files navigation

ISA51 Decoder

A Python library for decoding and parsing ISA51 identifiers. This library supports both standard ISA51 codes and custom user-defined components.

Features

  • Decode ISA51 identifiers into their component parts
  • Support for variable modifiers and function modifiers
  • Handle both active and passive functions
  • Custom component registration
  • Full validation of ISA51 codes

Installation

pip install isa51-decoder

Usage

Basic Decoding

from isa51_decoder_agg import ISA51DecoderAggregator

decoder = ISA51DecoderAggregator()

# Simple code with variable and active function
result = decoder.decode_isa_51("AC")  # Analysis Control

# Code with variable modifiers
result = decoder.decode_isa_51("FQT")  # Flow Total Transmit

# Complex code with multiple modifiers
result = decoder.decode_isa_51("ZDXADH")  # Position Difference X Axis High Deviation Alarm

Custom Components

You can register custom components for your specific needs:

from data_types import ISA51Component
from letter_based_decoder import UserChoiceMap

c_fly_done_var = ISA51Component(
  name="Fly Drone",
  refs_codes=["1"],
  refs_text={"1": "Fly Drone that is used for measuring"},
  letter="C"
)
b_sun_light_sensor = ISA51Component(
  name="Sun Light Sensor",
  refs_codes=["1"],
  refs_text={"1": "Sensor that measures the sun light"},
  letter="B"
)
n_water_irrigation = ISA51Component(
  name="Water Irrigation",
  refs_codes=["1"],
  refs_text={"1": "Water Irrigation system"},
  letter="N"
)
water_heater = ISA51Component(
  name="Water Heater",
  refs_codes=["1"],
  refs_text={"1": "Water Heater system"},
  letter="B"
)
uc_map = UserChoiceMap(
  variables={
    "C": c_fly_done_var,
  },
  passive_functions={
    "B": b_sun_light_sensor,
  },
  active_functions={
    "N": n_water_irrigation,
  },
  function_modifiers={
    "B": water_heater
  }
)
decoder = ISA51DecoderAggregator(uc_map)

# Use custom components
result = decoder.decode_isa_51("CN")  # "Fly Drone Water Irrigation"

License

MIT

Legal

The ANSI/ISA 51 standard is a registered trademark of the International Society of Automation (ISA). This library is not affiliated with ISA and is not endorsed by ISA.

About

ANSI/ISA 5.1 Decoder for python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages