@@ -13,13 +13,27 @@ public static class FpdLibraries
1313{
1414 public static void EnsureLibraries ( CAEXFileType caex )
1515 {
16+ EnsureExternalReference ( caex ) ;
1617 EnsureInterfaceClassLib ( caex ) ;
1718 EnsureRoleClassLib ( caex ) ;
1819 EnsureAttributeTypeLib ( caex ) ;
1920 EnsureDIAttributeTypeLib ( caex ) ;
2021 EnsureSystemUnitClassLib ( caex ) ;
2122 }
2223
24+ // -- 0. ExternalReference to AML Base Libraries ----------------------------
25+
26+ private static void EnsureExternalReference ( CAEXFileType caex )
27+ {
28+ // Check if the reference already exists
29+ foreach ( var er in caex . ExternalReference )
30+ if ( er . Alias == AmlBase . Alias ) return ;
31+
32+ var extRef = caex . ExternalReference . Append ( ) ;
33+ extRef . Alias = AmlBase . Alias ;
34+ extRef . Path = AmlBase . Path ;
35+ }
36+
2337 // -- 1. InterfaceClassLib ------------------------------------------------
2438
2539 private static void EnsureInterfaceClassLib ( CAEXFileType caex )
@@ -33,6 +47,7 @@ private static void EnsureInterfaceClassLib(CAEXFileType caex)
3347 var port = icl . InterfaceClass . Append ( "FPD_Port" ) ;
3448 port . Description = "Abstract base port for all FPD connections." ;
3549 port . Version = "1.0.0" ;
50+ port . RefBaseClassPath = AmlBase . Port ;
3651 AddPointAttr ( port , "PortCoordinate" ) ;
3752
3853 foreach ( var name in new [ ]
@@ -59,10 +74,11 @@ private static void EnsureRoleClassLib(CAEXFileType caex)
5974 rcl . Description = "Semantic model of the FPD per VDI/VDE 3682. Flat layout with explicit inheritance via RefBaseClassPath." ;
6075 rcl . Version = "1.0.0" ;
6176
62- // FPD_Process
77+ // FPD_Process (inherits AML Structure)
6378 var proc = rcl . RoleClass . Append ( "FPD_Process" ) ;
6479 proc . Description = "Process (Part 2, Fig. 2). Aggregates states (2..*), system limit (1), and process operators (1..*)." ;
6580 proc . Version = "1.0.0" ;
81+ proc . RefBaseClassPath = AmlBase . Structure ;
6682 AddRefObjAttr ( proc , "IDREF to the parent process operator whose decomposition this process represents." ) ;
6783
6884 // FPD_SystemLimit
@@ -72,10 +88,11 @@ private static void EnsureRoleClassLib(CAEXFileType caex)
7288 AddIdentificationAttr ( sl ) ;
7389 AddBoundsAttr ( sl , "ViewInformation" ) ;
7490
75- // FPD_Object (abstract base)
91+ // FPD_Object (abstract base, inherits AML BaseRole )
7692 var obj = rcl . RoleClass . Append ( "FPD_Object" ) ;
7793 obj . Description = "Abstract base for all FPB objects (Part 1, p. 4: product, energy, information, process operator, technical resource)." ;
7894 obj . Version = "1.0.0" ;
95+ obj . RefBaseClassPath = AmlBase . BaseRole ;
7996 AddIdentificationAttr ( obj ) ;
8097 var charAttr = AddAttr ( obj , "Characteristics" , "xs:string" ) ;
8198 charAttr . Description = "Container for characteristics (Part 2, Fig. 3)." ;
@@ -101,7 +118,7 @@ private static void EnsureRoleClassLib(CAEXFileType caex)
101118 po . Description = "Process operator (Part 2, Fig. 2). Inherits Identification and Characteristics from FPD_Object." ;
102119 po . Version = "1.0.0" ;
103120 po . RefBaseClassPath = $ "{ LibNames . RoleClassLib } /FPD_Object";
104- AddRefObjAttr ( po , "IDREF to the child process that decomposes this operator. Empty if the operator is not further decomposed." ) ;
121+ AddRefProcessAttr ( po , "IDREF to the child process that decomposes this operator. Empty if the operator is not further decomposed." ) ;
105122
106123 // FPD_TechnicalResource (inherits FPD_Object)
107124 var tr = rcl . RoleClass . Append ( "FPD_TechnicalResource" ) ;
@@ -195,6 +212,7 @@ private static void EnsureSystemUnitClassLib(CAEXFileType caex)
195212 procSuc . Version = "1.0.0" ;
196213 AddRefObjAttr ( procSuc , null ) ;
197214 procSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = $ "{ LibNames . RoleClassLib } /FPD_Process";
215+ procSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = AmlBase . Structure ;
198216
199217 // FPD_SystemLimit (standalone)
200218 var slSuc = sucl . SystemUnitClass . Append ( "FPD_SystemLimit" ) ;
@@ -219,26 +237,31 @@ private static void EnsureSystemUnitClassLib(CAEXFileType caex)
219237 stateSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = $ "{ LibNames . RoleClassLib } /FPD_State";
220238
221239 // Concrete states (inherit FPD_State)
240+ // Only FPD_Product gets AML base Product role (Energy/Information have no AML base equivalent)
222241 foreach ( var name in new [ ] { "FPD_Product" , "FPD_Energy" , "FPD_Information" } )
223242 {
224243 var suc = sucl . SystemUnitClass . Append ( name ) ;
225244 suc . Version = "1.0.0" ;
226245 suc . RefBaseClassPath = $ "{ LibNames . SystemUnitClassLib } /FPD_State";
227246 suc . SupportedRoleClass . Append ( ) . RefRoleClassPath = $ "{ LibNames . RoleClassLib } /{ name } ";
247+ if ( name == "FPD_Product" )
248+ suc . SupportedRoleClass . Append ( ) . RefRoleClassPath = AmlBase . Product ;
228249 }
229250
230- // FPD_ProcessOperator (inherits FPD_Object, adds refObj )
251+ // FPD_ProcessOperator (inherits FPD_Object, adds refProcess )
231252 var poSuc = sucl . SystemUnitClass . Append ( "FPD_ProcessOperator" ) ;
232253 poSuc . Version = "1.0.0" ;
233254 poSuc . RefBaseClassPath = $ "{ LibNames . SystemUnitClassLib } /FPD_Object";
234- AddRefObjAttr ( poSuc , null ) ;
255+ AddRefProcessAttr ( poSuc , null ) ;
235256 poSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = $ "{ LibNames . RoleClassLib } /FPD_ProcessOperator";
257+ poSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = AmlBase . Process ;
236258
237259 // FPD_TechnicalResource (inherits FPD_Object)
238260 var trSuc = sucl . SystemUnitClass . Append ( "FPD_TechnicalResource" ) ;
239261 trSuc . Version = "1.0.0" ;
240262 trSuc . RefBaseClassPath = $ "{ LibNames . SystemUnitClassLib } /FPD_Object";
241263 trSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = $ "{ LibNames . RoleClassLib } /FPD_TechnicalResource";
264+ trSuc . SupportedRoleClass . Append ( ) . RefRoleClassPath = AmlBase . Resource ;
242265 }
243266
244267 // -- Helpers --------------------------------------------------------------
@@ -289,4 +312,13 @@ private static void AddRefObjAttr(IObjectWithAttributes parent, string? descript
289312 if ( description != null )
290313 attr . Description = description ;
291314 }
315+
316+ private static void AddRefProcessAttr ( IObjectWithAttributes parent , string ? description )
317+ {
318+ var attr = parent . Attribute . Append ( "refProcess" ) ;
319+ attr . AttributeDataType = "xs:string" ;
320+ attr . RefAttributeType = AttrRefs . RefObj ;
321+ if ( description != null )
322+ attr . Description = description ;
323+ }
292324}
0 commit comments