Skip to content

Library of submodel templates implemented in C#

License

Notifications You must be signed in to change notification settings

VWS4LS/vws4ls-submodel-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vws4ls-submodel-templates

This project provides an incomplete implementation of submodel templates used for the VWS4LS research project. The submodels are implemented in C# using the aas-core3.0-csharp library. It can be used in conjunction with the aas-package3-csharp library to produce AASX package files.

Supported Submodel Templates

The following submodel templates are supported by this library:

Submodel Template Version IDTA Number Link Remarks
Asset Interfaces Description 1.0 02017 Submodel Template
Capability Description 1.0 02020 Submodel Template Based on an early draft of the submodel.
Contact Information 1.0 02002 Submodel Template
Digital Nameplate 2.0 02006 Submodel Template
Handover Documentation 1.2 02004 Submodel Template
Hierarchical Structures enabling Bills of Material 1.0 02011 Submodel Template
Message Participant 1.0 TP6 New submodel developed by the VWS4LS project.
Predictive Maintenance 1.1 02048 Based on an early draft of the submodel.
Service Request Notification 1.1 02010 Submodel Template
Technical Data 1.2 02003 Submodel Template
Time Series Data 1.1 02008 Submodel Template

Approach

There is a dedicated class for each Submodel Template with public properties that expose the Submodel, its Submodel Elements, and corresponding Concept Descriptions. Concept Descriptions are static so they can be used without creating a class instance first.

Please note that Submodel Elements are always initialized when the object is constructed. This is done to make it simpler for callers to work with the Submodel without having to dynamically initialize elements. But this also means that all Submodel Elements that aren't used will still be initialized with empty values.

Usage

The following example illustrates how to create a package with Asset Administration Shell and the Digital Nameplate Submodel.

using AasCore.Aas3.Package;
using AasCore.Aas3_0;
using System.Net.Mime;
using System.Xml;
using VWS4LS.SubmodelTemplates.DigitalNameplate;

// Create digital nameplate
DigitalNameplateSubmodel digitalNameplate = new(id: "http://vws4ls.de/sm/22A74882-213E-4678-ABD0-DE46755DA8FA");
digitalNameplate.CountryOfOrigin.Value = "Germany";
digitalNameplate.DateOfManufacture.Value = "2024-10-15";
digitalNameplate.YearOfConstruction.Value = "2024";
digitalNameplate.ManufacturerName.Value = [new LangStringTextType("de", "VWS4LS")];
digitalNameplate.CompanyLogo.Value = "https://avatars.githubusercontent.com/u/177032889?s=96&v=4";

// Create Asset Administration Shell
AssetInformation assetInformation = new(AssetKind.Type)
{
    GlobalAssetId = "http://admin-shell.io/aas/9C78EEC9-95DE-42FB-8464-1052D4EA8FA9",
};

AdministrativeInformation administrativeInformation = new(version: "1", revision: "0");

AssetAdministrationShell aas = new(
    id: "http://admin-shell.io/aas/9B391120-76AE-4B2D-8AD0-584D44FBB84D",
    assetInformation: assetInformation)
{
    Administration = administrativeInformation,
    IdShort = "VWS4LS_Example_AAS",
    Submodels = 
    [
        // Add a reference to the Digital Nameplate Submodel
        new Reference(ReferenceTypes.ModelReference, [new Key(KeyTypes.Submodel, digitalNameplate.Submodel.Id)]),
    ],
};


// Create the environment and add the AAS and the Digital Nameplate Submodel
// as well as the ConceptDescriptions of the Digital Nameplate Submodel
AasCore.Aas3_0.Environment environment = new()
{
    AssetAdministrationShells =
    [
        aas,
    ],
    Submodels =
    [
        digitalNameplate.Submodel,
    ],
    ConceptDescriptions =
    [
        .. DigitalNameplateSubmodel.ConceptDescriptions,
    ]
};


// Create a package
var packaging = new Packaging();
using var package = packaging.Create("VWS4LS_Example.aasx");

// Serialize the environment
using var stream = new MemoryStream();
using var writer = XmlWriter.Create(stream);

Xmlization.Serialize.To(environment, writer);
writer.Flush();
stream.Position = 0;

// Put the environment into the package
Uri envPath = new Uri("/aasx/data.xml", UriKind.Relative);
var envPart = package.PutPart(envPath, MediaTypeNames.Text.Xml, stream);

// Mark the environment as the main entry point
package.MakeSpec(envPart);

// Save the package
package.Flush();

Use Eclipse AASX Package Explorer to view the package file.