Class ReferenceDesignationGenerator
java.lang.Object
neqsim.process.equipment.iec81346.ReferenceDesignationGenerator
- All Implemented Interfaces:
Serializable
Generates IEC 81346 reference designations for all elements in a
ProcessSystem or
ProcessModel.
The generator walks the process topology and automatically assigns reference designations based on the three IEC 81346 aspects:
- Function aspect (
=): Derived from the process area name or a user-defined prefix. In aProcessModel, each process area becomes a function sub-level. - Product aspect (
-): Derived from the IEC 81346-2 letter code (mapped from equipment type) and a sequence number within that category. - Location aspect (
+): User-defined location prefix, e.g. "P1" for Platform 1.
Usage example — single ProcessSystem:
ReferenceDesignationGenerator gen = new ReferenceDesignationGenerator(process);
gen.setFunctionPrefix("A1");
gen.setLocationPrefix("P1.M1");
gen.generate();
// Each equipment now has a reference designation:
String ref = process.getUnit("HP Sep").getReferenceDesignationString();
// e.g. "=A1-B1+P1.M1"
// Export report as JSON:
String json = gen.toJson();
Usage example — multi-area ProcessModel:
ReferenceDesignationGenerator gen = new ReferenceDesignationGenerator(plant);
gen.setLocationPrefix("P1");
gen.generate();
// Area names are used as function sub-levels:
// "Separation" area → =A1 (first area)
// "Compression" area → =A2 (second area)
// Equipment in Separation: =A1-B1, =A1-B2, =A1-K1
// Equipment in Compression: =A2-K1, =A2-K2
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a single generated IEC 81346 designation entry. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<ReferenceDesignationGenerator.DesignationEntry> The generated designation entries, in order.private StringUser-defined function prefix (without=), e.g.private booleanWhether generation has been run.private booleanWhether to assign designations to measurement devices.private booleanWhether to assign designations to stream objects.private StringUser-defined location prefix (without+), e.g.private ProcessModelThe multi-area process model to generate designations for (null if single-area).private ProcessSystemThe single process system to generate designations for (null if multi-area).private static final longprivate booleanWhether to use hierarchical function designations in multi-area models. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a generator with no bound system.ReferenceDesignationGenerator(ProcessModel processModel) Creates a generator for a multi-area process model.ReferenceDesignationGenerator(ProcessSystem processSystem) Creates a generator for a single process system. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidenrichConnections(ProcessSystem system) Enriches any explicitProcessConnectionobjects in the given process system with IEC 81346 reference designation strings.findByDesignation(String referenceDesignation) Finds a designation entry by reference designation string.findByLetterCode(IEC81346LetterCode letterCode) Returns all designation entries for a given IEC 81346-2 letter code.findByName(String equipmentName) Finds a designation entry by equipment name.voidgenerate()Generates IEC 81346 reference designations for all elements.voidgenerate(ProcessModel model) Binds the given process model and generates designations for it.voidgenerate(ProcessSystem system) Binds the given process system and generates designations for it.private voidgenerateForMeasurementDevices(ProcessSystem system, String funcPrefix, String locPrefix, Map<IEC81346LetterCode, Integer> counters) Generates designations for measurement devices in a process system.private voidGenerates designations for a multi-area process model.private voidgenerateForSystem(ProcessSystem system, String funcPrefix, String locPrefix) Generates designations for a single process system.intReturns the number of generated designations.Returns a cross-reference mapping from reference designation string to equipment name.Returns the list of all generated designation entries.Returns the current function prefix.Returns a summary map of letter code counts.Returns the current location prefix.Returns a cross-reference mapping from equipment name to reference designation string.private intincrementCounter(Map<IEC81346LetterCode, Integer> counters, IEC81346LetterCode letterCode) Increments and returns the counter for a given letter code.booleanChecks if generation has been performed.booleanReturns whether measurement devices are included in designation generation.booleanReturns whether stream objects are included in designation generation.booleanReturns whether hierarchical function designations are used.voidsetFunctionPrefix(String functionPrefix) Sets the function prefix for the top-level function aspect.voidsetIncludeMeasurementDevices(boolean includeMeasurementDevices) Sets whether to include measurement devices in designation generation.voidsetIncludeStreams(boolean includeStreams) Sets whether to include stream objects in designation generation.voidsetLocationPrefix(String locationPrefix) Sets the location prefix for the location aspect.voidsetUseHierarchicalFunctions(boolean useHierarchicalFunctions) Sets whether to use hierarchical function designations in multi-area models.toJson()Exports the generated designations as a JSON string.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
processSystem
The single process system to generate designations for (null if multi-area). -
processModel
The multi-area process model to generate designations for (null if single-area). -
functionPrefix
User-defined function prefix (without=), e.g. "A1". -
locationPrefix
User-defined location prefix (without+), e.g. "P1.M1". -
includeStreams
private boolean includeStreamsWhether to assign designations to stream objects. -
includeMeasurementDevices
private boolean includeMeasurementDevicesWhether to assign designations to measurement devices. -
useHierarchicalFunctions
private boolean useHierarchicalFunctionsWhether to use hierarchical function designations in multi-area models. When true, each area function prefix is formed by appending to the top-level function prefix with a dot separator (e.g. "A1.A1", "A1.A2"). When false (default), areas use flat numbering ("A1", "A2"). -
generated
private boolean generatedWhether generation has been run. -
entries
The generated designation entries, in order.
-
-
Constructor Details
-
ReferenceDesignationGenerator
Creates a generator for a single process system.- Parameters:
processSystem- the process system to generate designations for
-
ReferenceDesignationGenerator
Creates a generator for a multi-area process model.- Parameters:
processModel- the process model to generate designations for
-
ReferenceDesignationGenerator
public ReferenceDesignationGenerator()Creates a generator with no bound system. Use withgenerate(ProcessSystem)orgenerate(ProcessModel)to bind a system at generation time.
-
-
Method Details
-
setFunctionPrefix
Sets the function prefix for the top-level function aspect.For a single
ProcessSystem, this is used directly (e.g. "A1" produces "=A1"). For aProcessModel, each area gets a sub-level (e.g. first area becomes "A1", second "A2").- Parameters:
functionPrefix- the function prefix without the=character
-
getFunctionPrefix
Returns the current function prefix.- Returns:
- the function prefix without the
=character
-
setLocationPrefix
Sets the location prefix for the location aspect.- Parameters:
locationPrefix- the location prefix without the+character, e.g. "P1.M1"
-
getLocationPrefix
Returns the current location prefix.- Returns:
- the location prefix without the
+character
-
setIncludeStreams
public void setIncludeStreams(boolean includeStreams) Sets whether to include stream objects in designation generation.- Parameters:
includeStreams- true to assign designations to streams
-
isIncludeStreams
public boolean isIncludeStreams()Returns whether stream objects are included in designation generation.- Returns:
- true if streams are included
-
setIncludeMeasurementDevices
public void setIncludeMeasurementDevices(boolean includeMeasurementDevices) Sets whether to include measurement devices in designation generation.- Parameters:
includeMeasurementDevices- true to assign designations to measurement devices
-
isIncludeMeasurementDevices
public boolean isIncludeMeasurementDevices()Returns whether measurement devices are included in designation generation.- Returns:
- true if measurement devices are included
-
setUseHierarchicalFunctions
public void setUseHierarchicalFunctions(boolean useHierarchicalFunctions) Sets whether to use hierarchical function designations in multi-area models. When true, each area function prefix is formed by appending to the top-level function prefix with a dot (e.g. "A1.A1", "A1.A2"). When false (default), areas use flat numbering ("A1", "A2").- Parameters:
useHierarchicalFunctions- true for hierarchical, false for flat
-
isUseHierarchicalFunctions
public boolean isUseHierarchicalFunctions()Returns whether hierarchical function designations are used.- Returns:
- true if hierarchical mode is enabled
-
generate
public void generate()Generates IEC 81346 reference designations for all elements.After calling this method, each equipment object in the process system or model will have its
ReferenceDesignationset. The generated designations can be retrieved withProcessEquipmentInterface.getReferenceDesignation().Calling this method multiple times will regenerate all designations.
-
generate
Binds the given process system and generates designations for it.- Parameters:
system- the process system to generate designations for
-
generate
Binds the given process model and generates designations for it.- Parameters:
model- the process model to generate designations for
-
generateForModel
private void generateForModel()Generates designations for a multi-area process model. -
generateForSystem
Generates designations for a single process system.- Parameters:
system- the process systemfuncPrefix- the function prefix for this systemlocPrefix- the location prefix for this system
-
enrichConnections
Enriches any explicitProcessConnectionobjects in the given process system with IEC 81346 reference designation strings. For each connection, the source and target equipment names are looked up and their reference designation strings are copied to the connection metadata.- Parameters:
system- the process system whose connections should be enriched
-
generateForMeasurementDevices
private void generateForMeasurementDevices(ProcessSystem system, String funcPrefix, String locPrefix, Map<IEC81346LetterCode, Integer> counters) Generates designations for measurement devices in a process system.- Parameters:
system- the process systemfuncPrefix- the function prefixlocPrefix- the location prefixcounters- the letter code counters (shared with equipment)
-
incrementCounter
private int incrementCounter(Map<IEC81346LetterCode, Integer> counters, IEC81346LetterCode letterCode) Increments and returns the counter for a given letter code.- Parameters:
counters- the counter mapletterCode- the letter code to increment- Returns:
- the new sequence number (1-based)
-
getEntries
Returns the list of all generated designation entries.- Returns:
- unmodifiable list of designation entries
-
getDesignationCount
public int getDesignationCount()Returns the number of generated designations.- Returns:
- the number of entries
-
isGenerated
public boolean isGenerated()Checks if generation has been performed.- Returns:
- true if
generate()has been called
-
findByName
Finds a designation entry by equipment name.- Parameters:
equipmentName- the equipment name to search for- Returns:
- the designation entry, or null if not found
-
findByDesignation
public ReferenceDesignationGenerator.DesignationEntry findByDesignation(String referenceDesignation) Finds a designation entry by reference designation string.- Parameters:
referenceDesignation- the reference designation string to search for- Returns:
- the designation entry, or null if not found
-
findByLetterCode
public List<ReferenceDesignationGenerator.DesignationEntry> findByLetterCode(IEC81346LetterCode letterCode) Returns all designation entries for a given IEC 81346-2 letter code.- Parameters:
letterCode- the letter code to filter by- Returns:
- unmodifiable list of matching entries
-
getLetterCodeSummary
Returns a summary map of letter code counts.- Returns:
- map of letter code to count of equipment with that code
-
getNameToDesignationMap
-
getDesignationToNameMap
-
toJson
Exports the generated designations as a JSON string.The JSON structure contains:
standard: "IEC 81346"functionPrefix: The function prefix usedlocationPrefix: The location prefix useddesignationCount: Number of generated designationsletterCodeSummary: Count per letter codedesignations: Array of designation entries with name, type, designation, letterCode, and description
- Returns:
- JSON string representation of all generated designations
-