Ejemplo n.º 1
0
        /// <summary>
        /// Returns the given Relationshipelement as RelationshipElement of Adminshell
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public AdminShellNS.AdminShell.RelationshipElement GetPortsAsRelation(IOput input, IOput output, int type = 0)
        {
            AdminShellNS.AdminShell.Submodel submodel = new AdminShellNS.AdminShell.Submodel();

            submodel.identification.id     = "urn:itsowl.tedz.com:sm:instance:9053_7072_4002_2783";
            submodel.identification.idType = "IRI";


            // Finden der zugehörigen properties der in und out
            AdminShellNS.AdminShell.Entity entity = new AdminShellNS.AdminShell.Entity();
            entity.idShort = input.Owner;
            entity.parent  = submodel;

            AdminShellNS.AdminShell.Property property = new AdminShellNS.AdminShell.Property();
            property.idShort = input.IdShort;
            property.parent  = entity;


            AdminShellNS.AdminShell.Entity outentity = new AdminShellNS.AdminShell.Entity();
            outentity.idShort = output.Owner;
            outentity.parent  = submodel;

            AdminShellNS.AdminShell.Property outproperty = new AdminShellNS.AdminShell.Property();
            outproperty.idShort = output.IdShort;
            outproperty.parent  = outentity;


            // setzen als first bzw second

            AdminShellNS.AdminShell.RelationshipElement relationshipElement =
                new AdminShellNS.AdminShell.RelationshipElement();

            relationshipElement.first      = outproperty.GetReference();
            relationshipElement.second     = property.GetReference();
            relationshipElement.semanticId = SetSemanticIdRelEle(input, output, type);
            relationshipElement.idShort    = $"{relCount++}";


            return(relationshipElement);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the BillOfMaterial Submodel to the AAS
        /// </summary>
        /// <param name="name"></param>
        /// <param name="name_sm"></param>
        /// <returns></returns>
        private bool AddBomSubmodel(string name, string name_sm)
        {
            Bom                       = new AdminShellNS.AdminShell.Submodel();
            Bom.idShort               = name_sm;
            Bom.identification.id     = "urn:itsowl.tedz.com:sm:instance:9053_7072_4002_2783";
            Bom.identification.idType = "IRI";
            Bom.semanticId            = new AdminShellNS.AdminShell.SemanticId();
            Bom.semanticId.Keys.Add(new AdminShellNS.AdminShell.Key());
            Bom.semanticId.Keys[0].value  = "http://example.com/id/type/submodel/BOM/1/1";
            Bom.semanticId.Keys[0].type   = "Submodel";
            Bom.semanticId.Keys[0].idType = "IRI";

            String bom_json = Newtonsoft.Json.JsonConvert.SerializeObject(Bom);

            if (AASRestClient.PutSubmodel(bom_json, name_sm, name))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }