Skip to main content
Jump to: navigation, search

BaSyx / Introductory Examples / Java / Step 5

Step 5: Creating the AAS, registering it, and uploading to the AAS server

The last example did create the oven Submodel. This Submodel is available in the network and can be accessed by the users. In this example step, an Asset Administration Shell will be created as a unified representation of the oven. The AAS provides an asset independent digital representation. All asset specific data, such as temperature sensors and invokable operations are provided through Submodels of the AAS. The created AAS for the oven with therefore reference one Submodel, which is the oven Submodel from the previous steps. The AAS of the oven will be hosted on the AAS server in the IT infrastructure. It is registered in the AASRegistry using an AAS descriptor to ensure that it can be found in the network. The descriptor also contains a Submodel descriptor. Once the model is registered, it is accessible by its IT. If the model is re-deployed to a different location, it is sufficient to update the registry entry.

The created AAS then can be explored through its HTTP-Rest with any HTTP client, e.g. with a web browser.

Creating the AAS

The Asset Administration Shell is a digital representation of a real world asset. Every asset is described at least by a short name (in this example ovenAsset), and by an URN. The short name does not need to be globally unique, it is sufficient if it is unique in the local context. The URN is used to refer to the asset, and therefore it should be unique. In this example, we will be using "urn:org.eclipse.basyx:OvenAsset". A guide for creating global URNs, and a proposal for an URN scheme that also includes versioning and revision information is provided here - Asset Administration Shell.

A device may come with an initial AAS that is transferred to an AAS server when the device is connected. Alternatively, an AAS may be sent in a serialized format, e.g. as .aasx or as JSON file before a physical device is delivered. In this example, the AAS is created with Java code, and uploaded by the device to the AAS server, and also registered in the registry.

  1. 	// The URN is a unique name, and refers to the asset
  2. 	ModelUrn aasURN = new ModelUrn("urn:org.eclipse.basyx:OvenAAS");
  4. 	// A digital representation of the asset
  5. 	Asset asset = new Asset("ovenAsset", aasURN, AssetKind.INSTANCE);
  7. 	// Create the Asset Administration Shell object
  8. 	AssetAdministrationShell aas = new AssetAdministrationShell("oven", aasURN, asset);

The created Asset Administration Shell needs to be populated with the Submodels of the AAS. For this example, this will be the oven Submodel. This code should be placed after the last lines of the main function from the previous step.

  1. 	// Now add the references of the submodels to the AAS header
  2. 	aas.addSubmodel(ovenModel);

Creating the AAS descriptor and registering everything

The created Asset Administration Shell needs to be uploaded to the AAS server, and to the AAS registry. The registry requires an AAS descriptor that contains information about the AAS itself, and about the Submodels of the AAS.

  1. 	// Create a descriptor for the AAS
  2. 	AASDescriptor aasDescriptor = new AASDescriptor(aas, "http://localhost:4000/handson/oven/aas");
  3. 	// Explicitly create and add submodel descriptors
  4. 	SubmodelDescriptor sensorSMDescriptor = new SubmodelDescriptor(ovenModel, "http://localhost:4000/handson/oven/aas/submodels/oven");
  6.         // Depending on the registry endpoint, this path needs to be adapted (cf. step 2)
  7. 	final String REGISTRYPATH = "http://localhost:4000/handson/registry/";
  9.         // Register the oven Submodel at the registry
  10.         AASRegistryProxy registry = new AASRegistryProxy(REGISTRYPATH);
  11. 	registry.register(aasDescriptor);

Now we have a working Asset Administration Shell that has been uploaded to the AAS server, as well as an oven Submodel. Both, the Submodel and the AAS have been registered at the registry.

Back to the top