Class InstrumentScheduleGenerator
java.lang.Object
neqsim.process.mechanicaldesign.InstrumentScheduleGenerator
- All Implemented Interfaces:
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
MeasurementDeviceInterfaceobjects connected to process streams - Configuring
AlarmConfigthresholds 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a single instrument in the instrument schedule.static enumMeasurement variable classification per ISA-5.1.static enumSIL rating classification per IEC 61508 / IEC 61511. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, MeasurementDeviceInterface> Created measurement device objects keyed by tag number.private final List<InstrumentScheduleGenerator.InstrumentEntry> Generated instrument entries.private static final intprivate intprivate booleanWhether generation has been run.private static final intprivate intprivate static final intISA tag series starting numbers for each measurement type.private intTag counters per type.private final ProcessSystemThe process system to instrument.private booleanWhether to register created devices on the ProcessSystem.private static final longprivate static final intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionInstrumentScheduleGenerator(ProcessSystem processSystem) Creates an instrument schedule generator for the given process system. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidconfigureAlarm(MeasurementDeviceInterface device, double lo, double lolo, double hi, double hihi, String unit) Configures alarm thresholds on a measurement device.voidgenerate()Generates the instrument schedule by walking all equipment in the process system.intGets instrument count by measured variable type.Gets all created measurement devices.Gets a created measurement device by its tag number.Gets all generated instrument entries.Gets entries filtered by measured variable type.getEntriesForEquipment(String equipmentTag) Gets entries for a specific equipment.intGets the total number of instruments.Produces a cross-reference map between ISA-5.1 instrument tags and IEC 81346 reference designations.private voidInstruments a compressor with suction/discharge PT and discharge TT.private voidinstrumentCooler(Cooler cooler) Instruments a cooler with outlet TT.private voidinstrumentHeater(Heater heater) Instruments a heater with outlet TT.private voidInstruments a separator with PT, TT, LT (and FT on gas outlet).private voidinstrumentStream(Stream stream) Instruments a feed stream with PT, TT, and FT.private voidinstrumentValve(ThrottlingValve valve) Instruments a valve with downstream PT.booleanChecks whether generation has been run.booleanGets whether instruments will be registered on the process.private StringGenerates the next ISA-5.1 tag number for the given variable type.private voidregisterDevice(String tag, MeasurementDeviceInterface device) Registers a device in the internal map and optionally on the ProcessSystem.voidsetRegisterOnProcess(boolean registerOnProcess) Sets whether created measurement devices should be registered on the ProcessSystem.toJson()Produces a JSON representation of the complete instrument schedule.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PRESSURE_TAG_START
private static final int PRESSURE_TAG_STARTISA 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
The process system to instrument. -
registerOnProcess
private boolean registerOnProcessWhether to register created devices on the ProcessSystem. -
entries
Generated instrument entries. -
createdDevices
Created measurement device objects keyed by tag number. -
pressureTagNum
private int pressureTagNumTag counters per type. -
temperatureTagNum
private int temperatureTagNum -
levelTagNum
private int levelTagNum -
flowTagNum
private int flowTagNum -
generated
private boolean generatedWhether generation has been run.
-
-
Constructor Details
-
InstrumentScheduleGenerator
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
Instruments a separator with PT, TT, LT (and FT on gas outlet).- Parameters:
sep- the separator
-
instrumentCompressor
Instruments a compressor with suction/discharge PT and discharge TT.- Parameters:
comp- the compressor
-
instrumentHeater
Instruments a heater with outlet TT.- Parameters:
heater- the heater
-
instrumentCooler
Instruments a cooler with outlet TT.- Parameters:
cooler- the cooler
-
instrumentValve
Instruments a valve with downstream PT.- Parameters:
valve- the throttling valve
-
instrumentStream
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 devicelo- low alarm limitlolo- low-low alarm limithi- high alarm limithihi- high-high alarm limitunit- engineering unit
-
registerDevice
Registers a device in the internal map and optionally on the ProcessSystem.- Parameters:
tag- instrument tagdevice- 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
public List<InstrumentScheduleGenerator.InstrumentEntry> getEntriesByType(InstrumentScheduleGenerator.MeasuredVariable variable) Gets entries filtered by measured variable type.- Parameters:
variable- the measured variable type- Returns:
- filtered entries
-
getDevice
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
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
Gets instrument count by measured variable type.- Parameters:
variable- the measured variable type- Returns:
- count of instruments of that type
-
toJson
Produces a JSON representation of the complete instrument schedule.- Returns:
- JSON string
-
getISAToIEC81346Map
Produces a cross-reference map between ISA-5.1 instrument tags and IEC 81346 reference designations. For each instrument entry, the entry'sequipmentTagis 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
-