├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── dist ├── CoreAASExtension.js ├── CoreAASExtension.js.map ├── CoreAAS_enums.js ├── CoreAAS_enums.js.map ├── CoreServer.js ├── CoreServer.js.map ├── builders │ ├── AASBuilder.js │ ├── AASBuilder.js.map │ ├── AASReferenceBuilder.js │ ├── AASReferenceBuilder.js.map │ ├── AdministrativeInformationBuilder.js │ ├── AdministrativeInformationBuilder.js.map │ ├── AssetBuilder.js │ ├── AssetBuilder.js.map │ ├── ConceptDescriptionBuilder.js │ ├── ConceptDescriptionBuilder.js.map │ ├── ConceptDictionaryBuilder.js │ ├── ConceptDictionaryBuilder.js.map │ ├── DataSpecificationIEC61360Builder.js │ ├── DataSpecificationIEC61360Builder.js.map │ ├── EmbeddedDataSpecificationBuilder.js │ ├── EmbeddedDataSpecificationBuilder.js.map │ ├── SubmodelBuilder.js │ ├── SubmodelBuilder.js.map │ ├── SubmodelElementsBuilder.js │ ├── SubmodelElementsBuilder.js.map │ ├── SubmodelPropertyBuilder.js │ ├── SubmodelPropertyBuilder.js.map │ ├── ViewBuilder.js │ ├── ViewBuilder.js.map │ ├── builder.js │ ├── builder.js.map │ ├── builder_utilities.js │ └── builder_utilities.js.map ├── demo.js ├── demo.js.map ├── demo2.js ├── demo2.js.map ├── index.js ├── index.js.map ├── options_types.js ├── options_types.js.map ├── types.js └── types.js.map ├── docs ├── assets │ ├── css │ │ └── main.css │ ├── images │ │ ├── icons.png │ │ ├── icons@2x.png │ │ ├── widgets.png │ │ └── widgets@2x.png │ └── js │ │ ├── main.js │ │ └── search.js ├── classes │ ├── coreaasextension.html │ └── coreserver.html ├── enums │ ├── assetkind.html │ ├── datatypeiec61360type.html │ ├── entitytypeenumtype.html │ ├── identifiertype.html │ ├── keyelements.html │ ├── keytype.html │ ├── modelingkind.html │ ├── propertycategory.html │ └── propertyvaluetype.html ├── globals.html ├── index.html └── interfaces │ ├── aasfileobject.html │ ├── aasobject.html │ ├── aasoptions.html │ ├── aasreferenceobject.html │ ├── aasreferenceoptions.html │ ├── administrativeinformationobject.html │ ├── administrativeinformationoptions.html │ ├── annotatedrelationshipelementobject.html │ ├── annotatedrelationshipelementoptions.html │ ├── assetobject.html │ ├── assetoptions.html │ ├── capabilityobject.html │ ├── capabilityoptions.html │ ├── conceptdescriptionobject.html │ ├── conceptdescriptionoptions.html │ ├── conceptdictionaryobject.html │ ├── conceptdictionaryoptions.html │ ├── coreaasobjectsfolder.html │ ├── dataspecificationiecoptions.html │ ├── edsobject.html │ ├── embeddeddataspecificationoptions.html │ ├── entityobject.html │ ├── entityoptions.html │ ├── fileoptions.html │ ├── identifier.html │ ├── key.html │ ├── rangeobject.html │ ├── rangeoptions.html │ ├── referablenamespaceobject.html │ ├── referenceelementobject.html │ ├── referenceelementoptions.html │ ├── relationshipelementobject.html │ ├── relationshipelementoptions.html │ ├── spvalue.html │ ├── submodelelementcollectionobject.html │ ├── submodelelementcollectionoptions.html │ ├── submodelelementobject.html │ ├── submodelobject.html │ ├── submodeloptions.html │ ├── submodelpropertyobject.html │ ├── submodelpropertyoptions.html │ ├── viewobject.html │ └── viewoptions.html ├── nodesets └── coreaas.xml ├── package-lock.json ├── package.json ├── src ├── CoreAASExtension.ts ├── CoreAAS_enums.ts ├── CoreServer.ts ├── builders │ ├── AASBuilder.ts │ ├── AASReferenceBuilder.ts │ ├── AdministrativeInformationBuilder.ts │ ├── AssetBuilder.ts │ ├── ConceptDescriptionBuilder.ts │ ├── ConceptDictionaryBuilder.ts │ ├── DataSpecificationIEC61360Builder.ts │ ├── EmbeddedDataSpecificationBuilder.ts │ ├── SubmodelBuilder.ts │ ├── SubmodelElementsBuilder.ts │ ├── SubmodelPropertyBuilder.ts │ ├── ViewBuilder.ts │ ├── builder.ts │ └── builder_utilities.ts ├── demo.ts ├── demo2.ts ├── index.ts ├── options_types.ts └── types.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /.vscode 3 | /certs 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /demo 2 | /.gitignore 3 | /docs -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | node-opcua-coreaas 2 | ========== 3 | ![GitHub package.json version](https://img.shields.io/github/package-json/v/OPCUAUniCT/node-opcua-coreaas.svg) 4 | ![npm](https://img.shields.io/npm/v/node-opcua-coreaas.svg) 5 | 6 | An extension for [node-opcua](https://github.com/node-opcua/node-opcua) implementing [CoreAAS](https://github.com/OPCUAUniCT/coreAAS) Information Model and providing new functions to easily implement your Asset Administration Shell using OPC UA and Node.js. 7 | 8 | This new version has been completely rewritten in **typescript** to easily develop OPC UA Server supporting CoreAAS and take advantage of the type annotations and other amazing features that typescript introduce. It is worth noting that this new version is not compatible with the version 0.2.2. The API has been completely re-designed and now creating an OPC UA Server supporting CoreAAS Information Model is more linear and no strange workaround or fix is required. 9 | 10 | Since Typescript is transpilled in Javascript, you are not forced to write your server in Typescript. Feel free to use node-opcua-coreaas in your Javascript code. 11 | 12 | ## Overview 13 | **CoreAAS** Information Model is an OPC UA implementation of the Asset Administration Shell (AAS) metamodel [here](https://www.plattform-i40.de/I40/Redaktion/EN/Downloads/Publikation/2018-details-of-the-asset-administration-shell.html) provided by Platform Industrie 4.0. 14 | 15 | **node-opcua-coreaas** is an extension for the Node.js stack [node-opcua](https://github.com/node-opcua/node-opcua) including new functions in order to easily populate your OPC UA Server with Objects related to AAS, Assets, Submodel, etc. without taking care about putting the Nodes and references in the right place. 16 | 17 | ## Getting started 18 | ### Installing node-opcua-coreaas 19 | In order to start developing your own AAS using node-opcua-coreaas, just create a new folder and initialize an npm project: 20 | ``` 21 | $ mkdir my-project 22 | $ cd my-project 23 | $ npm init 24 | ``` 25 | After that, you can install node-opcua-coreaas as dependency using the following command: 26 | ``` 27 | $ npm install node-opcua-coreaas --save 28 | ``` 29 | You don't need to install [node-opcua](https://github.com/node-opcua/node-opcua) as dependency for your project since node-opcua-coreaas already depends on it and re-export all its API. Be careful if you decide to use node-opcua as dependancy, because the version you install may be different from the one node-opcua-core aas depends on. 30 | 31 | Creating an OPC UA Server suporting CoreAAS is very simple. The following example shows how to create a sample Server exposing an Asset Administration Shell with a Submodel and the physical Asset the AAS is representing: 32 | ```typescript 33 | import path from "path"; 34 | import { coreaasXmlFile, nodesets, localizedText, CoreServer, IdentifierType, Kind, KeyType, KeyElements } from "."; 35 | 36 | let xmlFiles = [nodesets.standard, coreaasXmlFile] 37 | 38 | let server = new CoreServer({ 39 | nodeset_filename: xmlFiles, 40 | port: 4848 41 | }) 42 | 43 | function post_initialize() { 44 | 45 | const Identifier = server.coreaas.Identifier; 46 | const Key = server.coreaas.Key; 47 | 48 | let admin = server.coreaas.addAdministrativeInformation({ 49 | version: "555", 50 | revision: "1825" 51 | }); 52 | 53 | const aas_1 = server.coreaas.addAssetAdministrationShell({ 54 | browseName: "SampleAAS", 55 | description: [ new LocalizedText({locale: "en", text: "Festo Controller"}), 56 | new LocalizedText({locale: "de", text: "Festo Controller"}) ], 57 | identification: new Identifier({ 58 | id: "www.admin-shell.io/aas-sample/1.0", 59 | idType: IdentifierType.URI 60 | }), 61 | assetRef: [new Key({ 62 | idType: KeyType.URI, 63 | local: true, 64 | type: KeyElements.Asset, 65 | value: "http://pk.festo.com/3S7PLFDRS35" 66 | })], 67 | derivedFromRef: [ new Key({ 68 | idType: KeyType.IRDI, 69 | local: false, 70 | type: KeyElements.AssetAdministrationShell, 71 | value: "AAA#1234-454#123456789" 72 | }) ], 73 | administration: admin 74 | }).addSubmodelRef([new Key({ 75 | idType: KeyType.URI, 76 | local: true, 77 | type: KeyElements.Submodel, 78 | value: "http://www.zvei.de/demo/submodel/12345679" 79 | })]);; 80 | 81 | let asset = server.coreaas.addAsset({ 82 | browseName: "3S7PLFDRS35", 83 | idShort: "3S7PLFDRS35", 84 | identification: new Identifier({ 85 | id: "http://pk.festo.com/3S7PLFDRS35", 86 | idType: IdentifierType.URI 87 | }), 88 | kind: Kind.Instance, 89 | description: "Festo Controller Asset", 90 | //assetOf: aas_1, 91 | assetIdentificationModelRef: [ new Key({ 92 | idType: KeyType.URI, 93 | local: false, 94 | type: KeyElements.Submodel, 95 | value: "//submodels/identification_3S7PLFDRS35" 96 | }) ] 97 | }); 98 | 99 | aas_1.hasAsset(asset) 100 | .addSubmodelRef([new Key({ 101 | idType: KeyType.URI, 102 | local: true, 103 | type: KeyElements.Submodel, 104 | value: "http://www.zvei.de/demo/submodel/12345679" 105 | })]); 106 | 107 | /** 108 | * Start The OPC UA Server 109 | */ 110 | server.start(function () { 111 | console.log("Server is now listening ... ( press CTRL+C to stop)"); 112 | console.log("port ", server.endpoints[0].port); 113 | var endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl; 114 | console.log(" the primary server endpoint url is ", endpointUrl ); 115 | }); 116 | } 117 | 118 | server.initialize(post_initialize); 119 | ``` 120 | 121 | Of course this is a very simple example. More entities, like SubmodelElements and ConceptDescriptions, can be added in the AddressSpace. 122 | 123 | ## Demos 124 | You can found 2 demo files in the project. Just use it as a fully example about how to use node-opua-coreaas. Of course be sure to change the `require` statement putting the node-opcua-coreaas module. 125 | 126 | - "demo.js" is a single-file sample showing an AAS based on the example shown in [this](https://www.plattform-i40.de/I40/Redaktion/EN/Downloads/Publikation/2018-details-of-the-asset-administration-shell.html) document. 127 | - "demo2.js" is the same as demo.js but with more elements and shows how to do the same things using different convenience methods. 128 | ---- 129 | 130 | ## Documentation 131 | 132 | The main entities of node-opcua-coreaas are CoreServer and CoreAASExtension: 133 | 134 | - **CoreServer** is the main class you use to create an OPC UA Server supporting CoreAAS. It is a subclass of **OPCUAServer** of node-opcua. 135 | - **CoreAASExtension** is the extension part of the CoreServer exposing all the methods necessary to create CoreAAS ObjectTypes instances inside the AddressSpace. Users should not use this class directly, but the property **coreaas** of CoreServer will provide a CoreAASExtension instance bounded to the AddressSpace that users should use to create CoreAAS entities. 136 | 137 | More details about the API can be found in the [documentation](https://opcuaunict.github.io/node-opcua-coreaas/index.html). 138 | 139 | ## References 140 | 141 | - [OPC UA-based Asset Administration Shell](https://ieeexplore.ieee.org/document/8926859) (IECON 2019) 142 | - [Insights into Mapping Solutions Based on OPC UA Information Model Applied to the Industry 4.0 Asset Administration Shell](https://www.mdpi.com/2073-431X/9/2/28) (MDPI - Computers 2020) 143 | -------------------------------------------------------------------------------- /dist/CoreAASExtension.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CoreAASExtension.js","sourceRoot":"","sources":["../src/CoreAASExtension.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAG7B,gDAEmG;AAGnG,iCAAkC;AAElC;;;;GAIG;AACH,MAAa,gBAAgB;IA0BzB;;OAEG;IACH,YAAmB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAd7C,mCAAmC;QACnB,iBAAY,GAAW,gCAAgC,CAAC;QACxE,iDAAiD;QACjC,mBAAc,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;QAEzF;;;kCAG0B;QACV,oBAAe,GAA0B,IAAI,GAAG,EAAE,CAAC;QAM/D,IAAI,CAAC,WAAW,GAAG,IAAI,oBAAU,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,sBAAsB,GAAG,IAAI,0CAAgC,CAAC,IAAI,CAAC,CAAC;QACzE,IAAI,CAAC,oBAAoB,GAAG,IAAI,6BAAmB,CAAC,IAAI,CAAC,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAY,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,wBAAwB,GAAG,IAAI,iCAAuB,CAAC,IAAI,CAAC,CAAC;QAClE,IAAI,CAAC,gBAAgB,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,4BAA4B,GAAG,IAAI,0CAAgC,CAAC,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,WAAW,GAAG,IAAI,0CAA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tF,gBAAgB,GAAS,gBAAiB,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aAClF;iBACI;gBACD,gBAAgB,GAAG,SAAS,CAAC;gBAC7B,MAAM;aACT;YAAA,CAAC;SACL;QAED,IAAI,gBAAgB,IAAI,IAAI;YACxB,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC;QAE/F,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAEpF,CAAC;CACJ;AA7RD,4CA6RC"} -------------------------------------------------------------------------------- /dist/CoreAAS_enums.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CoreAAS_enums.js","sourceRoot":"","sources":["../src/CoreAAS_enums.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAAoC;AAAhD,WAAY,cAAc;IAAG,mDAAI,CAAA;IAAE,iDAAG,CAAA;IAAE,uDAAM,CAAA;AAAC,CAAC,EAApC,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAAsB;AAAA,CAAC;AAEjD,IAAY,WA0BX;AA1BD,WAAY,WAAW;IACnB,mEAAe,CAAA;IACf,uEAAiB,CAAA;IACjB,6EAAoB,CAAA;IACpB,6FAA4B,CAAA;IAC5B,6CAAI,CAAA;IACJ,yDAAU,CAAA;IACV,uEAAiB,CAAA;IACjB,2DAAW,CAAA;IACX,iDAAM,CAAA;IACN,+CAAK,CAAA;IACL,8CAAI,CAAA;IACJ,gFAAqB,CAAA;IACrB,wDAAS,CAAA;IACT,wEAAiB,CAAA;IACjB,sDAAQ,CAAA;IACR,gDAAK,CAAA;IACL,sEAAgB,CAAA;IAChB,4EAAmB,CAAA;IACnB,oEA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W,CAAA;IACX,4EAAa,CAAA;IACb,0EAAY,CAAA;IACZ,sFAAkB,CAAA;IAClB,gFAAe,CAAA;IACf,8DAAM,CAAA;IACN,kEAAQ,CAAA;IACR,gFAAe,CAAA;IACf,oFAAiB,CAAA;IACjB,4DAAK,CAAA;IACL,0DAAI,CAAA;IACJ,8DAAM,CAAA;IACN,oEAAS,CAAA;IACT,4DAAK,CAAA;IACL,sEAAU,CAAA;IACV,oEAAS,CAAA;IACT,kEAAQ,CAAA;IACR,4DAAK,CAAA;IACL,8DAAM,CAAA;IACN,kFAAgB,CAAA;IAChB,4DAAK,CAAA;IACL,kEAAQ,CAAA;IACR,0DAAI,CAAA;IACJ,8DAAM,CAAA;IACN,8DAAM,CAAA;IACN,sDAAE,CAAA;IACF,4DAAK,CAAA;IACL,gEAAO,CAAA;IACP,0DAAI,CAAA;IACJ,kEAAQ,CAAA;IACR,8DAAM,CAAA;IACN,kEAAQ,CAAA;AACZ,CAAC,EApDW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAoD5B;AAED,IAAY,oBAgBX;AAhBD,WAAY,oBAAoB;IAC5B,+DAAI,CAAA;IACJ,mEAAM,CAAA;IACN,6FAAmB,CAAA;IACnB,qFAAe,CAAA;IACf,iFAAa,CAAA;IACb,uFAAgB,CAAA;IAChB,+EAAY,CAAA;IACZ,2EAAU,CAAA;IACV,iFAAa,CAAA;IACb,qEAAO,CAAA;IACP,8DAAG,CAAA;IACH,wEAAQ,CAAA;IACR,wFAAgB,CAAA;IAChB,gEAAI,CAAA;IACJ,0EAAS,CAAA;AACb,CAAC,EAhBW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAgB/B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,iFAAe,CAAA;IACf,qFAAiB,CAAA;AACrB,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B"} -------------------------------------------------------------------------------- /dist/CoreServer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.CoreServer = void 0; 4 | const node_opcua_1 = require("node-opcua"); 5 | const CoreAASExtension_1 = require("./CoreAASExtension"); 6 | const CoreAAS_enums_1 = require("./CoreAAS_enums"); 7 | /** 8 | * CoreServer extends OPCUAServer with all the features coming from the CoreAAS Information 9 | * Model. Use this class instead of OPCUAServer of node-opcua to create your OPC UA Server supporting 10 | * the Asset Administration Shell metamodel implemented in CoreAAS. 11 | * example: 12 | * ```typescript 13 | * import { coreaasXmlFile, OPCUACertificateManager, nodesets, CoreServer } from "node-opcua-coreaas"; 14 | * let xmlFiles = [nodesets.standard, coreaasXmlFile] 15 | * let server = new CoreServer({ 16 | * nodeset_filename: xmlFiles, 17 | * port: 4848, 18 | * serverCertificateManager: new OPCUACertificateManager({ 19 | * automaticallyAcceptUnknownCertificate: true, 20 | * rootFolder: path.join(__dirname, "../certs") 21 | * }) 22 | * }) 23 | * ``` 24 | */ 25 | class CoreServer extends node_opcua_1.OPCUAServer { 26 | /** 27 | * Use the same parameters of OPCUAServer. 28 | */ 29 | constructor(options) { 30 | super(options); 31 | } 32 | initialize(...args) { 33 | const done = args[0]; 34 | super.initialize(done); 35 | this.on("post_initialize", () => { 36 | this._addressSpace = this.engine.addressSpace; 37 | this.coreaas = new CoreAASExtension_1.CoreAASExtension(this._addressSpace); 38 | //Add Identifier for IEC 61360 Data Specification 39 | const Identifier = this.coreaas.Identifier; 40 | this.coreaas.findCoreAASObjectType("DataSpecificationIEC61360Type").identification.setValueFromSource(new node_opcua_1.Variant({ 41 | dataType: node_opcua_1.DataType.ExtensionObject, 42 | value: new Identifier({ 43 | id: "www.adminshell.io/DataSpecificationTemplates/DataSpecificationIEC61360", 44 | idType: CoreAAS_enums_1.IdentifierType.IRI 45 | }) 46 | })); 47 | }); 48 | } 49 | } 50 | exports.CoreServer = CoreServer; 51 | //# sourceMappingURL=CoreServer.js.map -------------------------------------------------------------------------------- /dist/CoreServer.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CoreServer.js","sourceRoot":"","sources":["../src/CoreServer.ts"],"names":[],"mappings":";;;AAAA,2CAA8F;AAC9F,yDAAsD;AACtD,mDAAiD;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,UAAW,SAAQ,wBAAW;IAUvC;;OAEG;IACH,YAAY,OAA4B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAIM,UAAU,CAAC,GAAG,IAAsB;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAe,CAAC;QACnC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;YAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,YAAa,CAAC;YAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,mCAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAExD,iDAAiD;YACjD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,+BAA+B,CAAG,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,oBAAO,CAAC;gBACtH,QAAQ,EAAE,qBAAQ,CAAC,eAAe;gBAClC,KAAK,EAAE,IAAI,UAAU,CAAC;oBAClB,EAAE,EAAE,wEAAwE;oBAC5E,MAAM,EAAE,8BAAc,CAAC,GAAG;iBAC7B,CAAC;aACL,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CAAA;IACN,CAAC;CACJ;AArCD,gCAqCC"} -------------------------------------------------------------------------------- /dist/builders/AASBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AASBuilder = void 0; 4 | const builder_utilities_1 = require("./builder_utilities"); 5 | const types_1 = require("../types"); 6 | const assert = require("assert"); 7 | const builder_1 = require("./builder"); 8 | class AASBuilder extends builder_1.Builder { 9 | constructor(coreaas) { 10 | super(coreaas); 11 | } 12 | addAssetAdministrationShell(options) { 13 | assert(types_1.isIdentifier(options.identification), "options.identification has not the internal structure of an Identifier"); 14 | const aasType = this.coreaas.getAASType(); 15 | const aasFolder = this._addressSpace.rootFolder.objects.assetAdministrationShells; 16 | const aas = this._namespace.addObject({ 17 | typeDefinition: aasType, 18 | browseName: options.browseName || "AAS_" + options.identification.id, 19 | nodeId: options.nodeId, 20 | organizedBy: aasFolder, 21 | }); 22 | aas.referableChildrenMap = new Map(); 23 | this.coreaas.identifiableMap.set(options.identification.id, aas); 24 | const folderType = this._addressSpace.findObjectType("FolderType").nodeId; 25 | const submodels = this._namespace.addObject({ 26 | typeDefinition: folderType, 27 | browseName: "Submodels", 28 | componentOf: aas 29 | }); 30 | const conceptDictionaries = this._namespace.addObject({ 31 | typeDefinition: folderType, 32 | browseName: "ConceptDictionaries", 33 | componentOf: aas 34 | }); 35 | const views = this._namespace.addObject({ 36 | typeDefinition: folderType, 37 | browseName: "Views", 38 | componentOf: aas 39 | }); 40 | const identification = builder_utilities_1.get_identification_creator(this.coreaas, aas)(options.identification); 41 | if (options.derivedFromRef != null) { 42 | this._create_addDerivedFromRef(aas)(options.derivedFromRef); 43 | } 44 | if (typeof options.assetRef !== "undefined") { 45 | this._create_addAssetRef(aas)(options.assetRef); 46 | } 47 | //Add description 48 | if (options.description != null) { 49 | const addDescriptionToAas = builder_utilities_1.get_description_creator(this.coreaas, aas); 50 | addDescriptionToAas(options.description); 51 | } 52 | if (options.administration != null) { 53 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AdministrativeInformationType")), "options.administration is not an AdministrativeInformationType Object."); 54 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 55 | aas.addReference({ referenceType: "HasComponent", nodeId: options.administration }); 56 | } 57 | /* Add convenient method */ 58 | aas.hasAsset = (asset) => { 59 | assert(asset.typeDefinitionObj.isSupertypeOf(this.coreaas.getAssetType()), "asset is not an AssetType instance"); 60 | const hasAssetRefType = this.coreaas.findCoreAASReferenceType("HasAsset"); 61 | aas.addReference({ referenceType: hasAssetRefType, nodeId: asset }); 62 | return aas; 63 | }; 64 | aas.isDerivedFrom = (der_aas) => { 65 | assert(der_aas.typeDefinitionObj.isSupertypeOf(this.coreaas.getAASType()), "asset is not an AssetType instance"); 66 | const isDerivedFromRefType = this.coreaas.findCoreAASReferenceType("IsDerivedFrom"); 67 | aas.addReference({ referenceType: isDerivedFromRefType, nodeId: der_aas }); 68 | return aas; 69 | }; 70 | aas.addConceptDictionary = (dict) => { 71 | assert(dict.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ConceptDictionaryType")), "parameter is not an ConceptDictionaryType instance."); 72 | aas.conceptDictionaries.addReference({ referenceType: "Organizes", nodeId: dict }); 73 | aas.referableChildrenMap.set(dict.idShort._dataValue.value.value, dict); 74 | return aas; 75 | }; 76 | aas.addSubmodelRef = (submodelRef) => { 77 | if (submodelRef instanceof Array) { 78 | submodelRef.forEach(el => assert(types_1.isKey(el), "submodelRef parameter contains an element that is not a Key.")); 79 | this.coreaas.addAASReference({ 80 | organizedBy: aas.submodels, 81 | browseName: submodelRef[submodelRef.length - 1].value + "_Ref", 82 | keys: submodelRef 83 | }); 84 | } 85 | else { 86 | assert(submodelRef.typeDefinitionObj.isSupertypeOf(this.coreaas.getAASReferenceType()), "submodelRef is not an AASReferenceType instance."); 87 | aas.submodels.addReference({ referenceType: "Organizes", nodeId: submodelRef }); 88 | } 89 | return aas; 90 | }; 91 | aas.hasSubmodel = (submodel) => { 92 | assert(submodel.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("SubmodelType")), "asset parameter is not an SubmodelType instance."); 93 | const hasSubmodelRefType = this.coreaas.findCoreAASReferenceType("HasSubmodel"); 94 | aas.addReference({ referenceType: hasSubmodelRefType, nodeId: submodel }); 95 | return aas; 96 | }; 97 | aas.addViews = (views) => { 98 | assert(views instanceof Array, "views parameter is not an Array."); 99 | views.forEach(view => { 100 | assert(view.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ViewType")), "An element of the Array is not a ViewType instance."); 101 | aas.views.addReference({ referenceType: "Organizes", nodeId: view }); 102 | aas.referableChildrenMap.set(view.idShort._dataValue.value.value, view); 103 | }); 104 | return aas; 105 | }; 106 | aas.addDerivedFromRef = this._create_addDerivedFromRef(aas); 107 | aas.addAssetRef = this._create_addAssetRef(aas); 108 | return aas; 109 | } 110 | _create_addDerivedFromRef(aas) { 111 | const self = this; 112 | return function (derivedFrom) { 113 | assert(!aas.hasOwnProperty("derivedFrom"), "the AASType Object already contains a UA Property with Browsename derivedFrom"); 114 | if (derivedFrom instanceof Array) { 115 | derivedFrom.forEach(el => assert(types_1.isKey(el), "derivedFrom parameter contains an element that is not a Key.")); 116 | self.coreaas.addAASReference({ 117 | componentOf: aas, 118 | browseName: "derivedFrom", 119 | keys: derivedFrom 120 | }); 121 | } 122 | else { 123 | assert(derivedFrom.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 124 | aas.addReference({ referenceType: "HasComponent", nodeId: derivedFrom }); 125 | } 126 | return aas; 127 | }; 128 | } 129 | _create_addAssetRef(aas) { 130 | const self = this; 131 | return function (assetRef) { 132 | assert(!aas.hasOwnProperty("asset"), "the AASType Object already contains a UA Property with Browsename asset"); 133 | if (assetRef instanceof Array) { 134 | assetRef.forEach(el => assert(types_1.isKey(el), "assetRef parameter contains an element that is not a Key.")); 135 | self.coreaas.addAASReference({ 136 | componentOf: aas, 137 | browseName: "asset", 138 | keys: assetRef 139 | }); 140 | } 141 | else { 142 | assert(assetRef.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 143 | assert(assetRef.browseName.name === "asset", "the browsename of assetRef is not asset"); 144 | aas.addReference({ referenceType: "HasComponent", nodeId: assetRef }); 145 | } 146 | return aas; 147 | }; 148 | } 149 | } 150 | exports.AASBuilder = AASBuilder; 151 | //# sourceMappingURL=AASBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/AASBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AASBuilder.js","sourceRoot":"","sources":["../../src/builders/AASBuilder.ts"],"names":[],"mappings":";;;AAEA,2DAA0F;AAE1F,oCAA2K;AAC3K,iCAAkC;AAClC,uCAAoC;AAGpC,MAAa,UAAW,SAAQ,iBAAO;IAEnC,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,2BAA2B,CAAC,OAAmB;QAE3C,MAAM,CAAC,oBAAY,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,wEAAwE,CAAC,CAAC;QAEvH,MAAM,OAAO,GAAiB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxD,MAAM,SAAS,GAA2B,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,OAAQ,CAAC,yBAAyB,CAAC;QAE3G,MAAM,GAAG,GAAc,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAC7C,cAAc,EAAE,OAAO;YACvB,UAAU,EAAK,OAAO,CAAC,UAAU,IAAI,MAAM,GAAgB,OAAO,CAAC,cAAe,CAAC,EAAE;YACrF,MAAM,EAAS,OAAO,CAAC,MAAM;YAC7B,WAAW,EAAE,SAAS;SACzB,CAAc,CAAC;QAEhB,GAAG,CAAC,oBAAoB,GAAG,IAAI,GAAG,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAEjE,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,YAAY,CAAE,CAAC,MAAM,CAAC;QAE3E,MAAM,SAAS,GAAG,IAAI,CAAC,U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BAExF,GAAG,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAC;aACxE;YAED,OAAO,GAAG,CAAC;QACf,CAAC,CAAA;IACL,CAAC;CACJ;AA9LD,gCA8LC"} -------------------------------------------------------------------------------- /dist/builders/AASReferenceBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AASReferenceBuilder = void 0; 4 | const assert = require("assert"); 5 | const types_1 = require("../types"); 6 | const builder_1 = require("./builder"); 7 | const node_opcua_1 = require("node-opcua"); 8 | class AASReferenceBuilder extends builder_1.Builder { 9 | constructor(coreaas) { 10 | super(coreaas); 11 | } 12 | addAASReference(options) { 13 | options.keys.forEach(el => assert(types_1.isKey(el), "options.keys contains an element has not the internal structure of a Key")); 14 | const aasReferenceType = this.coreaas.getAASReferenceType(); 15 | const aasReference = this._namespace.addObject({ 16 | typeDefinition: aasReferenceType, 17 | browseName: options.browseName, 18 | description: options.description, 19 | nodeId: options.nodeId, 20 | componentOf: options.componentOf 21 | }); 22 | const key = this._namespace.addVariable({ 23 | propertyOf: aasReference, 24 | browseName: "keys", 25 | dataType: this.coreaas.findCoreAASDataType("Key"), 26 | value: { 27 | get: function () { 28 | return new node_opcua_1.Variant({ 29 | dataType: node_opcua_1.DataType.ExtensionObject, 30 | arrayType: node_opcua_1.VariantArrayType.Array, 31 | value: options.keys 32 | }); 33 | } 34 | }, 35 | valueRank: 1 36 | }); 37 | if (options.organizedBy != null) { 38 | const organizingParent = options.organizedBy; 39 | organizingParent.addReference({ 40 | referenceType: "Organizes", 41 | nodeId: aasReference 42 | }); 43 | } 44 | if (options.isCaseOf != null) { 45 | const parent = options.isCaseOf; 46 | const isCaseOfRefType = this.coreaas.findCoreAASReferenceType("IsCaseOf"); 47 | parent.addReference({ 48 | referenceType: isCaseOfRefType, 49 | nodeId: aasReference 50 | }); 51 | } 52 | return aasReference; 53 | } 54 | } 55 | exports.AASReferenceBuilder = AASReferenceBuilder; 56 | //# sourceMappingURL=AASReferenceBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/AASReferenceBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AASReferenceBuilder.js","sourceRoot":"","sources":["../../src/builders/AASReferenceBuilder.ts"],"names":[],"mappings":";;;AACA,iCAAkC;AAClC,oCAAqD;AACrD,uCAAoC;AAEpC,2CAAiE;AAEjE,MAAa,mBAAoB,SAAQ,iBAAO;IAE5C,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,eAAe,CAAC,OAA4B;QAExC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,aAAK,CAAC,EAAE,CAAC,EAAE,0EAA0E,CAAC,CAAC,CAAC;QAE1H,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAE5D,MAAM,YAAY,GAAuB,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAC/D,cAAc,EAAE,gBAAgB;YAChC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,WAAW,EAAE,OAAO,CAAC,WAAW;SACnC,CAAuB,CAAC;QAEzB,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YACpC,UAAU,EAAE,YAAY;YACxB,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAE;YAClD,KAAK,EAAE;gBACH,GAAG,EAAE;oBACD,OAAO,IAAI,oBAAO,CAAC;wBACf,QAAQ,EAAE,qBAAQ,CAAC,eAAe;wBAClC,SAAS,EAAE,6BAAgB,CAAC,KAAK;wBACjC,KAAK,EAAE,OAAO,CAAC,IAAI;qBACtB,CAAC,CAAC;gBACP,CAAC;aACJ;YACD,SAAS,EAAE,CAAC;SACf,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,WAAW,IAAI,IAAI,EAAE;YAC7B,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;YAE7C,gBAAgB,CAAC,YAAY,CAAC;gBAC1B,aAAa,EAAE,WAAW;gBAC1B,MAAM,EAAE,YAAY;aACvB,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;YAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAChC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,UAAU,CAAE,CAAC;YAE3E,MAAM,CAAC,YAAY,CAAC;gBAChB,aAAa,EAAE,eAAe;gBAC9B,MAAM,EAAE,YAAY;aACvB,CAAC,CAAC;SACN;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;CACJ;AAzDD,kDAyDC"} -------------------------------------------------------------------------------- /dist/builders/AdministrativeInformationBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AdministrativeInformationBuilder = void 0; 4 | const node_opcua_1 = require("node-opcua"); 5 | const builder_1 = require("./builder"); 6 | class AdministrativeInformationBuilder extends builder_1.Builder { 7 | constructor(coreaas) { 8 | super(coreaas); 9 | } 10 | addAdministrativeInformation(options) { 11 | const adminType = this.coreaas.getAdministrativeInformationType(); 12 | const admin = this._namespace.addObject({ 13 | browseName: options.browseName || "administration", 14 | componentOf: options.componentOf, 15 | typeDefinition: adminType, 16 | description: options.description, 17 | nodeId: options.nodeId 18 | }); 19 | if (options.version != null) { 20 | this._namespace.addVariable({ 21 | browseName: "version", 22 | propertyOf: admin, 23 | dataType: "String", 24 | value: { 25 | get: () => { 26 | return new node_opcua_1.Variant({ 27 | dataType: node_opcua_1.DataType.String, 28 | value: options.version 29 | }); 30 | } 31 | } 32 | }); 33 | } 34 | if (options.revision != null) { 35 | this._namespace.addVariable({ 36 | browseName: "revision", 37 | propertyOf: admin, 38 | dataType: "String", 39 | value: { 40 | get: () => { 41 | return new node_opcua_1.Variant({ 42 | dataType: node_opcua_1.DataType.String, 43 | value: options.revision 44 | }); 45 | } 46 | } 47 | }); 48 | } 49 | return admin; 50 | } 51 | } 52 | exports.AdministrativeInformationBuilder = AdministrativeInformationBuilder; 53 | //# sourceMappingURL=AdministrativeInformationBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/AdministrativeInformationBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AdministrativeInformationBuilder.js","sourceRoot":"","sources":["../../src/builders/AdministrativeInformationBuilder.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAG/C,uCAAoC;AAIpC,MAAa,gCAAiC,SAAQ,iBAAO;IAEzD,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,4BAA4B,CAAC,OAAyC;QAClE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,CAAC;QAElE,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YACpC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,gBAAgB;YAClD,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,cAAc,EAAE,SAAS;YACzB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;SACzB,CAAoC,CAAC;QAEtC,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE;YAEzB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;gBACxB,UAAU,EAAE,SAAS;gBACrB,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE;oBACH,GAAG,EAAE,GAAG,EAAE;wBACN,OAAO,IAAI,oBAAO,CAAC;4BACf,QAAQ,EAAE,qBAAQ,CAAC,MAAM;4BACzB,KAAK,EAAE,OAAO,CAAC,OAAO;yBACzB,CAAC,CAAC;oBACP,CAAC;iBACJ;aACJ,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;YAE1B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;gBACxB,UAAU,EAAE,UAAU;gBACtB,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE;oBACH,GAAG,EAAE,GAAG,EAAE;wBACN,OAAO,IAAI,oBAAO,CAAC;4BACf,QAAQ,EAAE,qBAAQ,CAAC,MAAM;4BACzB,KAAK,EAAE,OAAO,CAAC,QAAQ;yBAC1B,CAAC,CAAC;oBACP,CAAC;iBACJ;aACJ,CAAC,CAAC;SACN;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AArDD,4EAqDC"} -------------------------------------------------------------------------------- /dist/builders/AssetBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AssetBuilder = void 0; 4 | const builder_utilities_1 = require("./builder_utilities"); 5 | const types_1 = require("../types"); 6 | const assert = require("assert"); 7 | const builder_1 = require("./builder"); 8 | class AssetBuilder extends builder_1.Builder { 9 | constructor(coreaas) { 10 | super(coreaas); 11 | } 12 | addAsset(options) { 13 | assert(options.identification != null, "No options.identification parameter inserted!"); 14 | assert(types_1.isIdentifier(options.identification), "options.identification is not an Identifier."); 15 | const assetType = this.coreaas.getAssetType(); 16 | const assetsFolder = this._addressSpace.rootFolder.objects.assets; 17 | const asset = this._namespace.addObject({ 18 | typeDefinition: assetType, 19 | browseName: options.browseName || "Asset_" + options.identification.id, 20 | nodeId: options.nodeId, 21 | organizedBy: assetsFolder, 22 | }); 23 | asset.referableChildrenMap = new Map(); 24 | this.coreaas.identifiableMap.set(options.identification.id, asset); 25 | //Add identification 26 | const identification = builder_utilities_1.get_identification_creator(this.coreaas, asset)(options.identification); 27 | //Add idShort 28 | const idShort = builder_utilities_1.get_idShort_creator(this.coreaas, asset)(options.idShort); 29 | //Add description 30 | if (options.description != null) { 31 | const addDescriptionToAsset = builder_utilities_1.get_description_creator(this.coreaas, asset); 32 | addDescriptionToAsset(options.description); 33 | } 34 | if (options.administration != null) { 35 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.getAdministrativeInformationType()), "options.administration is not an AdministrativeInformationType Object."); 36 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 37 | asset.addReference({ referenceType: "HasComponent", nodeId: options.administration }); 38 | } 39 | //Add assetIdentificationModel 40 | if (typeof options.assetIdentificationModelRef !== "undefined") { 41 | this._create_addAssetIdentificationModel(asset)(options.assetIdentificationModelRef); 42 | } 43 | //Add billOfMaterial 44 | if (typeof options.billOfMaterialRef !== "undefined") { 45 | this._create_addBillOfMaterial(asset)(options.billOfMaterialRef); 46 | } 47 | //Add this Asset to the AAS 48 | if (options.assetOf != null) { 49 | const parent = options.assetOf; 50 | const hasAssetRefType = this.coreaas.findCoreAASReferenceType("HasAsset"); 51 | parent.addReference({ referenceType: hasAssetRefType, nodeId: asset }); 52 | } 53 | //Add kind 54 | if (options.kind != null) { 55 | builder_utilities_1.get_assetkind_creator(this.coreaas, asset)(options.kind); 56 | } 57 | asset.addAssetIdentificationModelRef = this._create_addAssetIdentificationModel(asset); 58 | asset.addBillOfMaterialRef = this._create_addBillOfMaterial(asset); 59 | return asset; 60 | } 61 | _create_addAssetIdentificationModel(asset) { 62 | const self = this; 63 | return function (model) { 64 | assert(!asset.hasOwnProperty("assetIdentificationModel"), "the AssetType Object already contains a UA Property with Browsename assetIdentificationModel"); 65 | if (model instanceof Array) { 66 | model.forEach(el => assert(types_1.isKey(el), "model parameter contains an element that is not a Key.")); 67 | self.coreaas.addAASReference({ 68 | componentOf: asset, 69 | browseName: "assetIdentificationModel", 70 | keys: model 71 | }); 72 | } 73 | else { 74 | assert(model.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 75 | assert(model.browseName.name === "assetIdentificationModel", "model BrowseName is not 'assetIdentificationModel'"); 76 | asset.addReference({ referenceType: "HasComponent", nodeId: model }); 77 | } 78 | return asset; 79 | }; 80 | } 81 | _create_addBillOfMaterial(asset) { 82 | const self = this; 83 | return function (model) { 84 | assert(!asset.hasOwnProperty("billOfMaterial"), "the AssetType Object already contains a UA Property with Browsename billOfMaterial"); 85 | if (model instanceof Array) { 86 | model.forEach(el => assert(types_1.isKey(el), "model parameter contains an element that is not a Key.")); 87 | self.coreaas.addAASReference({ 88 | componentOf: asset, 89 | browseName: "billOfMaterial", 90 | keys: model 91 | }); 92 | } 93 | else { 94 | assert(model.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 95 | assert(model.browseName.name === "billOfMaterial", "model BrowseName is not 'billOfMaterial'"); 96 | asset.addReference({ referenceType: "HasComponent", nodeId: model }); 97 | } 98 | return asset; 99 | }; 100 | } 101 | } 102 | exports.AssetBuilder = AssetBuilder; 103 | //# sourceMappingURL=AssetBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/AssetBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AssetBuilder.js","sourceRoot":"","sources":["../../src/builders/AssetBuilder.ts"],"names":[],"mappings":";;;AAEA,2DAAsI;AAEtI,oCAAmG;AACnG,iCAAkC;AAClC,uCAAoC;AAGpC,MAAa,YAAa,SAAQ,iBAAO;IAErC,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,OAAqB;QAE1B,MAAM,CAAC,OAAO,CAAC,cAAc,IAAI,IAAI,EAAE,+CAA+C,CAAC,CAAC;QACxF,MAAM,CAAC,oBAAY,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,8CAA8C,CAAC,CAAC;QAE7F,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B;oBAC5B,IAAI,EAAE,KAAK;iBACd,CAAC,CAAC;aACN;iBAAO;gBACJ,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,EAAE,yCAAyC,CAAC,CAAC;gBAC7H,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,gBAAgB,EAAE,0CAA0C,CAAC,CAAC;gBAE/F,KAAK,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;aACxE;YAED,OAAO,KAAK,CAAC;QACjB,CAAC,CAAA;IACL,CAAC;CAEJ;AAzHD,oCAyHC"} -------------------------------------------------------------------------------- /dist/builders/ConceptDescriptionBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ConceptDescriptionBuilder = void 0; 4 | const builder_1 = require("./builder"); 5 | const node_opcua_1 = require("node-opcua"); 6 | const ua_object_1 = require("node-opcua-address-space/dist/src/ua_object"); 7 | const types_1 = require("../types"); 8 | const assert = require("assert"); 9 | const builder_utilities_1 = require("./builder_utilities"); 10 | class ConceptDescriptionBuilder extends builder_1.Builder { 11 | constructor(coreaas) { 12 | super(coreaas); 13 | } 14 | addConceptDescription(options) { 15 | assert(options.identification != null, "No options.identification parameter inserted!"); 16 | assert(types_1.isIdentifier(options.identification), "options.identification is not an Identifier."); 17 | const conceptDescriptionType = this.coreaas.findCoreAASObjectType("ConceptDescriptionType"); 18 | const conceptDescriptions = this._addressSpace.rootFolder.objects.conceptDescriptions; 19 | const conceptDescription = this._namespace.addObject({ 20 | typeDefinition: conceptDescriptionType, 21 | browseName: options.browseName || "ConceptDescription_" + options.identification.id, 22 | nodeId: options.nodeId, 23 | organizedBy: conceptDescriptions, 24 | }); 25 | this.coreaas.identifiableMap.set(options.identification.id, conceptDescription); 26 | //Add identification 27 | this._namespace.addVariable({ 28 | propertyOf: conceptDescription, 29 | browseName: "identification", 30 | dataType: this.coreaas.findCoreAASDataType("Identifier"), 31 | value: { 32 | get: function () { 33 | return new node_opcua_1.Variant({ 34 | dataType: node_opcua_1.DataType.ExtensionObject, 35 | value: options.identification 36 | }); 37 | } 38 | } 39 | }); 40 | //Add description 41 | if (options.description != null) { 42 | const addDescriptionToConceptDescription = builder_utilities_1.get_description_creator(this.coreaas, conceptDescription); 43 | addDescriptionToConceptDescription(options.description); 44 | } 45 | //Add Administration 46 | if (options.administration != null) { 47 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.getAdministrativeInformationType()), "options.administration is not an AdministrativeInformationType Object."); 48 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 49 | conceptDescription.addReference({ referenceType: "HasComponent", nodeId: options.administration }); 50 | } 51 | //Add this Asset to the AAS 52 | if (options.conceptDescriptionOf != null) { 53 | assert(options.conceptDescriptionOf instanceof ua_object_1.UAObject, "options.conceptDescriptionOf is not an UAObject."); 54 | const hasConceptDescriptionRefType = this.coreaas.findCoreAASReferenceType("HasConceptDescription"); 55 | options.conceptDescriptionOf.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescription }); 56 | } 57 | //Add EmbeddedDataSpecification 58 | if (options.hasEmbeddedDataSpecifications != null) { 59 | this._create_hasEmbeddedDataSpecifications(conceptDescription)(options.hasEmbeddedDataSpecifications); 60 | } 61 | conceptDescription.semanticOf = (elem) => { 62 | assert(elem instanceof ua_object_1.UAObject, "elem is not a UAObject."); 63 | const hasSemanticRefType = this.coreaas.findCoreAASReferenceType("HasSemantic"); 64 | elem.addReference({ referenceType: hasSemanticRefType, nodeId: conceptDescription }); 65 | return conceptDescription; 66 | }; 67 | conceptDescription.isCaseOf = (ref) => { 68 | assert(ref instanceof Array || ref instanceof ua_object_1.UAObject, "ref is neither a UAObject or an Array of Key."); 69 | if (ref instanceof Array) { 70 | ref.forEach(el => assert(types_1.isKey(el), "ref Array contains an element that is not a Key.")); 71 | this.coreaas.addAASReference({ 72 | isCaseOf: conceptDescription, 73 | browseName: "Case_" + ref[ref.length - 1].value, 74 | keys: ref 75 | }); 76 | } 77 | else { 78 | assert(ref.keys != null, "assetRef is not an AASReferenceType instance."); 79 | conceptDescription.addReference({ referenceType: "HasComponent", nodeId: ref }); 80 | } 81 | return conceptDescription; 82 | }; 83 | conceptDescription.hasEmbeddedDataSpecifications = this._create_hasEmbeddedDataSpecifications(conceptDescription); 84 | conceptDescription.conceptDescriptionOf = this.create_conceptDescriptionOf(conceptDescription); 85 | return conceptDescription; 86 | } 87 | ; 88 | _create_hasEmbeddedDataSpecifications(conceptDes) { 89 | const coreaas = this.coreaas; 90 | return function (eds) { 91 | let embedds = []; 92 | embedds = embedds.concat(embedds, eds); 93 | embedds.forEach((e) => { 94 | assert(e instanceof ua_object_1.UAObject, "eds contains some element that is not UAObject."); 95 | }); 96 | const hasEmbeddedDataSpecificationRefType = coreaas.findCoreAASReferenceType("HasEmbeddedDataSpecification"); 97 | embedds.forEach((e) => conceptDes.addReference({ referenceType: hasEmbeddedDataSpecificationRefType, nodeId: e })); 98 | return conceptDes; 99 | }; 100 | } 101 | create_conceptDescriptionOf(conceptDescription) { 102 | const coreaas = this.coreaas; 103 | return function (dict) { 104 | assert(dict instanceof ua_object_1.UAObject, "dict is not an UAObject."); 105 | const hasConceptDescriptionRefType = coreaas.findCoreAASReferenceType("HasConceptDescription"); 106 | dict.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescription }); 107 | return conceptDescription; 108 | }; 109 | } 110 | } 111 | exports.ConceptDescriptionBuilder = ConceptDescriptionBuilder; 112 | //# sourceMappingURL=ConceptDescriptionBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/ConceptDescriptionBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ConceptDescriptionBuilder.js","sourceRoot":"","sources":["../../src/builders/ConceptDescriptionBuilder.ts"],"names":[],"mappings":";;;AA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,CAAC,kBAAkB,CAAC,CAAC;QAE/F,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAAA,CAAC;IAEM,qCAAqC,CAAC,UAAoC;QAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,OAAO,UAAU,GAA4B;YACzC,IAAI,OAAO,GAAgB,EAAE,CAAC;YAC9B,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;YACtC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAClB,MAAM,CAAC,CAAC,YAAY,oBAAQ,EAAE,iDAAiD,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YACH,MAAM,mCAAmC,GAAG,OAAO,CAAC,wBAAwB,CAAC,8BAA8B,CAAE,CAAC;YAE9G,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,mCAAmC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnH,OAAO,UAAU,CAAC;QACtB,CAAC,CAAA;IACL,CAAC;IAEO,2BAA2B,CAAC,kBAA4C;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,OAAO,UAAS,IAA6B;YACzC,MAAM,CAAC,IAAI,YAAY,oBAAQ,EAAE,0BAA0B,CAAC,CAAC;YAE7D,MAAM,4BAA4B,GAAG,OAAO,CAAC,wBAAwB,CAAC,uBAAuB,CAAE,CAAC;YAEhG,IAAI,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,4BAA4B,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAC/F,OAAO,kBAAkB,CAAC;QAC9B,CAAC,CAAA;IACL,CAAC;CACJ;AAnID,8DAmIC"} -------------------------------------------------------------------------------- /dist/builders/ConceptDictionaryBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ConceptDictionaryBuilder = void 0; 4 | const builder_1 = require("./builder"); 5 | const types_1 = require("../types"); 6 | const node_opcua_1 = require("node-opcua"); 7 | const assert = require("assert"); 8 | const builder_utilities_1 = require("./builder_utilities"); 9 | class ConceptDictionaryBuilder extends builder_1.Builder { 10 | constructor(coreaas) { 11 | super(coreaas); 12 | } 13 | addConceptDictionary(options) { 14 | assert(options.idShort != null, "No options.idShort parameter inserted!"); 15 | const conceptDictionaryType = this.coreaas.findCoreAASObjectType("ConceptDictionaryType"); 16 | const conceptDictionary = this._namespace.addObject({ 17 | typeDefinition: conceptDictionaryType, 18 | browseName: options.browseName || options.idShort + "_Dictionary", 19 | nodeId: options.nodeId 20 | }); 21 | const folderType = this._addressSpace.findNode("FolderType").nodeId; 22 | //Add conceptDescriptions 23 | const conceptDescriptions = this._namespace.addObject({ 24 | typeDefinition: folderType, 25 | browseName: "ConceptDescriptions", 26 | componentOf: conceptDictionary 27 | }); 28 | let idShort = this._namespace.addVariable({ 29 | propertyOf: conceptDictionary, 30 | browseName: "idShort", 31 | dataType: "String", 32 | value: { 33 | get: function () { 34 | return new node_opcua_1.Variant({ 35 | dataType: node_opcua_1.DataType.String, 36 | value: options.idShort 37 | }); 38 | } 39 | } 40 | }); 41 | //Add this ConceptDictionary to an AAS 42 | if (options.conceptDictionaryOf != null) { 43 | const conceptDictionaries = options.conceptDictionaryOf.conceptDictionaries; 44 | conceptDictionaries.addReference({ referenceType: "Organizes", nodeId: conceptDictionary }); 45 | options.conceptDictionaryOf.referableChildrenMap.set(conceptDictionary.idShort._dataValue.value.value, conceptDictionary); 46 | } 47 | //Add Parent 48 | if (options.parent != null) { 49 | builder_utilities_1.get_parent_creator(this.coreaas, conceptDictionary)(options.parent); 50 | } 51 | //Add description 52 | if (options.description != null) { 53 | const addDescriptionToProperty = builder_utilities_1.get_description_creator(this.coreaas, conceptDictionary); 54 | addDescriptionToProperty(options.description); 55 | } 56 | conceptDictionary.hasConceptDescriptions = (conceptDescriptions) => { 57 | const hasConceptDescriptionRefType = this.coreaas.findCoreAASReferenceType("HasConceptDescription"); 58 | if (conceptDescriptions instanceof Array) { 59 | conceptDescriptions.forEach(conceptDescription => { 60 | assert(conceptDescription.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ConceptDescriptionType")), "An element of the Array is not a ConceptDescriptionType instance."); 61 | conceptDictionary.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescription }); 62 | }); 63 | } 64 | else { 65 | assert(conceptDescriptions.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ConceptDescriptionType")), "conceptDescriptions is not a ConceptDescriptionType instance."); 66 | conceptDictionary.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescriptions }); 67 | } 68 | return conceptDictionary; 69 | }; 70 | conceptDictionary.addParent = builder_utilities_1.get_parent_creator(this.coreaas, conceptDictionary); 71 | conceptDictionary.addConceptDescriptionRef = (conceptDescriptionRef) => { 72 | if (conceptDescriptionRef instanceof Array) { 73 | conceptDescriptionRef.forEach(el => assert(types_1.isKey(el), "Array parameter contains an element that is not a Key.")); 74 | this.coreaas.addAASReference({ 75 | organizedBy: conceptDictionary.conceptDescriptions, 76 | browseName: conceptDescriptionRef[conceptDescriptionRef.length - 1].value + "_Ref", 77 | keys: conceptDescriptionRef 78 | }); 79 | } 80 | else { 81 | assert(conceptDescriptionRef.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASReferenceType")), "conceptDescriptionRef is not an AASReferenceType instance."); 82 | conceptDictionary.conceptDescriptions.addReference({ referenceType: "Organizes", nodeId: conceptDescriptionRef }); 83 | } 84 | return conceptDictionary; 85 | }; 86 | return conceptDictionary; 87 | } 88 | } 89 | exports.ConceptDictionaryBuilder = ConceptDictionaryBuilder; 90 | //# sourceMappingURL=ConceptDictionaryBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/ConceptDictionaryBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ConceptDictionaryBuilder.js","sourceRoot":"","sources":["../../src/builders/ConceptDictionaryBuilder.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAEpC,oCAAsG;AACtG,2CAA+C;AAC/C,iCAAkC;AAClC,2DAAkF;AAGlF,MAAa,wBAAyB,SAAQ,iBAAO;IAEjD,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,oBAAoB,CAAC,OAAiC;QAClD,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE,wCAAwC,CAAC,CAAC;QAE1E,MAAM,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,uBAAuB,CAAE,CAAC;QAE3F,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAChD,cAAc,EAAE,qBAAqB;YACrC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,GAAG,aAAa;YACjE,MAAM,EAAE,OAAO,CAAC,MAAM;SACzB,CAA4B,CAAC;QAE9B,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAE,CAAC,MAAM,CAAC;QAErE,yBAAyB;QACzB,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAClD,cAAc,EAAE,UAAU;YAC1B,UAAU,EAAE,qBAAqB;YACjC,WAAW,EAAE,iBAAiB;SACjC,CAAC,CAAC;QAEH,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YACtC,UAAU,EAAE,iBAAiB;YAC7B,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE;gBACH,GAAG,EAAE;oBACD,OAAO,IAAI,oBAAO,CAAC;wBACf,QAAQ,EAAE,qBAAQ,CAAC,MAAM;wBACzB,KAAK,EAAE,O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AC,CAAC,CAAC;aACpH;YAED,OAAO,iBAAiB,CAAC;QAC7B,CAAC,CAAA;QAED,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ;AAvGD,4DAuGC"} -------------------------------------------------------------------------------- /dist/builders/DataSpecificationIEC61360Builder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.DataSpecificationIEC61360Builder = void 0; 4 | const node_opcua_1 = require("node-opcua"); 5 | const types_1 = require("../types"); 6 | const assert = require("assert"); 7 | const builder_1 = require("./builder"); 8 | class DataSpecificationIEC61360Builder extends builder_1.Builder { 9 | constructor(coreaas) { 10 | super(coreaas); 11 | } 12 | addDataSpecificationIEC61360(options) { 13 | const iecType = this.coreaas.findCoreAASObjectType("DataSpecificationIEC61360Type"); 14 | const dataSpec = this._namespace.addObject({ 15 | typeDefinition: iecType, 16 | browseName: options.browseName || "dataSpecificationContent", 17 | description: options.description, 18 | nodeId: options.nodeId 19 | }); 20 | if (options.identifier != null) 21 | this._addUAProperty_for_string(dataSpec, "identifier", options.identifier); 22 | if (options.preferredName != null) 23 | this._addUAProperty_for_string(dataSpec, "preferredName", options.preferredName); 24 | if (options.definition != null) 25 | this._addUAProperty_for_string(dataSpec, "definition", options.definition); 26 | if (options.dataType != null) { 27 | assert(!dataSpec.hasOwnProperty("dataType"), "dataSpec already contains a UA Proeprty with the browseName dataType"); 28 | this._namespace.addVariable({ 29 | browseName: "dataType", 30 | propertyOf: dataSpec, 31 | dataType: this.coreaas.findCoreAASDataType("DataTypeIEC61360Type"), 32 | value: { 33 | get: () => { 34 | return new node_opcua_1.Variant({ 35 | dataType: node_opcua_1.DataType.Int32, 36 | value: options.dataType 37 | }); 38 | } 39 | } 40 | }); 41 | } 42 | if (options.unit != null) 43 | this._addUAProperty_for_string(dataSpec, "unit", options.unit); 44 | if (options.unitId != null) { 45 | assert(!dataSpec.hasOwnProperty("unitId"), "the DataSpecificationIEC61360Type Object already contains a UA Property with Browsename unitId"); 46 | if (options.unitId instanceof Array) { 47 | options.unitId.forEach(el => assert(types_1.isKey(el), "options.unitId Array contains an element that is not a Key.")); 48 | this.coreaas.addAASReference({ 49 | componentOf: dataSpec, 50 | browseName: "unitId", 51 | keys: options.unitId 52 | }); 53 | } 54 | else { 55 | assert(options.unitId.typeDefinitionObj.isSupertypeOf(this.coreaas.getAASReferenceType()), "options.unitId is not an AASReferenceType instance."); 56 | dataSpec.addReference({ referenceType: "HasComponent", nodeId: options.unitId }); 57 | } 58 | } 59 | if (options.iecCategory != null) 60 | this._addUAProperty_for_string(dataSpec, "iecCategory", options.iecCategory); 61 | if (options.iecLanguageCode != null) 62 | this._addUAProperty_for_string(dataSpec, "iecLanguageCode", options.iecLanguageCode); 63 | if (options.note != null) 64 | this._addUAProperty_for_string(dataSpec, "note", options.note); 65 | if (options.shortName != null) 66 | this._addUAProperty_for_string(dataSpec, "shortName", options.shortName); 67 | if (options.valueFormat != null) 68 | this._addUAProperty_for_string(dataSpec, "valueFormat", options.valueFormat); 69 | if (options.version != null) 70 | this._addUAProperty_for_string(dataSpec, "version", options.version); 71 | if (options.revision != null) 72 | this._addUAProperty_for_string(dataSpec, "revision", options.revision); 73 | return dataSpec; 74 | } 75 | _addUAProperty_for_string(dataSpec, browseName, value) { 76 | assert(!dataSpec.hasOwnProperty(browseName), "dataSpec already contains a UA Proeprty with the browseName " + browseName); 77 | this._namespace.addVariable({ 78 | browseName: browseName, 79 | propertyOf: dataSpec, 80 | dataType: "String", 81 | value: { 82 | get: () => { 83 | return new node_opcua_1.Variant({ 84 | dataType: node_opcua_1.DataType.String, 85 | value: value 86 | }); 87 | } 88 | } 89 | }); 90 | } 91 | } 92 | exports.DataSpecificationIEC61360Builder = DataSpecificationIEC61360Builder; 93 | //# sourceMappingURL=DataSpecificationIEC61360Builder.js.map -------------------------------------------------------------------------------- /dist/builders/DataSpecificationIEC61360Builder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DataSpecificationIE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Q,EAAE,qBAAQ,CAAC,MAAM;wBACzB,KAAK,EAAE,KAAK;qBACf,CAAC,CAAC;gBACP,CAAC;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;CACJ;AAnFD,4EAmFC"} -------------------------------------------------------------------------------- /dist/builders/EmbeddedDataSpecificationBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.EmbeddedDataSpecificationBuilder = void 0; 4 | const ua_object_1 = require("node-opcua-address-space/dist/src/ua_object"); 5 | const assert = require("assert"); 6 | const types_1 = require("../types"); 7 | const builder_1 = require("./builder"); 8 | class EmbeddedDataSpecificationBuilder extends builder_1.Builder { 9 | constructor(coreaas) { 10 | super(coreaas); 11 | } 12 | addEmbeddedDataSpecification(options) { 13 | options.hasDataSpecification.forEach(el => assert(types_1.isKey(el), "assetRef parameter contains an element that is not a Key.")); 14 | const edsType = this.coreaas.findCoreAASObjectType("EmbeddedDataSpecificationType"); 15 | const eds = this._namespace.addObject({ 16 | typeDefinition: edsType, 17 | browseName: options.browseName, 18 | description: options.description, 19 | nodeId: options.nodeId 20 | }); 21 | this.coreaas.addAASReference({ 22 | componentOf: eds, 23 | browseName: "hasDataSpecification", 24 | keys: options.hasDataSpecification 25 | }); 26 | if (options.dataSpecificationContent != null) { 27 | eds.addReference({ referenceType: "HasComponent", nodeId: options.dataSpecificationContent }); 28 | } 29 | if (options.embeddedDataSpecificationOf != null) { 30 | const parent = options.embeddedDataSpecificationOf; 31 | const hasEmbeddedDataSpecificationType = this.coreaas.findCoreAASReferenceType("HasEmbeddedDataSpecification"); 32 | parent.addReference({ referenceType: hasEmbeddedDataSpecificationType, nodeId: eds }); 33 | } 34 | eds.addDataSpecificationIEC61360 = (options) => { 35 | assert(!eds.hasOwnProperty("dataSpecificationContent"), "the EmbeddedDataSpecificationType Object already contains a Component with Browsename dataSpecificationContent"); 36 | if (options instanceof ua_object_1.UAObject) { 37 | assert(options.browseName.name === "dataSpecificationContent", "options parameter browsename is not 'dataSpecificationContent'."); 38 | eds.addReference({ referenceType: "HasComponent", nodeId: options }); 39 | } 40 | else { 41 | const dataSpec = this.coreaas.addDataSpecificationIEC61360(options); 42 | eds.addReference({ referenceType: "HasComponent", nodeId: dataSpec }); 43 | } 44 | return eds; 45 | }; 46 | return eds; 47 | } 48 | } 49 | exports.EmbeddedDataSpecificationBuilder = EmbeddedDataSpecificationBuilder; 50 | //# sourceMappingURL=EmbeddedDataSpecificationBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/EmbeddedDataSpecificationBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"EmbeddedDataSpecificationBuilder.js","sourceRoot":"","sources":["../../src/builders/EmbeddedDataSpecificationBuilder.ts"],"names":[],"mappings":";;;AAGA,2EAAuE;AACvE,iCAAkC;AAClC,oCAAuE;AACvE,uCAAoC;AAGpC,MAAa,gCAAiC,SAAQ,iBAAO;IAEzD,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,4BAA4B,CAAC,OAAyC;QAClE,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,aAAK,CAAC,EAAE,CAAC,EAAE,2DAA2D,CAAC,CAAC,CAAC;QAE3H,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,+BAA+B,CAAE,CAAC;QACrF,MAAM,GAAG,GAAc,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAC7C,cAAc,EAAE,OAAO;YACvB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;SACzB,CAAc,CAAC;QAEhB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;YACzB,WAAW,EAAE,GAAG;YAChB,UAAU,EAAE,sBAAsB;YAClC,IAAI,EAAE,OAAO,CAAC,oBAAoB;SACrC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,wBAAwB,IAAI,IAAI,EAAE;YAAE,GAAG,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;SAAE;QAEhJ,IAAG,OAAO,CAAC,2BAA2B,IAAI,IAAI,EAC9C;YACI,MAAM,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;YACnD,MAAM,gCAAgC,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,8BAA8B,CAAE,CAAC;YAEhH,MAAM,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,gCAAgC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;SACzF;QAED,GAAG,CAAC,4BAA4B,GAAG,CAAC,OAAgE,EAAE,EAAE;YACpG,MAAM,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,gHAAgH,CAAC,CAAC;YAE1K,IAAI,OAAO,YAAY,oBAAQ,EAAE;gBAC7B,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,0BAA0B,EAAE,iEAAiE,CAAC,CAAC;gBAClI,GAAG,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;aACxE;iBAAM;gBACH,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;gBACpE,GAAG,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;aACzE;YACD,OAAO,GAAG,CAAC;QACf,CAAC,CAAA;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAhDD,4EAgDC"} -------------------------------------------------------------------------------- /dist/builders/SubmodelBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.SubmodelBuilder = void 0; 4 | const builder_1 = require("./builder"); 5 | const types_1 = require("../types"); 6 | const CoreAAS_enums_1 = require("../CoreAAS_enums"); 7 | const assert = require("assert"); 8 | const builder_utilities_1 = require("./builder_utilities"); 9 | class SubmodelBuilder extends builder_1.Builder { 10 | constructor(coreaas) { 11 | super(coreaas); 12 | } 13 | addSubmodel(options) { 14 | assert(options.identification != null, "No options.identification parameter inserted!"); 15 | assert(options.idShort != null, "No options.idShort parameter inserted!"); 16 | assert(types_1.isIdentifier(options.identification), "options.identification is not an Identifier."); 17 | const submodelType = this.coreaas.findCoreAASObjectType("SubmodelType"); 18 | const submodelsFolder = this._addressSpace.rootFolder.objects.submodels; 19 | const submodel = this._namespace.addObject({ 20 | typeDefinition: submodelType, 21 | browseName: options.browseName || "Submodel_" + options.identification.id, 22 | nodeId: options.nodeId, 23 | organizedBy: submodelsFolder, 24 | }); 25 | submodel.referableChildrenMap = new Map(); 26 | this.coreaas.identifiableMap.set(options.identification.id, submodel); 27 | //Add identification 28 | const identification = builder_utilities_1.get_identification_creator(this.coreaas, submodel)(options.identification); 29 | //Add idShort 30 | const idShort = builder_utilities_1.get_idShort_creator(this.coreaas, submodel)(options.idShort); 31 | //Add Submodels 32 | this._namespace.addObject({ 33 | typeDefinition: this._addressSpace.findNode("FolderType").nodeId, 34 | browseName: "SubmodelElements", 35 | componentOf: submodel 36 | }); 37 | //Add description 38 | if (options.description != null) { 39 | const addDescriptionToAas = builder_utilities_1.get_description_creator(this.coreaas, submodel); 40 | addDescriptionToAas(options.description); 41 | } 42 | if (options.administration != null) { 43 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AdministrativeInformationType")), "options.administration is not an AdministrativeInformationType Object."); 44 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 45 | submodel.addReference({ referenceType: "HasComponent", nodeId: options.administration }); 46 | } 47 | //Add kind 48 | if (options.kind != null) { 49 | builder_utilities_1.get_modelingkind_creator(this.coreaas, submodel)(options.kind); 50 | } 51 | if (options.semanticId != null) { 52 | builder_utilities_1.get_semanticId_creator(this.coreaas, submodel)(options.semanticId); 53 | } 54 | if (options.parent != null) { 55 | builder_utilities_1.get_parent_creator(this.coreaas, submodel)(options.parent); 56 | } 57 | /* Convenience methods */ 58 | submodel.hasSubmodelSemantic = (semanticElem) => { 59 | assert(semanticElem.hasOwnProperty("kind"), "semanticElem is not a SubmodelType instance."); 60 | assert(semanticElem.kind.readValue().value.value === CoreAAS_enums_1.ModelingKind.Template, "semanticElem is not a Submodel with kind = Template"); 61 | const hasSubmodelSemanticRefType = this.coreaas.findCoreAASReferenceType("HasSubmodelSemantic"); 62 | submodel.addReference({ referenceType: hasSubmodelSemanticRefType, nodeId: semanticElem }); 63 | return submodel; 64 | }; 65 | submodel.hasSemantic = (semanticElem) => { 66 | const hasSubmodelSemanticRefType = this.coreaas.findCoreAASReferenceType("HasSemantic"); 67 | submodel.addReference({ referenceType: hasSubmodelSemanticRefType, nodeId: semanticElem }); 68 | return submodel; 69 | }; 70 | submodel.addSemanticId = builder_utilities_1.get_semanticId_creator(this.coreaas, submodel); 71 | submodel.submodelOf = (aas) => { 72 | assert(aas.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASType")), "aas parameter is not an AASType instance."); 73 | const hasSubmodelRef = this.coreaas.findCoreAASReferenceType("HasSubmodel"); 74 | aas.addReference({ referenceType: hasSubmodelRef, nodeId: submodel }); 75 | return submodel; 76 | }; 77 | submodel.addParent = builder_utilities_1.get_parent_creator(this.coreaas, submodel); 78 | submodel.addElements = (elemArray) => { 79 | assert(elemArray instanceof Array, "elemArray parameter is not an Array."); 80 | elemArray.forEach(el => { 81 | const submodelElementType = this.coreaas.findCoreAASObjectType("SubmodelElementType"); 82 | assert(el.typeDefinitionObj.isSupertypeOf(submodelElementType), "elemArray contains an element that is not a subtype instance of SubmodelElementType."); //isSupertypeOf is confusional. It should be isSubtypeOf 83 | const submodelElements = submodel.submodelElements; 84 | submodelElements.addReference({ referenceType: "Organizes", nodeId: el }); 85 | submodel.referableChildrenMap.set(el.idShort._dataValue.value.value, el); 86 | }); 87 | return submodel; 88 | }; 89 | return submodel; 90 | } 91 | } 92 | exports.SubmodelBuilder = SubmodelBuilder; 93 | //# sourceMappingURL=SubmodelBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/SubmodelBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SubmodelBuilder.js","sourceRoot":"","sources":["../../src/builders/SubmodelBuilder.ts"],"names":[],"mappings":";;;AACA,uCAAoC;AACpC,oCAA4H;AAE5H,oDAAgD;AAChD,iCAAkC;AAClC,2DAAqL;AAGrL,MAAa,eAAgB,SAAQ,iBAAO;IAExC,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,OAAwB;QAChC,MAAM,CAAC,OAAO,CAAC,cAAc,IAAI,IAAI,EAAE,+CAA+C,CAAC,CAAC;QACxF,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE,wCAAwC,CAAC,CAAC;QAC1E,MAAM,CAAC,oBAAY,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,8CAA8C,CAAC,CAAC;QAE7F,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,cAAc,CAAE,CAAC;QACzE,MAAM,eAAe,GAA0B,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,OAAQ,CAAC,SAAS,CAAC;QAEhG,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YACvC,cAAc,EAAE,YAAY;YAC5B,UAAU,EAAK,OAAO,CAAC,UAAU,IAAI,WAAW,GAAgB,OAAO,CAAC,cAAe,CAAC,EAAE;YAC1F,MAAM,EAAS,OAAO,CAAC,MAAM;YAC7B,WAAW,EAAE,eAAe;SA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C,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC7E,CAAC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACpB,CAAC,CAAA;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAjHD,0CAiHC"} -------------------------------------------------------------------------------- /dist/builders/SubmodelPropertyBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.SubmodelPropertyBuilder = void 0; 4 | const node_opcua_1 = require("node-opcua"); 5 | const builder_1 = require("./builder"); 6 | const types_1 = require("../types"); 7 | const assert = require("assert"); 8 | const builder_utilities_1 = require("./builder_utilities"); 9 | class SubmodelPropertyBuilder extends builder_1.Builder { 10 | constructor(coreaas) { 11 | super(coreaas); 12 | } 13 | addSubmodelProperty(options) { 14 | const submodelPropertyType = this.coreaas.findCoreAASObjectType("SubmodelPropertyType"); 15 | const property = this._namespace.addObject({ 16 | typeDefinition: submodelPropertyType, 17 | browseName: options.browseName || "Property_" + options.idShort, 18 | nodeId: options.nodeId 19 | }); 20 | //Add this Submodel Property to a Submodel 21 | if (options.submodelElementOf != null) { 22 | assert(options.submodelElementOf.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("SubmodelType")), "options.submodelElementOf is not a SubmodelType."); 23 | const submodelElements = options.submodelElementOf.submodelElements; 24 | submodelElements.addReference({ referenceType: "Organizes", nodeId: property }); 25 | options.submodelElementOf.referableChildrenMap.set(options.idShort, property); 26 | } 27 | //Add idShort 28 | const idShort = this._namespace.addVariable({ 29 | propertyOf: property, 30 | browseName: "idShort", 31 | dataType: "String", 32 | value: { 33 | get: function () { 34 | return new node_opcua_1.Variant({ 35 | dataType: node_opcua_1.DataType.String, 36 | value: options.idShort 37 | }); 38 | } 39 | } 40 | }); 41 | //Add description 42 | if (options.description != null) { 43 | const addDescriptionToProperty = builder_utilities_1.get_description_creator(this.coreaas, property); 44 | addDescriptionToProperty(options.description); 45 | } 46 | //Add kind 47 | if (options.kind != null) { 48 | const addKindToProperty = builder_utilities_1.get_modelingkind_creator(this.coreaas, property); 49 | addKindToProperty(options.kind); 50 | } 51 | //Add Category 52 | if (options.category != null) { 53 | const addCategoryToProperty = builder_utilities_1.get_category_creator(this.coreaas, property); 54 | addCategoryToProperty(options.category); 55 | } 56 | //Add semantic id 57 | if (options.semanticId != null) { 58 | builder_utilities_1.get_semanticId_creator(this.coreaas, property)(options.semanticId); 59 | } 60 | //Add Parent 61 | if (options.parent != null) { 62 | builder_utilities_1.get_parent_creator(this.coreaas, property)(options.parent); 63 | } 64 | //Add valueId 65 | if (options.valueId != null) { 66 | this._create_valueId(property)(options.valueId); 67 | } 68 | //Add Value 69 | if (options.value != null) { 70 | this._namespace.addVariable({ 71 | propertyOf: property, 72 | browseName: "value", 73 | dataType: options.value.dataType, 74 | value: options.value.value 75 | }); 76 | } 77 | //Add ValueType 78 | if (options.valueType != null) { 79 | let valueType = options.valueType; 80 | this._namespace.addVariable({ 81 | propertyOf: property, 82 | browseName: "valueType", 83 | dataType: this.coreaas.findCoreAASDataType("PropertyValueType"), 84 | value: { 85 | get: () => { 86 | return new node_opcua_1.Variant({ dataType: node_opcua_1.DataType.Int32, value: valueType }); 87 | } 88 | } 89 | }); 90 | } 91 | property.addSemanticId = builder_utilities_1.get_semanticId_creator(this.coreaas, property); 92 | property.hasSemantic = (function (coreaas) { 93 | const hasSemanticRefType = coreaas.findCoreAASReferenceType("HasSemantic"); 94 | return function (semanticElem) { 95 | property.addReference({ referenceType: hasSemanticRefType, nodeId: semanticElem }); 96 | return property; 97 | }; 98 | })(this.coreaas); 99 | property.addParent = builder_utilities_1.get_parent_creator(this.coreaas, property); 100 | property.addValueId = this._create_valueId(property); 101 | return property; 102 | } 103 | _create_valueId(obj) { 104 | let coreaas = this.coreaas; 105 | return function (valueId) { 106 | assert(!valueId.hasOwnProperty("valueId"), "the " + obj.browseName + " Object already contains a Component with BrowseName valueId"); 107 | if (valueId instanceof Array) { 108 | valueId.forEach(el => assert(types_1.isKey(el), "valueId Array contains an element that is not a Key.")); 109 | coreaas.addAASReference({ 110 | componentOf: obj, 111 | browseName: "valueId", 112 | keys: valueId 113 | }); 114 | } 115 | else { 116 | assert(valueId.typeDefinitionObj.isSupertypeOf(coreaas.getAASReferenceType()), "valueId is not an AASReferenceType instance."); 117 | obj.addReference({ referenceType: "HasComponent", nodeId: valueId }); 118 | } 119 | return obj; 120 | }; 121 | } 122 | } 123 | exports.SubmodelPropertyBuilder = SubmodelPropertyBuilder; 124 | //# sourceMappingURL=SubmodelPropertyBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/SubmodelPropertyBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SubmodelPropertyBuilder.js","sourceRoot":"","sources":["../../src/builders/SubmodelPropertyBuilder.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAEzD,uCAAoC;AACpC,oCAAsF;AACtF,iCAAkC;AAClC,2DAA0J;AAG1J,MAAa,uBAAwB,SAAQ,iBAAO;IAEhD,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,mBAAmB,CAAC,OAAgC;QAChD,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,sBAAsB,CAAE,CAAC;QAEzF,MAAM,QAAQ,GAA2B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAC/D,cAAc,EAAE,oBAAoB;YACpC,UAAU,EAAK,OAAO,CAAC,UAAU,IAAI,WAAW,GAAG,OAAO,CAAC,OAAO;YAClE,MAAM,EAAS,OAAO,CAAC,MAAM;SAChC,CAA2B,CAAC;QAE7B,0CAA0C;QAC1C,IAAI,OAAO,CAAC,iBAAiB,IAAI,IAAI,EAAE;YACnC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,aAAa,CAAC,IAAI,CAAC,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,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,EAAE,8CAA8C,CAAC,CAAC;gBAE/H,GAAG,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAC,CAAC,CAAC;aACvE;YAED,OAAO,GAAG,CAAC;QACf,CAAC,CAAA;IACL,CAAC;CACJ;AA7ID,0DA6IC"} -------------------------------------------------------------------------------- /dist/builders/ViewBuilder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ViewBuilder = void 0; 4 | const types_1 = require("../types"); 5 | const builder_1 = require("./builder"); 6 | const assert = require("assert"); 7 | const builder_utilities_1 = require("./builder_utilities"); 8 | class ViewBuilder extends builder_1.Builder { 9 | constructor(coreaas) { 10 | super(coreaas); 11 | } 12 | addAASView(options) { 13 | assert(options.idShort != null, "options.idShort parameter is missing."); 14 | const viewType = this.coreaas.findCoreAASObjectType("ViewType"); 15 | const view = this._namespace.addObject({ 16 | typeDefinition: viewType, 17 | browseName: options.browseName || "View_" + options.idShort, 18 | nodeId: options.nodeId 19 | }); 20 | view.referableChildrenMap = new Map(); 21 | const folderType = this._addressSpace.findNode("FolderType").nodeId; 22 | const containedElements = this._namespace.addObject({ 23 | typeDefinition: folderType, 24 | browseName: "ContainedElements", 25 | componentOf: view 26 | }); 27 | //Add idShort 28 | const idShort = builder_utilities_1.get_idShort_creator(this.coreaas, view)(options.idShort); 29 | if (options.viewOf != null) { 30 | assert(options.viewOf.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASType")), "options.viewOf is not a AASType."); 31 | const views = options.viewOf.views; 32 | views.addReference({ referenceType: "Organizes", nodeId: view }); 33 | options.viewOf.referableChildrenMap.set(options.idShort, view); 34 | } 35 | if (options.semanticId != null) { 36 | builder_utilities_1.get_semanticId_creator(this.coreaas, view)(options.semanticId); 37 | } 38 | if (options.parent != null) { 39 | builder_utilities_1.get_parent_creator(this.coreaas, view)(options.parent); 40 | } 41 | //Add description 42 | if (options.description != null) { 43 | const addDescriptionToView = builder_utilities_1.get_description_creator(this.coreaas, view); 44 | addDescriptionToView(options.description); 45 | } 46 | view.addSemanticId = builder_utilities_1.get_semanticId_creator(this.coreaas, view); 47 | view.addParent = builder_utilities_1.get_parent_creator(this.coreaas, view); 48 | view.addContainedElementRef = (elemRef) => { 49 | if (elemRef instanceof Array) { 50 | elemRef.forEach(el => assert(types_1.isKey(el), "Array parameter contains an element that is not a Key.")); 51 | this.coreaas.addAASReference({ 52 | organizedBy: view.containedElements, 53 | browseName: elemRef[elemRef.length - 1].value + "_Ref", 54 | keys: elemRef 55 | }); 56 | } 57 | else { 58 | assert(elemRef.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASReferenceType")), "elemRef is not an AASReferenceType instance."); 59 | view.containedElements.addReference({ referenceType: "Organizes", nodeId: elemRef }); 60 | } 61 | return view; 62 | }; 63 | view.containsElements = (elements) => { 64 | const submodelElementType = this.coreaas.findCoreAASObjectType("SubmodelElementType"); 65 | const containsElementRefType = this.coreaas.findCoreAASReferenceType("ContainsElement"); 66 | if (elements instanceof Array) { 67 | elements.forEach(element => { 68 | assert(element.typeDefinitionObj.isSupertypeOf(submodelElementType), "An element of the Array is not a SubmodelElementType instance."); 69 | view.addReference({ referenceType: containsElementRefType, nodeId: element }); 70 | view.referableChildrenMap.set(element.idShort._dataValue.value.value, element); 71 | }); 72 | } 73 | else { 74 | view.addReference({ referenceType: containsElementRefType, nodeId: elements }); 75 | view.referableChildrenMap.set(elements.idShort._dataValue.value.value, elements); 76 | } 77 | return view; 78 | }; 79 | return view; 80 | } 81 | } 82 | exports.ViewBuilder = ViewBuilder; 83 | //# sourceMappingURL=ViewBuilder.js.map -------------------------------------------------------------------------------- /dist/builders/ViewBuilder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ViewBuilder.js","s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AAC,CAAC;gBAC9E,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAqC,QAAS,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aACzH;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAA;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAhGD,kCAgGC"} -------------------------------------------------------------------------------- /dist/builders/builder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 5 | }) : (function(o, m, k, k2) { 6 | if (k2 === undefined) k2 = k; 7 | o[k2] = m[k]; 8 | })); 9 | var __exportStar = (this && this.__exportStar) || function(m, exports) { 10 | for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); 11 | }; 12 | Object.defineProperty(exports, "__esModule", { value: true }); 13 | exports.Builder = void 0; 14 | class Builder { 15 | constructor(coreaas) { 16 | this.coreaas = coreaas; 17 | this._addressSpace = coreaas.addressSpace; 18 | this._namespace = coreaas.namespace; 19 | } 20 | } 21 | exports.Builder = Builder; 22 | __exportStar(require("./AASBuilder"), exports); 23 | __exportStar(require("./AASReferenceBuilder"), exports); 24 | __exportStar(require("./AdministrativeInformationBuilder"), exports); 25 | __exportStar(require("./AssetBuilder"), exports); 26 | __exportStar(require("./DataSpecificationIEC61360Builder"), exports); 27 | __exportStar(require("./EmbeddedDataSpecificationBuilder"), exports); 28 | __exportStar(require("./ConceptDescriptionBuilder"), exports); 29 | __exportStar(require("./ConceptDictionaryBuilder"), exports); 30 | __exportStar(require("./SubmodelBuilder"), exports); 31 | __exportStar(require("./SubmodelPropertyBuilder"), exports); 32 | __exportStar(require("./SubmodelElementsBuilder"), exports); 33 | __exportStar(require("./ViewBuilder"), exports); 34 | //# sourceMappingURL=builder.js.map -------------------------------------------------------------------------------- /dist/builders/builder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/builders/builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAGA,MAAsB,OAAO;IAIzB,YAAsB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QAC3C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IACxC,CAAC;CACJ;AARD,0BAQC;AAED,+CAA6B;AAC7B,wDAAsC;AACtC,qEAAmD;AACnD,iDAA+B;AAC/B,qEAAmD;AACnD,qEAAmD;AACnD,8DAA2C;AAC3C,6DAA2C;AAC3C,oDAAiC;AACjC,4DAA0C;AAC1C,4DAA0C;AAC1C,gDAA8B"} -------------------------------------------------------------------------------- /dist/builders/builder_utilities.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.get_parent_creator = exports.get_semanticId_creator = exports.get_category_creator = exports.get_assetkind_creator = exports.get_modelingkind_creator = exports.get_description_creator = exports.get_idShort_creator = exports.get_identification_creator = void 0; 4 | const types_1 = require("../types"); 5 | const node_opcua_1 = require("node-opcua"); 6 | const assert = require("assert"); 7 | function get_identification_creator(coreaas, identifiable) { 8 | return function (identification) { 9 | return coreaas.namespace.addVariable({ 10 | propertyOf: identifiable, 11 | browseName: "identification", 12 | dataType: coreaas.findCoreAASDataType("Identifier"), 13 | value: { 14 | get: function () { 15 | return new node_opcua_1.Variant({ 16 | dataType: node_opcua_1.DataType.ExtensionObject, 17 | value: identification 18 | }); 19 | } 20 | } 21 | }); 22 | }; 23 | } 24 | exports.get_identification_creator = get_identification_creator; 25 | function get_idShort_creator(coreaas, referableObj) { 26 | return function (idShort) { 27 | return coreaas.namespace.addVariable({ 28 | propertyOf: referableObj, 29 | browseName: "idShort", 30 | dataType: "String", 31 | value: { 32 | get: function () { 33 | return new node_opcua_1.Variant({ 34 | dataType: node_opcua_1.DataType.String, 35 | value: idShort 36 | }); 37 | } 38 | } 39 | }); 40 | }; 41 | } 42 | exports.get_idShort_creator = get_idShort_creator; 43 | function get_description_creator(coreaas, describedObj) { 44 | return function (description) { 45 | let localizedTextArray = []; 46 | if (typeof description === "string") { 47 | localizedTextArray.push(new node_opcua_1.LocalizedText({ text: description })); 48 | } 49 | else if (description instanceof node_opcua_1.LocalizedText) { 50 | localizedTextArray.push(description); 51 | } 52 | else { 53 | description.forEach(el => assert(el instanceof node_opcua_1.LocalizedText, "An element of the array is not a LocalizedText.")); 54 | localizedTextArray = description; 55 | } 56 | const desc = coreaas.namespace.addVariable({ 57 | propertyOf: describedObj, 58 | browseName: "description", 59 | dataType: "LocalizedText", 60 | value: { 61 | get: function () { 62 | return new node_opcua_1.Variant({ 63 | dataType: node_opcua_1.DataType.LocalizedText, 64 | arrayType: node_opcua_1.VariantArrayType.Array, 65 | value: localizedTextArray 66 | }); 67 | } 68 | }, 69 | valueRank: 1 70 | }); 71 | return desc; 72 | }; 73 | } 74 | exports.get_description_creator = get_description_creator; 75 | function get_modelingkind_creator(coreaas, hasKindObj) { 76 | return function (kind) { 77 | return coreaas.namespace.addVariable({ 78 | propertyOf: hasKindObj, 79 | browseName: "kind", 80 | dataType: coreaas.findCoreAASDataType("ModelingKind"), 81 | value: { 82 | get: () => { 83 | return new node_opcua_1.Variant({ dataType: node_opcua_1.DataType.Int32, value: kind }); 84 | } 85 | } 86 | }); 87 | }; 88 | } 89 | exports.get_modelingkind_creator = get_modelingkind_creator; 90 | function get_assetkind_creator(coreaas, hasKindObj) { 91 | return function (kind) { 92 | return coreaas.namespace.addVariable({ 93 | propertyOf: hasKindObj, 94 | browseName: "kind", 95 | dataType: coreaas.findCoreAASDataType("AssetKind"), 96 | value: { 97 | get: () => { 98 | return new node_opcua_1.Variant({ dataType: node_opcua_1.DataType.Int32, value: kind }); 99 | } 100 | } 101 | }); 102 | }; 103 | } 104 | exports.get_assetkind_creator = get_assetkind_creator; 105 | function get_category_creator(coreaas, referableObj) { 106 | return function (category) { 107 | return coreaas.namespace.addVariable({ 108 | propertyOf: referableObj, 109 | browseName: "category", 110 | dataType: coreaas.findCoreAASDataType("PropertyCategory"), 111 | value: { 112 | get: () => { 113 | return new node_opcua_1.Variant({ dataType: node_opcua_1.DataType.Int32, value: category }); 114 | } 115 | } 116 | }); 117 | }; 118 | } 119 | exports.get_category_creator = get_category_creator; 120 | function get_semanticId_creator(coreaas, obj) { 121 | return function (semanticId) { 122 | assert(!semanticId.hasOwnProperty("semanticId"), "the " + obj.browseName + " Object already contains a Component with BrowseName semanticId"); 123 | if (semanticId instanceof Array) { 124 | semanticId.forEach(el => assert(types_1.isKey(el), "semanticId Array contains an element that is not a Key.")); 125 | coreaas.addAASReference({ 126 | componentOf: obj, 127 | browseName: "semanticId", 128 | keys: semanticId 129 | }); 130 | } 131 | else { 132 | assert(semanticId.typeDefinitionObj.isSupertypeOf(coreaas.getAASReferenceType()), "semanticId is not an AASReferenceType instance."); 133 | obj.addReference({ referenceType: "HasComponent", nodeId: semanticId }); 134 | } 135 | return obj; 136 | }; 137 | } 138 | exports.get_semanticId_creator = get_semanticId_creator; 139 | function get_parent_creator(coreaas, obj) { 140 | return function (parent) { 141 | assert(!parent.hasOwnProperty("parent"), "the " + obj.browseName + " Object already contains a Component with BrowseName parent"); 142 | if (parent instanceof Array) { 143 | parent.forEach(el => assert(types_1.isKey(el), "parent Array contains an element that is not a Key.")); 144 | coreaas.addAASReference({ 145 | componentOf: obj, 146 | browseName: "parent", 147 | keys: parent 148 | }); 149 | } 150 | else { 151 | assert(parent.typeDefinitionObj.isSupertypeOf(coreaas.getAASReferenceType()), "parent is not an AASReferenceType instance."); 152 | obj.addReference({ referenceType: "HasComponent", nodeId: parent }); 153 | } 154 | return obj; 155 | }; 156 | } 157 | exports.get_parent_creator = get_parent_creator; 158 | //# sourceMappingURL=builder_utilities.js.map -------------------------------------------------------------------------------- /dist/builders/builder_utilities.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"builder_utilities.js","sourceRoot":"","sources":["../../src/builders/builder_utilities.ts"],"names":[],"mappings":";;;AAAA,oCAAuE;AAEvE,2CAAsG;AACtG,iCAAkC;AAIlC,SAAgB,0BAA0B,CAAC,OAAyB,EAAE,YAAsB;IAExF,OAAO,UAAS,cAA0B;QACtC,OAAO,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC;YACjC,UAAU,EAAE,YAAY;YACxB,UAAU,EAAE,gBAAgB;YAC5B,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAE;YACpD,KAAK,EAAE;gBACH,GAAG,EAAE;oBACD,OAAO,IAAI,oBAAO,CAAC;wBACf,QAAQ,EAAE,qBAAQ,CAAC,eAAe;wBAClC,KAAK,EAAE,cAAc;qBACxB,CAAC,CAAC;gBACP,CAAC;aACJ;SACJ,CAAC,CAAC;IACP,CAAC,CAAA;AACL,CAAC;AAjBD,gEAiBC;AAED,SAAgB,mBAAmB,CAAC,OAAyB,EAAE,YAAsB;IAEjF,OAAO,UAAU,OAAe;QAC5B,OAAO,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC;YACjC,UAAU,EAAE,YAAY;YACxB,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE;gBACH,GAAG,EAAE;oBACD,OAAO,IAAI,oBAAO,CAAC;wBACf,QAAQ,EAAE,qBAAQ,CAAC,MAAM;wBACzB,KAAK,EAAE,OAAO;qBACjB,CAAC,CAAC;gBACP,CAAC;aACJ;SACJ,CAAC,CAAC;IACP,CAAC,CAAA;AACL,CAAC;AAjBD,kDAiBC;AAED,SAAgB,uBAAuB,CAAC,OAAyB,EAAE,YAAsB;IAErF,OAAO,UAAS,WAAwB;QAEpC,IAAI,kBAAkB,GAAoB,EAAE,CAAC;QAE7C,IAAG,OAAO,WAAW,KAAK,QAAQ,EAAE;YAChC,kBAA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QAED,OAAO,GAAG,CAAC;IACf,CAAC,CAAA;AACL,CAAC;AAvBD,gDAuBC"} -------------------------------------------------------------------------------- /dist/demo.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"demo.js","sourceRoot":"","sources":["../src/demo.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,wBAA6M;AAC7M,mDAAkE;AAElE,IAAI,QAAQ,GAAG,CAAC,WAAQ,CAAC,QAAQ,EAAE,iBAAc,CAAC,CAAA;AAElD,IAAI,MAAM,GAAG,IAAI,aAAU,CAAC;IACxB,gBAAgB,EAAE,QAAQ;IAC1B,IAAI,EAAE,IAAI;IACV,wBAAwB,EAAE,IAAI,0BAAuB,CAAC;QAClD,qCAAqC,EAAE,IAAI;QAC3C,UAAU,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;KAC/C,CAAC;CACL,CAAC,CAAA;AAEF,SAAS,eAAe;IAEpB,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;IAC7C,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IAE/B,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,4BAA4B,CAAC;QACpD,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,MAAM;KACnB,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC;QACrD,UAAU,EAAE,WAAW;QACvB,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,CAAG,IAAI,gBAAa,CAAC,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAC,CAAC;YAC3D,IAAI,gBAAa,CAAC,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAC,CAAC,CAAE;QAC7E,cAAc,EAAE,IAAI,UAAU,CAAC;YAC3B,EAAE,EAAE,mCAAmC;YACvC,MAAM,EAAE,i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------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 5 | }) : (function(o, m, k, k2) { 6 | if (k2 === undefined) k2 = k; 7 | o[k2] = m[k]; 8 | })); 9 | var __exportStar = (this && this.__exportStar) || function(m, exports) { 10 | for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); 11 | }; 12 | var __importDefault = (this && this.__importDefault) || function (mod) { 13 | return (mod && mod.__esModule) ? mod : { "default": mod }; 14 | }; 15 | Object.defineProperty(exports, "__esModule", { value: true }); 16 | exports.coreaasXmlFile = void 0; 17 | __exportStar(require("node-opcua"), exports); 18 | __exportStar(require("./CoreServer"), exports); 19 | __exportStar(require("./CoreAASExtension"), exports); 20 | __exportStar(require("./CoreAAS_enums"), exports); 21 | const path_1 = __importDefault(require("path")); 22 | exports.coreaasXmlFile = path_1.default.join(__dirname, "../nodesets/coreaas.xml"); 23 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAE3B,+CAA6B;AAC7B,qDAAkC;AAClC,kDAAgC;AAEhC,gDAAwB;AACX,QAAA,cAAc,GAAW,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC"} -------------------------------------------------------------------------------- /dist/options_types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=options_types.js.map -------------------------------------------------------------------------------- /dist/options_types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"options_types.js","sourceRoot":"","sources":["../src/options_types.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isKey = exports.isIdentifier = void 0; 4 | function isIdentifier(id) { 5 | return ("idType" in id && typeof id.idType === "number") && ("id" in id && typeof id.id === "string"); 6 | } 7 | exports.isIdentifier = isIdentifier; 8 | function isKey(key) { 9 | return ("idType" in key && typeof key.idType === "number") && 10 | ("local" in key && typeof key.local === "boolean") && 11 | ("type" in key && typeof key.type === "number") && 12 | ("value" in key && typeof key.value === "string"); 13 | } 14 | exports.isKey = isKey; 15 | //# sourceMappingURL=types.js.map -------------------------------------------------------------------------------- /dist/types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAyCA,SAAgB,YAAY,CAAC,EAAgB;IACzC,OAAO,CAAC,QAAQ,IAAI,EAAE,IAAI,OAAa,EAAG,CAAC,MAAM,KAAK,QAAQ,CAAE,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,OAAa,EAAG,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;AACzH,CAAC;AAFD,oCAEC;AAED,SAAgB,KAAK,CAAC,GAAiB;IACnC,OAAQ,CAAC,QAAQ,IAAI,GAAG,IAAI,OAAa,GAAI,CAAC,MAAM,KAAK,QAAQ,CAAE;QAC3D,CAAC,OAAO,IAAI,GAAG,IAAI,OAAa,GAAI,CAAC,KAAK,KAAK,SAAS,CAAC;QACzD,CAAC,MAAM,IAAI,GAAG,IAAI,OAAa,GAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;QACtD,CAAC,OAAO,IAAI,GAAG,IAAI,OAAa,GAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;AACrE,CAAC;AALD,sBAKC"} -------------------------------------------------------------------------------- /docs/assets/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCUAUniCT/node-opcua-coreaas/69cc94150deed78f0cc53c4f0635cfab365f4674/docs/assets/images/icons.png -------------------------------------------------------------------------------- /docs/assets/images/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCUAUniCT/node-opcua-coreaas/69cc94150deed78f0cc53c4f0635cfab365f4674/docs/assets/images/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/images/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCUAUniCT/node-opcua-coreaas/69cc94150deed78f0cc53c4f0635cfab365f4674/docs/assets/images/widgets.png -------------------------------------------------------------------------------- /docs/assets/images/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCUAUniCT/node-opcua-coreaas/69cc94150deed78f0cc53c4f0635cfab365f4674/docs/assets/images/widgets@2x.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-opcua-coreaas", 3 | "version": "1.1.0", 4 | "description": "An extension for node-opcua implementing coreAAS Information Model", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "build": "npx tsc", 8 | "start": "npx tsc & node dist/index.js", 9 | "demo": "npx tsc & node dist/demo.js", 10 | "demo2": "npx tsc & node dist/demo2.js", 11 | "doc": "npx typedoc --excludeExternals --excludeNotExported --excludePrivate src", 12 | "test": "echo \"Error: no test specified\" && exit 1" 13 | }, 14 | "keywords": [ 15 | "opcua", 16 | "node", 17 | "coreaas", 18 | "aas", 19 | "industry4.0" 20 | ], 21 | "author": "Marco Salafia", 22 | "license": "Apache-2.0", 23 | "repository": { 24 | "type": "git", 25 | "url": "https://github.com/OPCUAUniCT/node-opcua-coreaas" 26 | }, 27 | "devDependencies": { 28 | "typedoc": "^0.15.8", 29 | "typescript": "^3.9.7" 30 | }, 31 | "dependencies": { 32 | "node-opcua": "^2.21.0" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/CoreAAS_enums.ts: -------------------------------------------------------------------------------- 1 | export enum IdentifierType { IRDI, IRI, Custom }; 2 | 3 | export enum KeyElements { 4 | GlobalReference, 5 | FragmentReference, 6 | AccessPermissionRule, 7 | AnnotatedRelationshipElement, 8 | Blob, 9 | Capability, 10 | ConceptDictionary, 11 | DataElement, 12 | Entity, 13 | Event, 14 | File, 15 | MultiLanguageProperty, 16 | Operation, 17 | OperationVariable, 18 | Property, 19 | Range, 20 | ReferenceElement, 21 | RelationshipElement, 22 | SubmodelElement, 23 | SubmodelElementCollection, 24 | View, 25 | Asset, 26 | AssetAdministrationShell, 27 | ConceptDescription, 28 | Submodel 29 | } 30 | 31 | export enum KeyType { idShort, IRDI, IRI, Custom, FragmentId } 32 | 33 | export enum ModelingKind { Template, Instance } 34 | 35 | export enum AssetKind { Type, Instance } 36 | 37 | export enum PropertyCategory { CONSTANT, PARAMETER, VARIABLE } 38 | 39 | export enum PropertyValueType { 40 | AnyType, 41 | AllComplexTypes, 42 | AnySimpleType, 43 | AnyAtomicType, 44 | AnyURI, 45 | Base64Binary, 46 | Boolean, 47 | Date, 48 | DateTime, 49 | DateTimeStamp, 50 | Decimal, 51 | Integer, 52 | Long, 53 | Int, 54 | Short, 55 | Byte, 56 | NonNegativeInteger, 57 | PositiveInteger, 58 | UnsignedLong, 59 | UnsignedInt, 60 | UnsignedShort, 61 | UnsignedByte, 62 | NonPositiveInteger, 63 | NegativeInteger, 64 | Double, 65 | Duration, 66 | DayTimeDuration, 67 | YearMonthDuration, 68 | Float, 69 | GDay, 70 | GMonth, 71 | GMonthDay, 72 | GYear, 73 | GYearMonth, 74 | HexBinary, 75 | NOTATION, 76 | QName, 77 | String, 78 | NormalizedString, 79 | Token, 80 | Language, 81 | Name, 82 | NCName, 83 | ENTITY, 84 | ID, 85 | IDREF, 86 | NMTOKEN, 87 | Time, 88 | ENTITIES, 89 | IDREFS, 90 | NMTOKENS 91 | } 92 | 93 | export enum DataTypeIEC61360Type { 94 | DATE, 95 | STRING, 96 | STRING_TRANSLATABLE, 97 | INTEGER_MEASURE, 98 | INTEGER_COUNT, 99 | INTEGER_CURRENCY, 100 | REAL_MEASURE, 101 | REAL_COUNT, 102 | REAL_CURRENCY, 103 | BOOLEAN, 104 | URL, 105 | RATIONAL, 106 | RATIONAL_MEASURE, 107 | TIME, 108 | TIMESTAMP 109 | } 110 | 111 | export enum EntityTypeEnumType { 112 | CoManagedEntity, 113 | SelfManagedEntity 114 | } -------------------------------------------------------------------------------- /src/CoreServer.ts: -------------------------------------------------------------------------------- 1 | import { OPCUAServer, OPCUAServerOptions, AddressSpace, Variant, DataType } from "node-opcua"; 2 | import { CoreAASExtension } from "./CoreAASExtension"; 3 | import { IdentifierType } from "./CoreAAS_enums"; 4 | 5 | /** 6 | * CoreServer extends OPCUAServer with all the features coming from the CoreAAS Information 7 | * Model. Use this class instead of OPCUAServer of node-opcua to create your OPC UA Server supporting 8 | * the Asset Administration Shell metamodel implemented in CoreAAS. 9 | * example: 10 | * ```typescript 11 | * import { coreaasXmlFile, OPCUACertificateManager, nodesets, CoreServer } from "node-opcua-coreaas"; 12 | * let xmlFiles = [nodesets.standard, coreaasXmlFile] 13 | * let server = new CoreServer({ 14 | * nodeset_filename: xmlFiles, 15 | * port: 4848, 16 | * serverCertificateManager: new OPCUACertificateManager({ 17 | * automaticallyAcceptUnknownCertificate: true, 18 | * rootFolder: path.join(__dirname, "../certs") 19 | * }) 20 | * }) 21 | * ``` 22 | */ 23 | export class CoreServer extends OPCUAServer { 24 | 25 | private _addressSpace!: AddressSpace; 26 | 27 | /** The extension part of the CoreServer providing all the methods to create instances of 28 | * ObjectType coming from the CoreAAS information Model. Furthermore it provides access to 29 | * Structured DataType Constructors and several utility methods. More details in [[CoreAASExtension]]. 30 | */ 31 | public coreaas!: CoreAASExtension; 32 | 33 | /** 34 | * Use the same parameters of OPCUAServer. 35 | */ 36 | constructor(options?: OPCUAServerOptions) { 37 | super(options); 38 | } 39 | 40 | public initialize(): Promise; 41 | public initialize(done: () => void): void; 42 | public initialize(...args: [any?, ...any[]]): any { 43 | const done = args[0] as () => void; 44 | super.initialize(done); 45 | this.on("post_initialize", () => { 46 | this._addressSpace = this.engine.addressSpace!; 47 | this.coreaas = new CoreAASExtension(this._addressSpace); 48 | 49 | //Add Identifier for IEC 61360 Data Specification 50 | const Identifier = this.coreaas.Identifier; 51 | (this.coreaas.findCoreAASObjectType("DataSpecificationIEC61360Type")!).identification.setValueFromSource(new Variant({ 52 | dataType: DataType.ExtensionObject, 53 | value: new Identifier({ 54 | id: "www.adminshell.io/DataSpecificationTemplates/DataSpecificationIEC61360", 55 | idType: IdentifierType.IRI 56 | }) 57 | })); 58 | }) 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/builders/AASBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AddressSpace, DataType, Namespace, NodeIdLike, UAObject, UAObjectType, Variant } from "node-opcua"; 2 | import { BaseUAObject } from "node-opcua-factory"; 3 | import { get_description_creator, get_identification_creator } from "./builder_utilities"; 4 | import { CoreAASExtension } from "../CoreAASExtension"; 5 | import { CoreAASObjectsFolder, isIdentifier, RefArgument, AASObject, isKey, AssetObject, Identifier, SubmodelObject, ConceptDictionaryObject, ViewObject } from "../types"; 6 | import assert = require("assert"); 7 | import { Builder } from "./builder"; 8 | import { AASOptions } from "../options_types"; 9 | 10 | export class AASBuilder extends Builder { 11 | 12 | constructor(coreaas: CoreAASExtension) { 13 | super(coreaas); 14 | } 15 | 16 | addAssetAdministrationShell(options: AASOptions): AASObject { 17 | 18 | assert(isIdentifier(options.identification), "options.identification has not the internal structure of an Identifier"); 19 | 20 | const aasType: UAObjectType = this.coreaas.getAASType(); 21 | const aasFolder = ( this._addressSpace.rootFolder.objects).assetAdministrationShells; 22 | 23 | const aas: AASObject = this._namespace.addObject({ 24 | typeDefinition: aasType, 25 | browseName: options.browseName || "AAS_" + (options.identification).id, 26 | nodeId: options.nodeId, 27 | organizedBy: aasFolder, 28 | }) as AASObject; 29 | 30 | aas.referableChildrenMap = new Map(); 31 | this.coreaas.identifiableMap.set(options.identification.id, aas); 32 | 33 | const folderType = this._addressSpace.findObjectType("FolderType")!.nodeId; 34 | 35 | const submodels = this._namespace.addObject({ 36 | typeDefinition: folderType, 37 | browseName: "Submodels", 38 | componentOf: aas 39 | }); 40 | 41 | const conceptDictionaries = this._namespace.addObject({ 42 | typeDefinition: folderType, 43 | browseName: "ConceptDictionaries", 44 | componentOf: aas 45 | }); 46 | 47 | const views = this._namespace.addObject({ 48 | typeDefinition: folderType, 49 | browseName: "Views", 50 | componentOf: aas 51 | }); 52 | 53 | const identification = get_identification_creator(this.coreaas, aas)(options.identification); 54 | 55 | if (options.derivedFromRef != null) { 56 | this._create_addDerivedFromRef(aas)(options.derivedFromRef); 57 | } 58 | 59 | if (typeof options.assetRef !== "undefined") { 60 | this._create_addAssetRef(aas)(options.assetRef); 61 | } 62 | 63 | //Add description 64 | if (options.description != null) { 65 | const addDescriptionToAas = get_description_creator(this.coreaas, aas); 66 | addDescriptionToAas(options.description); 67 | } 68 | 69 | if (options.administration != null) { 70 | 71 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AdministrativeInformationType")!) , "options.administration is not an AdministrativeInformationType Object.") 72 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 73 | 74 | aas.addReference({ referenceType: "HasComponent", nodeId: options.administration}); 75 | } 76 | 77 | /* Add convenient method */ 78 | aas.hasAsset = (asset: AssetObject): AASObject => { 79 | assert(asset.typeDefinitionObj.isSupertypeOf(this.coreaas.getAssetType()), "asset is not an AssetType instance"); 80 | 81 | const hasAssetRefType = this.coreaas.findCoreAASReferenceType("HasAsset")!; 82 | aas.addReference({ referenceType: hasAssetRefType, nodeId: asset }); 83 | return aas; 84 | } 85 | 86 | aas.isDerivedFrom = (der_aas: AASObject): AASObject => { 87 | assert(der_aas.typeDefinitionObj.isSupertypeOf(this.coreaas.getAASType()), "asset is not an AssetType instance"); 88 | 89 | const isDerivedFromRefType = this.coreaas.findCoreAASReferenceType("IsDerivedFrom")!; 90 | aas.addReference({ referenceType: isDerivedFromRefType, nodeId: der_aas }); 91 | return aas; 92 | } 93 | 94 | aas.addConceptDictionary = (dict: ConceptDictionaryObject): AASObject => { 95 | assert(dict.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ConceptDictionaryType")!), "parameter is not an ConceptDictionaryType instance."); 96 | 97 | aas.conceptDictionaries.addReference({ referenceType: "Organizes", nodeId: dict }); 98 | aas.referableChildrenMap.set(dict.idShort._dataValue.value.value, dict); 99 | return aas; 100 | } 101 | 102 | aas.addSubmodelRef = (submodelRef: RefArgument):AASObject => { 103 | if (submodelRef instanceof Array) { 104 | 105 | submodelRef.forEach(el => assert(isKey(el), "submodelRef parameter contains an element that is not a Key.")); 106 | 107 | this.coreaas.addAASReference({ 108 | organizedBy: aas.submodels, 109 | browseName: (submodelRef[submodelRef.length - 1]).value + "_Ref", 110 | keys: submodelRef 111 | }); 112 | } 113 | else { 114 | assert(submodelRef.typeDefinitionObj.isSupertypeOf(this.coreaas.getAASReferenceType()), "submodelRef is not an AASReferenceType instance."); 115 | 116 | aas.submodels.addReference({ referenceType: "Organizes", nodeId: submodelRef}); 117 | } 118 | 119 | return aas; 120 | } 121 | 122 | aas.hasSubmodel = (submodel:SubmodelObject): AASObject => { 123 | 124 | assert(submodel.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("SubmodelType")!), "asset parameter is not an SubmodelType instance."); 125 | 126 | const hasSubmodelRefType = this.coreaas.findCoreAASReferenceType("HasSubmodel")!; 127 | aas.addReference({ referenceType: hasSubmodelRefType, nodeId: submodel }); 128 | return aas; 129 | } 130 | 131 | aas.addViews = (views: ViewObject[]): AASObject => { 132 | assert(views instanceof Array, "views parameter is not an Array."); 133 | views.forEach(view => { 134 | assert(view.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ViewType")!), "An element of the Array is not a ViewType instance.") 135 | aas.views.addReference({ referenceType: "Organizes", nodeId: view }); 136 | aas.referableChildrenMap.set(view.idShort._dataValue.value.value, view); 137 | }); 138 | 139 | return aas; 140 | } 141 | 142 | aas.addDerivedFromRef = this._create_addDerivedFromRef(aas); 143 | aas.addAssetRef = this._create_addAssetRef(aas); 144 | 145 | return aas; 146 | } 147 | 148 | private _create_addDerivedFromRef(aas: AASObject): (derivedFrom: RefArgument) => AASObject { 149 | const self = this; 150 | 151 | return function(derivedFrom: RefArgument): AASObject { 152 | assert(!aas.hasOwnProperty("derivedFrom"), "the AASType Object already contains a UA Property with Browsename derivedFrom"); 153 | 154 | if (derivedFrom instanceof Array) { 155 | 156 | derivedFrom.forEach(el => assert(isKey(el), "derivedFrom parameter contains an element that is not a Key.")); 157 | 158 | self.coreaas.addAASReference({ 159 | componentOf: aas, 160 | browseName: "derivedFrom", 161 | keys: derivedFrom 162 | }); 163 | } 164 | else { 165 | assert(derivedFrom.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 166 | 167 | aas.addReference({ referenceType: "HasComponent", nodeId: derivedFrom}); 168 | } 169 | 170 | return aas; 171 | } 172 | } 173 | 174 | private _create_addAssetRef(aas: AASObject): (assetRef: RefArgument) => AASObject{ 175 | const self = this; 176 | 177 | return function(assetRef: RefArgument): AASObject { 178 | assert(!aas.hasOwnProperty("asset"), "the AASType Object already contains a UA Property with Browsename asset"); 179 | 180 | if (assetRef instanceof Array) { 181 | 182 | assetRef.forEach(el => assert(isKey(el), "assetRef parameter contains an element that is not a Key.")); 183 | 184 | self.coreaas.addAASReference({ 185 | componentOf: aas, 186 | browseName: "asset", 187 | keys: assetRef 188 | }); 189 | } 190 | else { 191 | assert(assetRef.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 192 | assert(assetRef.browseName.name === "asset", "the browsename of assetRef is not asset"); 193 | 194 | aas.addReference({ referenceType: "HasComponent", nodeId: assetRef}); 195 | } 196 | 197 | return aas; 198 | } 199 | } 200 | } -------------------------------------------------------------------------------- /src/builders/AASReferenceBuilder.ts: -------------------------------------------------------------------------------- 1 | import { CoreAASExtension } from "../CoreAASExtension"; 2 | import assert = require("assert"); 3 | import { isKey, AASReferenceObject } from "../types"; 4 | import { Builder } from "./builder"; 5 | import { AASReferenceOptions } from "../options_types"; 6 | import { Variant, DataType, VariantArrayType } from "node-opcua"; 7 | 8 | export class AASReferenceBuilder extends Builder { 9 | 10 | constructor(coreaas: CoreAASExtension) { 11 | super(coreaas); 12 | } 13 | 14 | addAASReference(options: AASReferenceOptions): AASReferenceObject { 15 | 16 | options.keys.forEach(el => assert(isKey(el), "options.keys contains an element has not the internal structure of a Key")); 17 | 18 | const aasReferenceType = this.coreaas.getAASReferenceType(); 19 | 20 | const aasReference: AASReferenceObject = this._namespace.addObject({ 21 | typeDefinition: aasReferenceType, 22 | browseName: options.browseName, 23 | description: options.description, 24 | nodeId: options.nodeId, 25 | componentOf: options.componentOf 26 | }) as AASReferenceObject; 27 | 28 | const key = this._namespace.addVariable({ 29 | propertyOf: aasReference, 30 | browseName: "keys", 31 | dataType: this.coreaas.findCoreAASDataType("Key")!, 32 | value: { 33 | get: function() { 34 | return new Variant({ 35 | dataType: DataType.ExtensionObject, 36 | arrayType: VariantArrayType.Array, 37 | value: options.keys 38 | }); 39 | } 40 | }, 41 | valueRank: 1 42 | }); 43 | 44 | if (options.organizedBy != null) { 45 | const organizingParent = options.organizedBy; 46 | 47 | organizingParent.addReference({ 48 | referenceType: "Organizes", 49 | nodeId: aasReference 50 | }); 51 | } 52 | 53 | if (options.isCaseOf != null) { 54 | const parent = options.isCaseOf; 55 | const isCaseOfRefType = this.coreaas.findCoreAASReferenceType("IsCaseOf")!; 56 | 57 | parent.addReference({ 58 | referenceType: isCaseOfRefType, 59 | nodeId: aasReference 60 | }); 61 | } 62 | 63 | return aasReference; 64 | } 65 | } -------------------------------------------------------------------------------- /src/builders/AdministrativeInformationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { Variant, DataType } from "node-opcua"; 2 | 3 | import { CoreAASExtension } from "../CoreAASExtension"; 4 | import { Builder } from "./builder"; 5 | import { AdministrativeInformationObject } from "../types"; 6 | import { AdministrativeInformationOptions } from "../options_types"; 7 | 8 | export class AdministrativeInformationBuilder extends Builder { 9 | 10 | constructor(coreaas: CoreAASExtension) { 11 | super(coreaas); 12 | } 13 | 14 | addAdministrativeInformation(options: AdministrativeInformationOptions): AdministrativeInformationObject { 15 | const adminType = this.coreaas.getAdministrativeInformationType(); 16 | 17 | const admin = this._namespace.addObject({ 18 | browseName: options.browseName || "administration", 19 | componentOf: options.componentOf, 20 | typeDefinition: adminType, 21 | description: options.description, 22 | nodeId: options.nodeId 23 | }) as AdministrativeInformationObject; 24 | 25 | if (options.version != null) { 26 | 27 | this._namespace.addVariable({ 28 | browseName: "version", 29 | propertyOf: admin, 30 | dataType: "String", 31 | value: { 32 | get: () => { 33 | return new Variant({ 34 | dataType: DataType.String, 35 | value: options.version 36 | }); 37 | } 38 | } 39 | }); 40 | } 41 | 42 | if (options.revision != null) { 43 | 44 | this._namespace.addVariable({ 45 | browseName: "revision", 46 | propertyOf: admin, 47 | dataType: "String", 48 | value: { 49 | get: () => { 50 | return new Variant({ 51 | dataType: DataType.String, 52 | value: options.revision 53 | }); 54 | } 55 | } 56 | }); 57 | } 58 | 59 | return admin; 60 | } 61 | } -------------------------------------------------------------------------------- /src/builders/AssetBuilder.ts: -------------------------------------------------------------------------------- 1 | import { UAObject } from "node-opcua"; 2 | import { BaseUAObject } from "node-opcua-factory"; 3 | import { get_description_creator, get_idShort_creator, get_identification_creator, get_assetkind_creator } from "./builder_utilities"; 4 | import { CoreAASExtension } from "../CoreAASExtension"; 5 | import { AssetObject, CoreAASObjectsFolder, isKey, Identifier, isIdentifier, Key } from "../types"; 6 | import assert = require("assert"); 7 | import { Builder } from "./builder"; 8 | import { AssetOptions } from "../options_types"; 9 | 10 | export class AssetBuilder extends Builder { 11 | 12 | constructor(coreaas: CoreAASExtension) { 13 | super(coreaas); 14 | } 15 | 16 | addAsset(options: AssetOptions): AssetObject { 17 | 18 | assert(options.identification != null, "No options.identification parameter inserted!"); 19 | assert(isIdentifier(options.identification), "options.identification is not an Identifier."); 20 | 21 | const assetType = this.coreaas.getAssetType(); 22 | const assetsFolder = ( this._addressSpace.rootFolder.objects).assets; 23 | 24 | const asset: AssetObject = this._namespace.addObject({ 25 | typeDefinition: assetType, 26 | browseName: options.browseName || "Asset_" + options.identification.id, 27 | nodeId: options.nodeId, 28 | organizedBy: assetsFolder, 29 | }) as AssetObject; 30 | 31 | asset.referableChildrenMap = new Map(); 32 | this.coreaas.identifiableMap.set((options.identification).id, asset); 33 | 34 | //Add identification 35 | const identification = get_identification_creator(this.coreaas, asset)(options.identification); 36 | 37 | //Add idShort 38 | const idShort = get_idShort_creator(this.coreaas, asset)(options.idShort); 39 | 40 | //Add description 41 | if (options.description != null) { 42 | const addDescriptionToAsset = get_description_creator(this.coreaas, asset); 43 | addDescriptionToAsset(options.description); 44 | } 45 | 46 | if (options.administration != null) { 47 | 48 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.getAdministrativeInformationType()) , "options.administration is not an AdministrativeInformationType Object.") 49 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 50 | 51 | asset.addReference({ referenceType: "HasComponent", nodeId: options.administration}); 52 | } 53 | 54 | //Add assetIdentificationModel 55 | if (typeof options.assetIdentificationModelRef !== "undefined") { 56 | this._create_addAssetIdentificationModel(asset)(options.assetIdentificationModelRef); 57 | } 58 | 59 | //Add billOfMaterial 60 | if (typeof options.billOfMaterialRef !== "undefined") { 61 | this._create_addBillOfMaterial(asset)(options.billOfMaterialRef); 62 | } 63 | 64 | //Add this Asset to the AAS 65 | if (options.assetOf != null) { 66 | 67 | const parent = options.assetOf; 68 | const hasAssetRefType = this.coreaas.findCoreAASReferenceType("HasAsset")!; 69 | parent.addReference({ referenceType: hasAssetRefType, nodeId: asset }); 70 | } 71 | 72 | //Add kind 73 | if (options.kind != null) { 74 | get_assetkind_creator(this.coreaas, asset)(options.kind); 75 | } 76 | 77 | asset.addAssetIdentificationModelRef = this._create_addAssetIdentificationModel(asset); 78 | asset.addBillOfMaterialRef = this._create_addBillOfMaterial(asset); 79 | 80 | return asset; 81 | } 82 | 83 | private _create_addAssetIdentificationModel(asset: AssetObject): (model: UAObject | Key[]) => AssetObject { 84 | const self = this; 85 | 86 | return function (model: UAObject | Key[]): AssetObject { 87 | assert(!asset.hasOwnProperty("assetIdentificationModel"), "the AssetType Object already contains a UA Property with Browsename assetIdentificationModel"); 88 | 89 | if (model instanceof Array) { 90 | model.forEach(el => assert(isKey(el), "model parameter contains an element that is not a Key.")); 91 | self.coreaas.addAASReference({ 92 | componentOf: asset, 93 | browseName: "assetIdentificationModel", 94 | keys: model 95 | }); 96 | } else { 97 | assert(model.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 98 | assert(model.browseName.name === "assetIdentificationModel", "model BrowseName is not 'assetIdentificationModel'"); 99 | 100 | asset.addReference({ referenceType: "HasComponent", nodeId: model }); 101 | } 102 | 103 | return asset; 104 | } 105 | } 106 | 107 | private _create_addBillOfMaterial(asset: AssetObject): (model: UAObject | Key[]) => AssetObject { 108 | const self = this; 109 | 110 | return function (model: UAObject | Key[]): AssetObject { 111 | assert(!asset.hasOwnProperty("billOfMaterial"), "the AssetType Object already contains a UA Property with Browsename billOfMaterial"); 112 | 113 | if (model instanceof Array) { 114 | model.forEach(el => assert(isKey(el), "model parameter contains an element that is not a Key.")); 115 | self.coreaas.addAASReference({ 116 | componentOf: asset, 117 | browseName: "billOfMaterial", 118 | keys: model 119 | }); 120 | } else { 121 | assert(model.typeDefinitionObj.isSupertypeOf(self.coreaas.getAASReferenceType()), "model is not an AASReferenceType Object"); 122 | assert(model.browseName.name === "billOfMaterial", "model BrowseName is not 'billOfMaterial'"); 123 | 124 | asset.addReference({ referenceType: "HasComponent", nodeId: model }); 125 | } 126 | 127 | return asset; 128 | } 129 | } 130 | 131 | } -------------------------------------------------------------------------------- /src/builders/ConceptDescriptionBuilder.ts: -------------------------------------------------------------------------------- 1 | import { Builder } from "./builder"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | import { Variant, DataType } from "node-opcua"; 4 | import { UAObject } from "node-opcua-address-space/dist/src/ua_object"; 5 | import { EDSObject, isIdentifier, CoreAASObjectsFolder, Identifier, ConceptDescriptionObject, RefArgument, isKey, Key, AASReferenceObject, ConceptDictionaryObject } from "../types"; 6 | import assert = require("assert"); 7 | import { get_description_creator } from "./builder_utilities"; 8 | import { ConceptDescriptionOptions } from "../options_types"; 9 | 10 | export class ConceptDescriptionBuilder extends Builder { 11 | 12 | constructor(coreaas: CoreAASExtension) { 13 | super(coreaas); 14 | } 15 | 16 | addConceptDescription(options: ConceptDescriptionOptions): ConceptDescriptionObject { 17 | assert(options.identification != null, "No options.identification parameter inserted!"); 18 | assert(isIdentifier(options.identification), "options.identification is not an Identifier."); 19 | 20 | const conceptDescriptionType = this.coreaas.findCoreAASObjectType("ConceptDescriptionType")!; 21 | const conceptDescriptions = (this._addressSpace.rootFolder.objects).conceptDescriptions; 22 | 23 | const conceptDescription: ConceptDescriptionObject = this._namespace.addObject({ 24 | typeDefinition: conceptDescriptionType, 25 | browseName: options.browseName || "ConceptDescription_" + (options.identification).id, 26 | nodeId: options.nodeId, 27 | organizedBy: conceptDescriptions, 28 | }) as ConceptDescriptionObject; 29 | 30 | this.coreaas.identifiableMap.set((options.identification).id, conceptDescription); 31 | 32 | //Add identification 33 | this._namespace.addVariable({ 34 | propertyOf: conceptDescription, 35 | browseName: "identification", 36 | dataType: this.coreaas.findCoreAASDataType("Identifier")!, 37 | value: { 38 | get: function() { 39 | return new Variant({ 40 | dataType: DataType.ExtensionObject, 41 | value: options.identification 42 | }); 43 | } 44 | } 45 | }); 46 | 47 | //Add description 48 | if (options.description != null) { 49 | const addDescriptionToConceptDescription = get_description_creator(this.coreaas, conceptDescription); 50 | addDescriptionToConceptDescription(options.description); 51 | } 52 | 53 | //Add Administration 54 | if (options.administration != null) { 55 | 56 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.getAdministrativeInformationType()) , "options.administration is not an AdministrativeInformationType Object.") 57 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 58 | 59 | conceptDescription.addReference({ referenceType: "HasComponent", nodeId: options.administration}); 60 | } 61 | 62 | //Add this Asset to the AAS 63 | if (options.conceptDescriptionOf != null) { 64 | assert(options.conceptDescriptionOf instanceof UAObject, "options.conceptDescriptionOf is not an UAObject."); 65 | 66 | const hasConceptDescriptionRefType = this.coreaas.findCoreAASReferenceType("HasConceptDescription")!; 67 | 68 | options.conceptDescriptionOf.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescription }); 69 | } 70 | 71 | //Add EmbeddedDataSpecification 72 | if (options.hasEmbeddedDataSpecifications != null) { 73 | this._create_hasEmbeddedDataSpecifications(conceptDescription)(options.hasEmbeddedDataSpecifications); 74 | } 75 | 76 | conceptDescription.semanticOf = (elem: UAObject): ConceptDescriptionObject => { 77 | assert(elem instanceof UAObject, "elem is not a UAObject."); 78 | 79 | const hasSemanticRefType = this.coreaas.findCoreAASReferenceType("HasSemantic")!; 80 | elem.addReference({ referenceType: hasSemanticRefType, nodeId: conceptDescription }); 81 | 82 | return conceptDescription; 83 | } 84 | 85 | conceptDescription.isCaseOf = (ref:RefArgument): ConceptDescriptionObject => { 86 | 87 | assert(ref instanceof Array || ref instanceof UAObject, "ref is neither a UAObject or an Array of Key.") 88 | 89 | if (ref instanceof Array) { 90 | 91 | ref.forEach(el => assert(isKey(el), "ref Array contains an element that is not a Key.")); 92 | 93 | this.coreaas.addAASReference({ 94 | isCaseOf: conceptDescription, 95 | browseName: "Case_" + (ref[ref.length -1]).value, 96 | keys: ref 97 | }); 98 | } 99 | else { 100 | assert((ref).keys != null, "assetRef is not an AASReferenceType instance."); 101 | 102 | conceptDescription.addReference({ referenceType: "HasComponent", nodeId: ref}); 103 | } 104 | 105 | return conceptDescription; 106 | }; 107 | 108 | conceptDescription.hasEmbeddedDataSpecifications = this._create_hasEmbeddedDataSpecifications(conceptDescription); 109 | 110 | conceptDescription.conceptDescriptionOf = this.create_conceptDescriptionOf(conceptDescription); 111 | 112 | return conceptDescription; 113 | }; 114 | 115 | private _create_hasEmbeddedDataSpecifications(conceptDes: ConceptDescriptionObject): (eds: EDSObject | EDSObject[]) => ConceptDescriptionObject { 116 | const coreaas = this.coreaas; 117 | return function (eds: EDSObject | EDSObject[]): ConceptDescriptionObject { 118 | let embedds: EDSObject[] = []; 119 | embedds = embedds.concat(embedds, eds) 120 | embedds.forEach((e) => { 121 | assert(e instanceof UAObject, "eds contains some element that is not UAObject."); 122 | }); 123 | const hasEmbeddedDataSpecificationRefType = coreaas.findCoreAASReferenceType("HasEmbeddedDataSpecification")!; 124 | 125 | embedds.forEach((e) => conceptDes.addReference({ referenceType: hasEmbeddedDataSpecificationRefType, nodeId: e })); 126 | return conceptDes; 127 | } 128 | } 129 | 130 | private create_conceptDescriptionOf(conceptDescription: ConceptDescriptionObject): (dict: ConceptDictionaryObject) => ConceptDescriptionObject { 131 | const coreaas = this.coreaas; 132 | return function(dict: ConceptDictionaryObject): ConceptDescriptionObject { 133 | assert(dict instanceof UAObject, "dict is not an UAObject."); 134 | 135 | const hasConceptDescriptionRefType = coreaas.findCoreAASReferenceType("HasConceptDescription")!; 136 | 137 | dict.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescription }); 138 | return conceptDescription; 139 | } 140 | } 141 | } -------------------------------------------------------------------------------- /src/builders/ConceptDictionaryBuilder.ts: -------------------------------------------------------------------------------- 1 | import { Builder } from "./builder"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | import { ConceptDictionaryObject, RefArgument, isKey, ConceptDescriptionObject, Key } from "../types"; 4 | import { Variant, DataType } from "node-opcua"; 5 | import assert = require("assert"); 6 | import { get_parent_creator, get_description_creator } from "./builder_utilities"; 7 | import { ConceptDictionaryOptions } from "../options_types"; 8 | 9 | export class ConceptDictionaryBuilder extends Builder { 10 | 11 | constructor(coreaas: CoreAASExtension) { 12 | super(coreaas); 13 | } 14 | 15 | addConceptDictionary(options: ConceptDictionaryOptions): ConceptDictionaryObject { 16 | assert(options.idShort != null, "No options.idShort parameter inserted!"); 17 | 18 | const conceptDictionaryType = this.coreaas.findCoreAASObjectType("ConceptDictionaryType")!; 19 | 20 | const conceptDictionary = this._namespace.addObject({ 21 | typeDefinition: conceptDictionaryType, 22 | browseName: options.browseName || options.idShort + "_Dictionary", 23 | nodeId: options.nodeId 24 | }) as ConceptDictionaryObject; 25 | 26 | const folderType = this._addressSpace.findNode("FolderType")!.nodeId; 27 | 28 | //Add conceptDescriptions 29 | const conceptDescriptions = this._namespace.addObject({ 30 | typeDefinition: folderType, 31 | browseName: "ConceptDescriptions", 32 | componentOf: conceptDictionary 33 | }); 34 | 35 | let idShort = this._namespace.addVariable({ 36 | propertyOf: conceptDictionary, 37 | browseName: "idShort", 38 | dataType: "String", 39 | value: { 40 | get: function() { 41 | return new Variant({ 42 | dataType: DataType.String, 43 | value: options.idShort 44 | }); 45 | } 46 | } 47 | }); 48 | 49 | //Add this ConceptDictionary to an AAS 50 | if (options.conceptDictionaryOf != null) { 51 | 52 | const conceptDictionaries = options.conceptDictionaryOf.conceptDictionaries; 53 | conceptDictionaries.addReference({ referenceType: "Organizes", nodeId: conceptDictionary }); 54 | options.conceptDictionaryOf.referableChildrenMap.set(conceptDictionary.idShort._dataValue.value.value, conceptDictionary); 55 | } 56 | 57 | //Add Parent 58 | if (options.parent != null) { 59 | get_parent_creator(this.coreaas, conceptDictionary)(options.parent); 60 | } 61 | 62 | //Add description 63 | if (options.description != null) { 64 | const addDescriptionToProperty = get_description_creator(this.coreaas, conceptDictionary); 65 | addDescriptionToProperty(options.description); 66 | } 67 | 68 | conceptDictionary.hasConceptDescriptions = (conceptDescriptions: ConceptDescriptionObject | ConceptDescriptionObject[]): ConceptDictionaryObject => { 69 | 70 | const hasConceptDescriptionRefType = this.coreaas.findCoreAASReferenceType("HasConceptDescription")!; 71 | 72 | if(conceptDescriptions instanceof Array) { 73 | conceptDescriptions.forEach(conceptDescription => { 74 | assert(conceptDescription.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ConceptDescriptionType")!), "An element of the Array is not a ConceptDescriptionType instance.") 75 | conceptDictionary.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescription}); 76 | }); 77 | } 78 | else { 79 | assert(conceptDescriptions.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("ConceptDescriptionType")!), "conceptDescriptions is not a ConceptDescriptionType instance.") 80 | conceptDictionary.addReference({ referenceType: hasConceptDescriptionRefType, nodeId: conceptDescriptions}); 81 | } 82 | 83 | return conceptDictionary; 84 | } 85 | 86 | conceptDictionary.addParent = get_parent_creator(this.coreaas, conceptDictionary); 87 | 88 | conceptDictionary.addConceptDescriptionRef = (conceptDescriptionRef: RefArgument) => { 89 | 90 | if (conceptDescriptionRef instanceof Array) { 91 | 92 | conceptDescriptionRef.forEach(el => assert(isKey(el), "Array parameter contains an element that is not a Key.")); 93 | 94 | this.coreaas.addAASReference({ 95 | organizedBy: conceptDictionary.conceptDescriptions, 96 | browseName: (conceptDescriptionRef[conceptDescriptionRef.length - 1]).value + "_Ref", 97 | keys: conceptDescriptionRef 98 | }); 99 | 100 | } 101 | else { 102 | assert(conceptDescriptionRef.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASReferenceType")!), "conceptDescriptionRef is not an AASReferenceType instance."); 103 | 104 | conceptDictionary.conceptDescriptions.addReference({ referenceType: "Organizes", nodeId: conceptDescriptionRef}); 105 | } 106 | 107 | return conceptDictionary; 108 | } 109 | 110 | return conceptDictionary; 111 | } 112 | } -------------------------------------------------------------------------------- /src/builders/DataSpecificationIEC61360Builder.ts: -------------------------------------------------------------------------------- 1 | import { UAObject, Variant, DataType } from "node-opcua"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | import { isKey, DataSpecificationIEC61360 } from "../types"; 4 | import assert = require("assert"); 5 | import { Builder } from "./builder"; 6 | import { DataSpecificationIECOptions } from "../options_types"; 7 | 8 | export class DataSpecificationIEC61360Builder extends Builder { 9 | 10 | constructor(coreaas: CoreAASExtension) { 11 | super(coreaas); 12 | } 13 | 14 | addDataSpecificationIEC61360(options: DataSpecificationIECOptions): DataSpecificationIEC61360 { 15 | const iecType = this.coreaas.findCoreAASObjectType("DataSpecificationIEC61360Type")!; 16 | 17 | const dataSpec: DataSpecificationIEC61360 = this._namespace.addObject({ 18 | typeDefinition: iecType, 19 | browseName: options.browseName || "dataSpecificationContent", 20 | description: options.description, 21 | nodeId: options.nodeId 22 | }) as DataSpecificationIEC61360; 23 | 24 | if (options.identifier != null) this._addUAProperty_for_string(dataSpec, "identifier", options.identifier); 25 | if (options.preferredName != null) this._addUAProperty_for_string(dataSpec, "preferredName", options.preferredName); 26 | if (options.definition != null) this._addUAProperty_for_string(dataSpec, "definition", options.definition); 27 | if (options.dataType != null) { 28 | assert(!dataSpec.hasOwnProperty("dataType"), "dataSpec already contains a UA Proeprty with the browseName dataType"); 29 | 30 | this._namespace.addVariable({ 31 | browseName: "dataType", 32 | propertyOf: dataSpec, 33 | dataType: this.coreaas.findCoreAASDataType("DataTypeIEC61360Type")!, 34 | value: { 35 | get: () => { 36 | return new Variant({ 37 | dataType: DataType.Int32, 38 | value: options.dataType 39 | }); 40 | } 41 | } 42 | }); 43 | } 44 | if (options.unit != null) this._addUAProperty_for_string(dataSpec, "unit", options.unit); 45 | if (options.unitId != null) { 46 | assert(!dataSpec.hasOwnProperty("unitId"), "the DataSpecificationIEC61360Type Object already contains a UA Property with Browsename unitId"); 47 | 48 | if (options.unitId instanceof Array) { 49 | 50 | options.unitId.forEach(el => assert(isKey(el), "options.unitId Array contains an element that is not a Key.")); 51 | 52 | this.coreaas.addAASReference({ 53 | componentOf: dataSpec, 54 | browseName: "unitId", 55 | keys: options.unitId 56 | }); 57 | } 58 | else { 59 | assert(options.unitId.typeDefinitionObj.isSupertypeOf(this.coreaas.getAASReferenceType()), "options.unitId is not an AASReferenceType instance."); 60 | dataSpec.addReference({ referenceType: "HasComponent", nodeId: options.unitId}); 61 | } 62 | } 63 | if (options.iecCategory != null) this._addUAProperty_for_string(dataSpec, "iecCategory", options.iecCategory); 64 | if (options.iecLanguageCode != null) this._addUAProperty_for_string(dataSpec, "iecLanguageCode", options.iecLanguageCode); 65 | if (options.note != null) this._addUAProperty_for_string(dataSpec, "note", options.note); 66 | if (options.shortName != null) this._addUAProperty_for_string(dataSpec, "shortName", options.shortName); 67 | if (options.valueFormat != null) this._addUAProperty_for_string(dataSpec, "valueFormat", options.valueFormat); 68 | if (options.version != null) this._addUAProperty_for_string(dataSpec, "version", options.version); 69 | if (options.revision != null) this._addUAProperty_for_string(dataSpec, "revision", options.revision); 70 | 71 | return dataSpec; 72 | } 73 | 74 | private _addUAProperty_for_string(dataSpec: UAObject, browseName: string, value: string): void { 75 | assert(!dataSpec.hasOwnProperty(browseName), "dataSpec already contains a UA Proeprty with the browseName " + browseName); 76 | 77 | this._namespace.addVariable({ 78 | browseName: browseName, 79 | propertyOf: dataSpec, 80 | dataType: "String", 81 | value: { 82 | get: () => { 83 | return new Variant({ 84 | dataType: DataType.String, 85 | value: value 86 | }); 87 | } 88 | } 89 | }); 90 | } 91 | } -------------------------------------------------------------------------------- /src/builders/EmbeddedDataSpecificationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AddressSpace, Namespace, NodeIdLike } from "node-opcua"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | import { BaseUAObject } from "node-opcua-factory"; 4 | import { UAObject } from "node-opcua-address-space/dist/src/ua_object"; 5 | import assert = require("assert"); 6 | import { isKey, EDSObject, DataSpecificationIEC61360 } from "../types"; 7 | import { Builder } from "./builder"; 8 | import { DataSpecificationIECOptions, EmbeddedDataSpecificationOptions } from "../options_types"; 9 | 10 | export class EmbeddedDataSpecificationBuilder extends Builder { 11 | 12 | constructor(coreaas: CoreAASExtension) { 13 | super(coreaas); 14 | } 15 | 16 | addEmbeddedDataSpecification(options: EmbeddedDataSpecificationOptions): EDSObject { 17 | options.hasDataSpecification.forEach(el => assert(isKey(el), "assetRef parameter contains an element that is not a Key.")); 18 | 19 | const edsType = this.coreaas.findCoreAASObjectType("EmbeddedDataSpecificationType")!; 20 | const eds: EDSObject = this._namespace.addObject({ 21 | typeDefinition: edsType, 22 | browseName: options.browseName, 23 | description: options.description, 24 | nodeId: options.nodeId 25 | }) as EDSObject; 26 | 27 | this.coreaas.addAASReference({ 28 | componentOf: eds, 29 | browseName: "hasDataSpecification", 30 | keys: options.hasDataSpecification 31 | }); 32 | 33 | if (options.dataSpecificationContent != null) { eds.addReference({ referenceType: "HasComponent", nodeId: options.dataSpecificationContent }); } 34 | 35 | if(options.embeddedDataSpecificationOf != null) 36 | { 37 | const parent = options.embeddedDataSpecificationOf; 38 | const hasEmbeddedDataSpecificationType = this.coreaas.findCoreAASReferenceType("HasEmbeddedDataSpecification")!; 39 | 40 | parent.addReference({ referenceType: hasEmbeddedDataSpecificationType, nodeId: eds }); 41 | } 42 | 43 | eds.addDataSpecificationIEC61360 = (options: DataSpecificationIEC61360 | DataSpecificationIECOptions) => { 44 | assert(!eds.hasOwnProperty("dataSpecificationContent"), "the EmbeddedDataSpecificationType Object already contains a Component with Browsename dataSpecificationContent"); 45 | 46 | if (options instanceof UAObject) { 47 | assert(options.browseName.name === "dataSpecificationContent", "options parameter browsename is not 'dataSpecificationContent'."); 48 | eds.addReference({ referenceType: "HasComponent", nodeId: options }); 49 | } else { 50 | const dataSpec = this.coreaas.addDataSpecificationIEC61360(options); 51 | eds.addReference({ referenceType: "HasComponent", nodeId: dataSpec }); 52 | } 53 | return eds; 54 | } 55 | 56 | return eds; 57 | } 58 | } -------------------------------------------------------------------------------- /src/builders/SubmodelBuilder.ts: -------------------------------------------------------------------------------- 1 | import { CoreAASExtension } from "../CoreAASExtension"; 2 | import { Builder } from "./builder"; 3 | import { SubmodelObject, CoreAASObjectsFolder, Identifier, isIdentifier, AASObject, SubmodelElementObject } from "../types"; 4 | import { UAObject } from "node-opcua"; 5 | import { ModelingKind } from "../CoreAAS_enums"; 6 | import assert = require("assert"); 7 | import { get_description_creator, get_modelingkind_creator, get_semanticId_creator, get_parent_creator, get_identification_creator, get_idShort_creator } from "./builder_utilities"; 8 | import { SubmodelOptions } from "../options_types"; 9 | 10 | export class SubmodelBuilder extends Builder { 11 | 12 | constructor(coreaas: CoreAASExtension) { 13 | super(coreaas); 14 | } 15 | 16 | addSubmodel(options: SubmodelOptions): SubmodelObject { 17 | assert(options.identification != null, "No options.identification parameter inserted!"); 18 | assert(options.idShort != null, "No options.idShort parameter inserted!"); 19 | assert(isIdentifier(options.identification), "options.identification is not an Identifier."); 20 | 21 | const submodelType = this.coreaas.findCoreAASObjectType("SubmodelType")!; 22 | const submodelsFolder = (this._addressSpace.rootFolder.objects).submodels; 23 | 24 | const submodel = this._namespace.addObject({ 25 | typeDefinition: submodelType, 26 | browseName: options.browseName || "Submodel_" + (options.identification).id, 27 | nodeId: options.nodeId, 28 | organizedBy: submodelsFolder, 29 | }) as SubmodelObject; 30 | 31 | submodel.referableChildrenMap = new Map(); 32 | this.coreaas.identifiableMap.set((options.identification).id, submodel); 33 | 34 | //Add identification 35 | const identification = get_identification_creator(this.coreaas, submodel)(options.identification); 36 | 37 | //Add idShort 38 | const idShort = get_idShort_creator(this.coreaas, submodel)(options.idShort); 39 | 40 | //Add Submodels 41 | this._namespace.addObject({ 42 | typeDefinition: this._addressSpace.findNode("FolderType")!.nodeId, 43 | browseName: "SubmodelElements", 44 | componentOf: submodel 45 | }); 46 | 47 | //Add description 48 | if (options.description != null) { 49 | const addDescriptionToAas = get_description_creator(this.coreaas, submodel); 50 | addDescriptionToAas(options.description); 51 | } 52 | 53 | if (options.administration != null) { 54 | 55 | assert(options.administration.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AdministrativeInformationType")!) , "options.administration is not an AdministrativeInformationType Object.") 56 | assert(options.administration.browseName.name === "administration", "options.administration browseName is not 'administration'"); 57 | 58 | submodel.addReference({ referenceType: "HasComponent", nodeId: options.administration}); 59 | } 60 | 61 | //Add kind 62 | if (options.kind != null) { 63 | get_modelingkind_creator(this.coreaas, submodel)(options.kind); 64 | } 65 | 66 | if (options.semanticId != null) { 67 | get_semanticId_creator(this.coreaas, submodel)(options.semanticId); 68 | } 69 | 70 | if (options.parent != null) { 71 | get_parent_creator(this.coreaas, submodel)(options.parent); 72 | } 73 | 74 | /* Convenience methods */ 75 | submodel.hasSubmodelSemantic = (semanticElem: SubmodelObject): SubmodelObject => { 76 | assert(semanticElem.hasOwnProperty("kind"), "semanticElem is not a SubmodelType instance."); 77 | assert((semanticElem).kind.readValue().value.value === ModelingKind.Template, "semanticElem is not a Submodel with kind = Template"); 78 | 79 | const hasSubmodelSemanticRefType = this.coreaas.findCoreAASReferenceType("HasSubmodelSemantic")!; 80 | submodel.addReference({ referenceType: hasSubmodelSemanticRefType, nodeId: semanticElem }); 81 | 82 | return submodel; 83 | } 84 | 85 | submodel.hasSemantic = (semanticElem: UAObject): SubmodelObject => { 86 | 87 | const hasSubmodelSemanticRefType = this.coreaas.findCoreAASReferenceType("HasSemantic")!; 88 | submodel.addReference({ referenceType: hasSubmodelSemanticRefType, nodeId: semanticElem }); 89 | 90 | return submodel; 91 | } 92 | 93 | submodel.addSemanticId = get_semanticId_creator(this.coreaas, submodel); 94 | 95 | submodel.submodelOf = (aas: AASObject) => { 96 | assert(aas.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASType")!), "aas parameter is not an AASType instance."); 97 | 98 | const hasSubmodelRef = this.coreaas.findCoreAASReferenceType("HasSubmodel")!; 99 | aas.addReference({ referenceType: hasSubmodelRef, nodeId: submodel }); 100 | return submodel; 101 | } 102 | 103 | submodel.addParent = get_parent_creator(this.coreaas, submodel); 104 | 105 | submodel.addElements = (elemArray:SubmodelElementObject[]): SubmodelObject => { 106 | assert(elemArray instanceof Array, "elemArray parameter is not an Array."); 107 | 108 | elemArray.forEach(el => { 109 | 110 | const submodelElementType = this.coreaas.findCoreAASObjectType("SubmodelElementType")!; 111 | assert(el.typeDefinitionObj.isSupertypeOf(submodelElementType), "elemArray contains an element that is not a subtype instance of SubmodelElementType."); //isSupertypeOf is confusional. It should be isSubtypeOf 112 | 113 | const submodelElements = submodel.submodelElements; 114 | submodelElements.addReference({ referenceType: "Organizes", nodeId: el }); 115 | submodel.referableChildrenMap.set(el.idShort._dataValue.value.value, el); 116 | }); 117 | 118 | return submodel; 119 | } 120 | 121 | return submodel; 122 | } 123 | } -------------------------------------------------------------------------------- /src/builders/SubmodelPropertyBuilder.ts: -------------------------------------------------------------------------------- 1 | import { UAObject, Variant, DataType } from "node-opcua"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | import { Builder } from "./builder"; 4 | import { RefArgument, SubmodelPropertyObject, isKey, SubmodelObject } from "../types"; 5 | import assert = require("assert"); 6 | import { get_description_creator, get_modelingkind_creator, get_category_creator, get_semanticId_creator, get_parent_creator } from "./builder_utilities"; 7 | import { SubmodelPropertyOptions } from "../options_types"; 8 | 9 | export class SubmodelPropertyBuilder extends Builder { 10 | 11 | constructor(coreaas: CoreAASExtension) { 12 | super(coreaas); 13 | } 14 | 15 | addSubmodelProperty(options: SubmodelPropertyOptions): SubmodelPropertyObject { 16 | const submodelPropertyType = this.coreaas.findCoreAASObjectType("SubmodelPropertyType")!; 17 | 18 | const property: SubmodelPropertyObject = this._namespace.addObject({ 19 | typeDefinition: submodelPropertyType, 20 | browseName: options.browseName || "Property_" + options.idShort, 21 | nodeId: options.nodeId 22 | }) as SubmodelPropertyObject; 23 | 24 | //Add this Submodel Property to a Submodel 25 | if (options.submodelElementOf != null) { 26 | assert(options.submodelElementOf.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("SubmodelType")!), "options.submodelElementOf is not a SubmodelType."); 27 | 28 | const submodelElements = (options.submodelElementOf).submodelElements; 29 | submodelElements.addReference({ referenceType: "Organizes", nodeId: property }); 30 | options.submodelElementOf.referableChildrenMap.set(options.idShort, property); 31 | } 32 | 33 | //Add idShort 34 | const idShort = this._namespace.addVariable({ 35 | propertyOf: property, 36 | browseName: "idShort", 37 | dataType: "String", 38 | value: { 39 | get: function() { 40 | return new Variant({ 41 | dataType: DataType.String, 42 | value: options.idShort 43 | }); 44 | } 45 | } 46 | }); 47 | 48 | //Add description 49 | if (options.description != null) { 50 | const addDescriptionToProperty = get_description_creator(this.coreaas, property); 51 | addDescriptionToProperty(options.description); 52 | } 53 | 54 | //Add kind 55 | if(options.kind != null) { 56 | const addKindToProperty = get_modelingkind_creator(this.coreaas, property); 57 | addKindToProperty(options.kind); 58 | } 59 | 60 | //Add Category 61 | if(options.category != null) { 62 | const addCategoryToProperty = get_category_creator(this.coreaas, property); 63 | addCategoryToProperty(options.category); 64 | } 65 | //Add semantic id 66 | if (options.semanticId != null) { 67 | get_semanticId_creator(this.coreaas, property)(options.semanticId); 68 | } 69 | 70 | //Add Parent 71 | if (options.parent != null) { 72 | get_parent_creator(this.coreaas, property)(options.parent); 73 | } 74 | 75 | //Add valueId 76 | if (options.valueId != null) { 77 | this._create_valueId(property)(options.valueId); 78 | } 79 | 80 | //Add Value 81 | if (options.value != null) { 82 | this._namespace.addVariable({ 83 | propertyOf: property, 84 | browseName: "value", 85 | dataType: options.value.dataType, 86 | value: options.value.value 87 | }); 88 | } 89 | 90 | //Add ValueType 91 | if (options.valueType != null) { 92 | let valueType = options.valueType; 93 | 94 | this._namespace.addVariable({ 95 | propertyOf: property, 96 | browseName: "valueType", 97 | dataType: this.coreaas.findCoreAASDataType("PropertyValueType")!, 98 | value: { 99 | get: () => { 100 | return new Variant({ dataType: DataType.Int32, value: valueType }); 101 | } 102 | } 103 | }); 104 | } 105 | 106 | property.addSemanticId = get_semanticId_creator(this.coreaas, property); 107 | 108 | property.hasSemantic = (function(coreaas: CoreAASExtension): (semanticElem: UAObject) => SubmodelPropertyObject { 109 | const hasSemanticRefType = coreaas.findCoreAASReferenceType("HasSemantic")!; 110 | 111 | return function(semanticElem: UAObject): SubmodelPropertyObject { 112 | property.addReference({ referenceType: hasSemanticRefType, nodeId: semanticElem }); 113 | return property; 114 | } 115 | 116 | })(this.coreaas) 117 | 118 | property.addParent = get_parent_creator(this.coreaas, property); 119 | 120 | property.addValueId = this._create_valueId(property); 121 | 122 | return property; 123 | } 124 | 125 | private _create_valueId(obj: SubmodelPropertyObject): (valueId: RefArgument) => SubmodelPropertyObject { 126 | let coreaas = this.coreaas; 127 | 128 | return function(valueId: RefArgument): SubmodelPropertyObject { 129 | assert(!valueId.hasOwnProperty("valueId"), "the " + obj.browseName + " Object already contains a Component with BrowseName valueId"); 130 | 131 | if (valueId instanceof Array) { 132 | 133 | valueId.forEach(el => assert(isKey(el), "valueId Array contains an element that is not a Key.")); 134 | 135 | coreaas.addAASReference({ 136 | componentOf: obj, 137 | browseName: "valueId", 138 | keys: valueId 139 | }); 140 | } 141 | else { 142 | assert(valueId.typeDefinitionObj.isSupertypeOf(coreaas.getAASReferenceType()), "valueId is not an AASReferenceType instance."); 143 | 144 | obj.addReference({ referenceType: "HasComponent", nodeId: valueId}); 145 | } 146 | 147 | return obj; 148 | } 149 | } 150 | } -------------------------------------------------------------------------------- /src/builders/ViewBuilder.ts: -------------------------------------------------------------------------------- 1 | import { UAObject } from "node-opcua-address-space/dist/src/ua_object"; 2 | import { RefArgument, ViewObject, isKey, Key } from "../types"; 3 | import { CoreAASExtension } from "../CoreAASExtension"; 4 | import { Builder } from "./builder"; 5 | import assert = require("assert"); 6 | import { get_idShort_creator, get_semanticId_creator, get_parent_creator, get_description_creator } from "./builder_utilities"; 7 | import { UAVariable } from "node-opcua-address-space/dist/src/ua_variable"; 8 | import { ViewOptions } from "../options_types"; 9 | 10 | export class ViewBuilder extends Builder { 11 | 12 | constructor(coreaas: CoreAASExtension) { 13 | super(coreaas); 14 | } 15 | 16 | addAASView(options: ViewOptions): ViewObject { 17 | assert(options.idShort != null, "options.idShort parameter is missing."); 18 | 19 | const viewType = this.coreaas.findCoreAASObjectType("ViewType")!; 20 | 21 | const view = this._namespace.addObject({ 22 | typeDefinition: viewType, 23 | browseName: options.browseName || "View_" + options.idShort, 24 | nodeId: options.nodeId 25 | }) as ViewObject; 26 | 27 | view.referableChildrenMap = new Map(); 28 | 29 | const folderType = this._addressSpace.findNode("FolderType")!.nodeId; 30 | 31 | const containedElements = this._namespace.addObject({ 32 | typeDefinition: folderType, 33 | browseName: "ContainedElements", 34 | componentOf: view 35 | }); 36 | 37 | //Add idShort 38 | const idShort = get_idShort_creator(this.coreaas, view)(options.idShort); 39 | 40 | if (options.viewOf != null) { 41 | assert(options.viewOf.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASType")!), "options.viewOf is not a AASType."); 42 | 43 | const views = options.viewOf.views; 44 | views.addReference({ referenceType: "Organizes", nodeId: view }); 45 | options.viewOf.referableChildrenMap.set(options.idShort, view); 46 | } 47 | 48 | if (options.semanticId != null) { 49 | get_semanticId_creator(this.coreaas, view)(options.semanticId); 50 | } 51 | 52 | if (options.parent != null) { 53 | get_parent_creator(this.coreaas, view)(options.parent); 54 | } 55 | 56 | //Add description 57 | if (options.description != null) { 58 | const addDescriptionToView = get_description_creator(this.coreaas, view); 59 | addDescriptionToView(options.description); 60 | } 61 | 62 | view.addSemanticId = get_semanticId_creator(this.coreaas, view); 63 | view.addParent = get_parent_creator(this.coreaas, view); 64 | 65 | view.addContainedElementRef = (elemRef: RefArgument): ViewObject => { 66 | 67 | if (elemRef instanceof Array) { 68 | 69 | elemRef.forEach(el => assert(isKey(el), "Array parameter contains an element that is not a Key.")); 70 | 71 | this.coreaas.addAASReference({ 72 | organizedBy: view.containedElements, 73 | browseName: (elemRef[elemRef.length - 1]).value + "_Ref", 74 | keys: elemRef 75 | }); 76 | } 77 | else { 78 | assert(elemRef.typeDefinitionObj.isSupertypeOf(this.coreaas.findCoreAASObjectType("AASReferenceType")!), "elemRef is not an AASReferenceType instance."); 79 | view.containedElements.addReference({ referenceType: "Organizes", nodeId: elemRef}); 80 | } 81 | 82 | return view; 83 | } 84 | 85 | view.containsElements = (elements: UAObject | UAObject[]) => { 86 | const submodelElementType = this.coreaas.findCoreAASObjectType("SubmodelElementType")!; 87 | const containsElementRefType = this.coreaas.findCoreAASReferenceType("ContainsElement")!; 88 | 89 | if(elements instanceof Array) { 90 | elements.forEach(element => { 91 | assert(element.typeDefinitionObj.isSupertypeOf(submodelElementType), "An element of the Array is not a SubmodelElementType instance.") 92 | view.addReference({ referenceType: containsElementRefType, nodeId: element}); 93 | view.referableChildrenMap.set(( element).idShort._dataValue.value.value, element); 94 | }); 95 | } 96 | else { 97 | view.addReference({ referenceType: containsElementRefType, nodeId: elements}); 98 | view.referableChildrenMap.set(( elements).idShort._dataValue.value.value, elements); 99 | } 100 | 101 | return view; 102 | } 103 | 104 | return view; 105 | } 106 | } -------------------------------------------------------------------------------- /src/builders/builder.ts: -------------------------------------------------------------------------------- 1 | import { AddressSpace, Namespace } from "node-opcua"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | 4 | export abstract class Builder { 5 | protected _addressSpace: AddressSpace; 6 | protected _namespace: Namespace; 7 | 8 | constructor(protected coreaas: CoreAASExtension) { 9 | this._addressSpace = coreaas.addressSpace; 10 | this._namespace = coreaas.namespace; 11 | } 12 | } 13 | 14 | export * from "./AASBuilder"; 15 | export * from "./AASReferenceBuilder"; 16 | export * from "./AdministrativeInformationBuilder"; 17 | export * from "./AssetBuilder"; 18 | export * from "./DataSpecificationIEC61360Builder"; 19 | export * from "./EmbeddedDataSpecificationBuilder"; 20 | export * from "./ConceptDescriptionBuilder" 21 | export * from "./ConceptDictionaryBuilder"; 22 | export * from "./SubmodelBuilder" 23 | export * from "./SubmodelPropertyBuilder"; 24 | export * from "./SubmodelElementsBuilder"; 25 | export * from "./ViewBuilder"; -------------------------------------------------------------------------------- /src/builders/builder_utilities.ts: -------------------------------------------------------------------------------- 1 | import { Description, RefArgument, isKey, Identifier } from "../types"; 2 | import { CoreAASExtension } from "../CoreAASExtension"; 3 | import { LocalizedText, Variant, DataType, VariantArrayType, UAObject, UAVariable } from "node-opcua"; 4 | import assert = require("assert"); 5 | import { AssetKind, ModelingKind, PropertyCategory } from "../CoreAAS_enums"; 6 | import { BaseUAObject } from "node-opcua-factory"; 7 | 8 | export function get_identification_creator(coreaas: CoreAASExtension, identifiable: UAObject): (identification: Identifier) => UAVariable { 9 | 10 | return function(identification: Identifier): UAVariable { 11 | return coreaas.namespace.addVariable({ 12 | propertyOf: identifiable, 13 | browseName: "identification", 14 | dataType: coreaas.findCoreAASDataType("Identifier")!, 15 | value: { 16 | get: function() { 17 | return new Variant({ 18 | dataType: DataType.ExtensionObject, 19 | value: identification 20 | }); 21 | } 22 | } 23 | }); 24 | } 25 | } 26 | 27 | export function get_idShort_creator(coreaas: CoreAASExtension, referableObj: UAObject): (idShort: string) => UAVariable { 28 | 29 | return function (idShort: string): UAVariable { 30 | return coreaas.namespace.addVariable({ 31 | propertyOf: referableObj, 32 | browseName: "idShort", 33 | dataType: "String", 34 | value: { 35 | get: function() { 36 | return new Variant({ 37 | dataType: DataType.String, 38 | value: idShort 39 | }); 40 | } 41 | } 42 | }); 43 | } 44 | } 45 | 46 | export function get_description_creator(coreaas: CoreAASExtension, describedObj: UAObject): (description: Description) => UAVariable { 47 | 48 | return function(description: Description): UAVariable { 49 | 50 | let localizedTextArray: LocalizedText[] = []; 51 | 52 | if(typeof description === "string") { 53 | localizedTextArray.push(new LocalizedText({ text: description })); 54 | } else if(description instanceof LocalizedText) { 55 | localizedTextArray.push(description); 56 | } else { 57 | description.forEach(el => assert(el instanceof LocalizedText, "An element of the array is not a LocalizedText.")); 58 | localizedTextArray = description; 59 | } 60 | 61 | const desc = coreaas.namespace.addVariable({ 62 | propertyOf: describedObj, 63 | browseName: "description", 64 | dataType: "LocalizedText", 65 | value: { 66 | get: function() { 67 | return new Variant({ 68 | dataType: DataType.LocalizedText, 69 | arrayType: VariantArrayType.Array, 70 | value: localizedTextArray 71 | }); 72 | } 73 | }, 74 | valueRank: 1 75 | }); 76 | 77 | return desc; 78 | } 79 | } 80 | 81 | export function get_modelingkind_creator(coreaas: CoreAASExtension, hasKindObj: UAObject): (kind: ModelingKind) => UAVariable { 82 | 83 | return function(kind: ModelingKind): UAVariable { 84 | return coreaas.namespace.addVariable({ 85 | propertyOf: hasKindObj, 86 | browseName: "kind", 87 | dataType: coreaas.findCoreAASDataType("ModelingKind")!, 88 | value: { 89 | get: () => { 90 | return new Variant({ dataType: DataType.Int32, value: kind }); 91 | } 92 | } 93 | }); 94 | } 95 | } 96 | 97 | export function get_assetkind_creator(coreaas: CoreAASExtension, hasKindObj: UAObject): (kind: AssetKind) => UAVariable { 98 | 99 | return function(kind: AssetKind): UAVariable { 100 | return coreaas.namespace.addVariable({ 101 | propertyOf: hasKindObj, 102 | browseName: "kind", 103 | dataType: coreaas.findCoreAASDataType("AssetKind")!, 104 | value: { 105 | get: () => { 106 | return new Variant({ dataType: DataType.Int32, value: kind }); 107 | } 108 | } 109 | }); 110 | } 111 | } 112 | 113 | export function get_category_creator(coreaas: CoreAASExtension, referableObj: UAObject): (category: PropertyCategory) => UAVariable { 114 | return function(category: PropertyCategory): UAVariable { 115 | return coreaas.namespace.addVariable({ 116 | propertyOf: referableObj, 117 | browseName: "category", 118 | dataType: coreaas.findCoreAASDataType("PropertyCategory")!, 119 | value: { 120 | get: () => { 121 | return new Variant({ dataType: DataType.Int32, value: category }); 122 | } 123 | } 124 | }); 125 | } 126 | } 127 | 128 | export function get_semanticId_creator(coreaas: CoreAASExtension, obj: T): (semanticId: RefArgument) => T { 129 | 130 | return function(semanticId: RefArgument): T { 131 | assert(!semanticId.hasOwnProperty("semanticId"), "the " + obj.browseName + " Object already contains a Component with BrowseName semanticId"); 132 | 133 | if (semanticId instanceof Array) { 134 | 135 | semanticId.forEach(el => assert(isKey(el), "semanticId Array contains an element that is not a Key.")); 136 | 137 | coreaas.addAASReference({ 138 | componentOf: obj, 139 | browseName: "semanticId", 140 | keys: semanticId 141 | }); 142 | } 143 | else { 144 | assert(semanticId.typeDefinitionObj.isSupertypeOf(coreaas.getAASReferenceType()), "semanticId is not an AASReferenceType instance."); 145 | 146 | obj.addReference({ referenceType: "HasComponent", nodeId: semanticId}); 147 | } 148 | 149 | return obj; 150 | } 151 | } 152 | 153 | export function get_parent_creator(coreaas: CoreAASExtension, obj: T): (parent: RefArgument) => T { 154 | 155 | return function(parent: RefArgument): T { 156 | assert(!parent.hasOwnProperty("parent"), "the " + obj.browseName + " Object already contains a Component with BrowseName parent"); 157 | 158 | if (parent instanceof Array) { 159 | 160 | parent.forEach(el => assert(isKey(el), "parent Array contains an element that is not a Key.")); 161 | 162 | coreaas.addAASReference({ 163 | componentOf: obj, 164 | browseName: "parent", 165 | keys: parent 166 | }); 167 | } 168 | else { 169 | assert(parent.typeDefinitionObj.isSupertypeOf(coreaas.getAASReferenceType()), "parent is not an AASReferenceType instance."); 170 | 171 | obj.addReference({ referenceType: "HasComponent", nodeId: parent}); 172 | } 173 | 174 | return obj; 175 | } 176 | } 177 | 178 | -------------------------------------------------------------------------------- /src/demo.ts: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import { coreaasXmlFile, OPCUACertificateManager, nodesets, LocalizedText, CoreServer, IdentifierType, ModelingKind, KeyType, KeyElements, PropertyCategory, PropertyValueType, Variant, DataType } from "."; 3 | import { AssetKind, DataTypeIEC61360Type } from "./CoreAAS_enums"; 4 | 5 | let xmlFiles = [nodesets.standard, coreaasXmlFile] 6 | 7 | let server = new CoreServer({ 8 | nodeset_filename: xmlFiles, 9 | port: 4848, 10 | serverCertificateManager: new OPCUACertificateManager({ 11 | automaticallyAcceptUnknownCertificate: true, 12 | rootFolder: path.join(__dirname, "../certs") 13 | }) 14 | }) 15 | 16 | function post_initialize() { 17 | 18 | const Identifier = server.coreaas.Identifier; 19 | const Key = server.coreaas.Key; 20 | 21 | let admin = server.coreaas.addAdministrativeInformation({ 22 | version: "555", 23 | revision: "1825" 24 | }); 25 | 26 | const aas_1 = server.coreaas.addAssetAdministrationShell({ 27 | browseName: "SampleAAS", 28 | administration: admin, 29 | description: [ new LocalizedText({locale: "en", text: "Festo Controller"}), 30 | new LocalizedText({locale: "de", text: "Festo Controller"}) ], 31 | identification: new Identifier({ 32 | id: "www.admin-shell.io/aas-sample/1.0", 33 | idType: IdentifierType.IRI 34 | }), 35 | derivedFromRef: [ new Key({ 36 | idType: KeyType.IRDI, 37 | local: false, 38 | type: KeyElements.AssetAdministrationShell, 39 | value: "AAA#1234-454#123456789" 40 | }) ], 41 | assetRef: [new Key({ 42 | idType: KeyType.IRI, 43 | local: true, 44 | type: KeyElements.Asset, 45 | value: "http://pk.festo.com/3S7PLFDRS35" 46 | })] 47 | }) 48 | .addSubmodelRef([new Key({ 49 | idType: KeyType.IRI, 50 | local: true, 51 | type: KeyElements.Submodel, 52 | value: "http://www.zvei.de/demo/submodel/12345679" 53 | })]); 54 | 55 | /** 56 | * Add a Asset 57 | */ 58 | server.coreaas.addAsset({ 59 | browseName: "3S7PLFDRS35", 60 | idShort: "3S7PLFDRS35", 61 | identification: new Identifier({ 62 | id: "http://pk.festo.com/3S7PLFDRS35", 63 | idType: IdentifierType.IRI 64 | }), 65 | kind: AssetKind.Instance, 66 | description: new LocalizedText({locale: "en", text: "Festo Controller"}), 67 | assetOf: aas_1, 68 | assetIdentificationModelRef: [ new Key({ 69 | idType: KeyType.IRI, 70 | local: false, 71 | type: KeyElements.SubmodelElement, 72 | value: "//submodels/identification_3S7PLFDRS35" 73 | }) ] 74 | }); 75 | 76 | /** 77 | * Add Submodel 78 | */ 79 | const submodel_1 = server.coreaas.addSubmodel({ 80 | browseName: "12345679", 81 | kind: ModelingKind.Instance, 82 | idShort: "12345679", 83 | identification: new Identifier({ 84 | id: "http://www.zvei.de/demo/submodel/12345679", 85 | idType: IdentifierType.IRI 86 | }), 87 | semanticId: [ new Key({ 88 | idType: KeyType.IRI, 89 | local: false, 90 | type: KeyElements.GlobalReference, 91 | value: "http://www.zvei.de/demo/submodelDefinitions/87654346" 92 | }) ] 93 | }) 94 | .submodelOf(aas_1); 95 | 96 | /** 97 | * Add Properties to the submodel 98 | */ 99 | const rotationSpeed = server.coreaas.addSubmodelProperty({ 100 | browseName: "rotationSpeed", 101 | idShort: "rotationSpeed", 102 | submodelElementOf: submodel_1, 103 | semanticId: [ new Key({ 104 | idType: KeyType.IRI, 105 | local: true, 106 | type: KeyElements.ConceptDescription, 107 | value: "www.festo.com/dic/08111234" 108 | }) ], 109 | category: PropertyCategory.VARIABLE, 110 | valueType: PropertyValueType.Double, 111 | value: { 112 | dataType: "Double", 113 | value: { 114 | get: () => { 115 | return new Variant({ dataType: DataType.Double, value: 1120}); 116 | } 117 | } 118 | } 119 | }); 120 | 121 | const nmax = server.coreaas.addSubmodelProperty({ 122 | browseName: "NMAX", 123 | idShort: "NMAX", 124 | submodelElementOf: submodel_1, 125 | semanticId: [ new Key({ 126 | idType: KeyType.IRDI, 127 | local: true, 128 | type: KeyElements.ConceptDescription, 129 | value: "0173-1#02-BAA120#007" 130 | }) ], 131 | category: PropertyCategory.PARAMETER, 132 | valueType: PropertyValueType.Double, 133 | value: { 134 | dataType: "Double", 135 | value: { 136 | get: () => { 137 | return new Variant({ dataType: DataType.Double, value: 2000}); 138 | } 139 | } 140 | } 141 | }); 142 | 143 | /** 144 | * Add Dictionary to the AAS 145 | */ 146 | const conceptDictionary = server.coreaas.addConceptDictionary({ 147 | browseName: "ConceptDict_1", 148 | idShort: "ConceptDictionary_1", 149 | conceptDictionaryOf: aas_1, 150 | description: [ new LocalizedText({locale: "en", text: "Dicitonary for the Festo Controller."}), 151 | new LocalizedText({locale: "it", text: "Dizionario per il Controller Festo"}) ] 152 | }) 153 | .addConceptDescriptionRef([ 154 | new Key({ 155 | idType: KeyType.IRI, 156 | local: true, 157 | type: KeyElements.ConceptDescription, 158 | value: "www.festo.com/dic/08111234" 159 | }) 160 | ]) 161 | .addConceptDescriptionRef([ 162 | new Key({ 163 | idType: KeyType.IRDI, 164 | local: true, 165 | type: KeyElements.ConceptDescription, 166 | value: "0173-1#02-BAA120#007" 167 | }) 168 | ]); 169 | 170 | /** 171 | * Add ConceptDescriptions to the Dictionary 172 | */ 173 | 174 | //Add an EmbeddedDataSpecification to the AAS for Rotation Speed 175 | const embedded_1 = server.coreaas.addEmbeddedDataSpecification({ 176 | browseName: "EmbeddedDS_1", 177 | hasDataSpecification: [ new Key({ 178 | idType: KeyType.IRI, 179 | local: false, 180 | type: KeyElements.GlobalReference, 181 | value: "www.admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360" 182 | }) ], 183 | }) 184 | .addDataSpecificationIEC61360({ 185 | identifier: "rtzspd#123", 186 | preferredName: "Rotation Speed", 187 | definition: "The Rotation Speed of something", 188 | dataType: DataTypeIEC61360Type.REAL_MEASURE, 189 | unit: "1/m", 190 | unitId: [ new Key({ 191 | idType: KeyType.IRDI, 192 | local: false, 193 | type: KeyElements.GlobalReference, 194 | value: "0173-1#05-AAA650#002" 195 | }) ], 196 | shortName: "N", 197 | valueFormat: "NR1..5" 198 | }); 199 | 200 | server.coreaas.addConceptDescription({ 201 | browseName: "N", 202 | identification: new Identifier({ 203 | id: "www.festo.com/dic/08111234", 204 | idType: IdentifierType.IRI 205 | }), 206 | hasEmbeddedDataSpecifications: embedded_1, 207 | conceptDescriptionOf: conceptDictionary, 208 | }) 209 | .semanticOf(rotationSpeed); 210 | 211 | //Add an EmbeddedDataSpecification to the AAS for Max Rotation Speed 212 | const embedded_2 = server.coreaas.addEmbeddedDataSpecification({ 213 | browseName: "EmbeddedDS_1", 214 | hasDataSpecification: [ new Key({ 215 | idType: KeyType.IRI, 216 | local: false, 217 | type: KeyElements.GlobalReference, 218 | value: "www.admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360" 219 | }) ], 220 | }) 221 | .addDataSpecificationIEC61360({ 222 | preferredName: "Max Rotation Speed", 223 | shortName: "NMAX", 224 | valueFormat: "NR1..5", 225 | unitId: [ new Key({ 226 | idType: KeyType.IRDI, 227 | local: false, 228 | type: KeyElements.GlobalReference, 229 | value: "0173-1#05-AAA650#002" 230 | }) ] 231 | }); 232 | 233 | server.coreaas.addConceptDescription({ 234 | browseName: "NMax", 235 | identification: new Identifier({ 236 | id: "0173-1#02-BAA120#007", 237 | idType: IdentifierType.IRDI 238 | }), 239 | hasEmbeddedDataSpecifications: embedded_2, 240 | conceptDescriptionOf: conceptDictionary 241 | }) 242 | .semanticOf(nmax); 243 | 244 | /** 245 | * Start The OPC UA Server 246 | */ 247 | server.start(function () { 248 | console.log("Server is now listening ... ( press CTRL+C to stop)"); 249 | console.log("port ", server.endpoints[0].port); 250 | var endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl; 251 | console.log(" the primary server endpoint url is ", endpointUrl ); 252 | }); 253 | } 254 | 255 | server.initialize(post_initialize); -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "node-opcua"; 2 | 3 | export * from "./CoreServer"; 4 | export * from "./CoreAASExtension" 5 | export * from "./CoreAAS_enums"; 6 | 7 | import path from "path"; 8 | export const coreaasXmlFile: string = path.join(__dirname, "../nodesets/coreaas.xml"); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 6 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 7 | // "lib": [], /* Specify library files to be included in the compilation. */ 8 | // "allowJs": true, /* Allow javascript files to be compiled. */ 9 | // "checkJs": true, /* Report errors in .js files. */ 10 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 11 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 12 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 13 | "sourceMap": true, /* Generates corresponding '.map' file. */ 14 | // "outFile": "./", /* Concatenate and emit output to single file. */ 15 | "outDir": "dist", /* Redirect output structure to the directory. */ 16 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 17 | // "composite": true, /* Enable project compilation */ 18 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 19 | // "removeComments": true, /* Do not emit comments to output. */ 20 | // "noEmit": true, /* Do not emit outputs. */ 21 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 22 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 23 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 24 | 25 | /* Strict Type-Checking Options */ 26 | "strict": true, /* Enable all strict type-checking options. */ 27 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 28 | // "strictNullChecks": true, /* Enable strict null checks. */ 29 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 30 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 31 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 32 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 33 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 34 | 35 | /* Additional Checks */ 36 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 37 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 38 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 39 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 40 | 41 | /* Module Resolution Options */ 42 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 43 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 44 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 45 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 46 | // "typeRoots": [], /* List of folders to include type definitions from. */ 47 | // "types": [], /* Type declaration files to be included in compilation. */ 48 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 49 | "esModuleInterop": true , /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 50 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 51 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 52 | 53 | /* Source Map Options */ 54 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 55 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 56 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 57 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 58 | 59 | /* Experimental Options */ 60 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 61 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 62 | }, 63 | "typedocOptions": { 64 | "mode": "file", 65 | "out": "docs", 66 | "name": "node-opcua-coreaas", 67 | "readme": "./README.md", 68 | "exclude": "src/builders/**" 69 | } 70 | } 71 | --------------------------------------------------------------------------------