Class InstrumentScheduleGenerator

java.lang.Object
neqsim.process.mechanicaldesign.InstrumentScheduleGenerator
All Implemented Interfaces:
Serializable

public class InstrumentScheduleGenerator extends Object implements Serializable
Generates an instrument schedule (instrument index) from a process simulation and optionally registers live measurement devices on the ProcessSystem.

This class bridges the gap between engineering deliverables and dynamic simulation instrumentation by:

  • Walking all equipment in the process and determining required measurements
  • Assigning ISA-5.1 compliant instrument tag numbers (PT-101, TT-201, LT-301, FT-401)
  • Creating real MeasurementDeviceInterface objects connected to process streams
  • Configuring AlarmConfig thresholds derived from operating conditions
  • Optionally registering the instruments on the ProcessSystem for transient simulation
  • Producing a complete instrument schedule as JSON for engineering deliverables

The generated instruments are simulation-ready: they can be used with ControllerDeviceBaseClass for PID control, connected to plant historian data via tags, or evaluated during transient runs.

Usage:

InstrumentScheduleGenerator gen = new InstrumentScheduleGenerator(process);
gen.setRegisterOnProcess(true); // instruments become live in the simulation
gen.generate();
String json = gen.toJson();
List<MeasurementDeviceInterface> devices = gen.getCreatedDevices();
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • PRESSURE_TAG_START

      private static final int PRESSURE_TAG_START
      ISA tag series starting numbers for each measurement type.
      See Also:
    • TEMPERATURE_TAG_START

      private static final int TEMPERATURE_TAG_START
      See Also:
    • LEVEL_TAG_START

      private static final int LEVEL_TAG_START
      See Also:
    • FLOW_TAG_START

      private static final int FLOW_TAG_START
      See Also:
    • processSystem

      private final ProcessSystem processSystem
      The process system to instrument.
    • registerOnProcess

      private boolean registerOnProcess
      Whether to register created devices on the ProcessSystem.
    • entries

      Generated instrument entries.
    • createdDevices

      private final Map<String, MeasurementDeviceInterface> createdDevices
      Created measurement device objects keyed by tag number.
    • pressureTagNum

      private int pressureTagNum
      Tag counters per type.
    • temperatureTagNum

      private int temperatureTagNum
    • levelTagNum

      private int levelTagNum
    • flowTagNum

      private int flowTagNum
    • generated

      private boolean generated
      Whether generation has been run.
  • Constructor Details

    • InstrumentScheduleGenerator

      public InstrumentScheduleGenerator(ProcessSystem processSystem)
      Creates an instrument schedule generator for the given process system.
      Parameters:
      processSystem - the process system (must have been run)
      Throws:
      IllegalArgumentException - if processSystem is null
  • Method Details

    • setRegisterOnProcess

      public void setRegisterOnProcess(boolean registerOnProcess)
      Sets whether created measurement devices should be registered on the ProcessSystem. When true, instruments become live and participate in transient simulations.
      Parameters:
      registerOnProcess - true to add devices to the process
    • isRegisterOnProcess

      public boolean isRegisterOnProcess()
      Gets whether instruments will be registered on the process.
      Returns:
      true if instruments are registered on the process
    • generate

      public void generate()
      Generates the instrument schedule by walking all equipment in the process system. Creates measurement devices with ISA-5.1 tags and alarm configurations.
    • instrumentSeparator

      private void instrumentSeparator(Separator sep)
      Instruments a separator with PT, TT, LT (and FT on gas outlet).
      Parameters:
      sep - the separator
    • instrumentCompressor

      private void instrumentCompressor(Compressor comp)
      Instruments a compressor with suction/discharge PT and discharge TT.
      Parameters:
      comp - the compressor
    • instrumentHeater

      private void instrumentHeater(Heater heater)
      Instruments a heater with outlet TT.
      Parameters:
      heater - the heater
    • instrumentCooler

      private void instrumentCooler(Cooler cooler)
      Instruments a cooler with outlet TT.
      Parameters:
      cooler - the cooler
    • instrumentValve

      private void instrumentValve(ThrottlingValve valve)
      Instruments a valve with downstream PT.
      Parameters:
      valve - the throttling valve
    • instrumentStream

      private void instrumentStream(Stream stream)
      Instruments a feed stream with PT, TT, and FT.
      Parameters:
      stream - the stream
    • nextTag

      Generates the next ISA-5.1 tag number for the given variable type.
      Parameters:
      variable - the measured variable type
      Returns:
      tag number string (e.g. "PT-101", "TT-201")
    • configureAlarm

      private void configureAlarm(MeasurementDeviceInterface device, double lo, double lolo, double hi, double hihi, String unit)
      Configures alarm thresholds on a measurement device.
      Parameters:
      device - the measurement device
      lo - low alarm limit
      lolo - low-low alarm limit
      hi - high alarm limit
      hihi - high-high alarm limit
      unit - engineering unit
    • registerDevice

      private void registerDevice(String tag, MeasurementDeviceInterface device)
      Registers a device in the internal map and optionally on the ProcessSystem.
      Parameters:
      tag - instrument tag
      device - the measurement device
    • getEntries

      Gets all generated instrument entries.
      Returns:
      unmodifiable list of entries
    • getInstrumentCount

      public int getInstrumentCount()
      Gets the total number of instruments.
      Returns:
      instrument count
    • getEntriesForEquipment

      public List<InstrumentScheduleGenerator.InstrumentEntry> getEntriesForEquipment(String equipmentTag)
      Gets entries for a specific equipment.
      Parameters:
      equipmentTag - equipment tag name
      Returns:
      filtered list of entries for that equipment
    • getEntriesByType

      Gets entries filtered by measured variable type.
      Parameters:
      variable - the measured variable type
      Returns:
      filtered entries
    • getDevice

      public MeasurementDeviceInterface getDevice(String tag)
      Gets a created measurement device by its tag number.
      Parameters:
      tag - ISA-5.1 tag (e.g. "PT-101")
      Returns:
      the measurement device, or null if not found
    • getCreatedDevices

      public List<MeasurementDeviceInterface> getCreatedDevices()
      Gets all created measurement devices.
      Returns:
      unmodifiable list of devices
    • isGenerated

      public boolean isGenerated()
      Checks whether generation has been run.
      Returns:
      true if generate() has been called
    • getCountByType

      public int getCountByType(InstrumentScheduleGenerator.MeasuredVariable variable)
      Gets instrument count by measured variable type.
      Parameters:
      variable - the measured variable type
      Returns:
      count of instruments of that type
    • toJson

      public String toJson()
      Produces a JSON representation of the complete instrument schedule.
      Returns:
      JSON string
    • getISAToIEC81346Map

      public Map<String,String> getISAToIEC81346Map()
      Produces a cross-reference map between ISA-5.1 instrument tags and IEC 81346 reference designations. For each instrument entry, the entry's equipmentTag is matched against equipment in the process system; if that equipment has an IEC 81346 reference designation assigned, the mapping is recorded.

      This is useful for bridging North-American ISA-5.1 tagging (PT-101, TT-201) with IEC 81346 functional designation systems (=A1.B1, =A1.K1).

      Returns:
      a map from ISA-5.1 tag (e.g. "PT-101") to IEC 81346 designation string (e.g. "=A1.B1"); only entries where the parent equipment has a designation are included