Пример #1
0
        /// <summary>
        /// Adds the component and its ports to the BillOfMaterial
        /// </summary>
        /// <param name="name"></param>
        /// <param name="name_sm"></param>
        /// <returns></returns>
        private bool AddComponentInfos(string name, string name_sm)
        {
            bool allsuccess = true;

            foreach (var sim in SimulationModels)
            {
                if (!((sim.Inputs.Count == 0 && sim.Outputs.Count == 0) && sim.PhysicalPorts.Count == 0))
                {
                    AdminShellNS.AdminShell.Entity simAsEntity = GetSimModelAsEntity(sim, name_sm);
                    foreach (var port in GetPortsAsProp(sim))
                    {
                        simAsEntity.Add(port);
                    }
                    string test_ent_json = Newtonsoft.Json.JsonConvert.SerializeObject(simAsEntity);

                    SimModelsAsEntities.Add(sim.Name, simAsEntity);

                    if (!AASRestClient.PutEntity(test_ent_json, name, name_sm, ""))
                    {
                        allsuccess = false;
                    }
                }
            }

            return(allsuccess);
        }
Пример #2
0
 public void SetSubmodelElementsAsEntity(JObject jObject)
 {
     foreach (var subEle in jObject["submodelElements"])
     {
         AdminShellNS.AdminShell.Entity entity = JsonConvert.
                                                 DeserializeObject <AdminShellNS.AdminShell.Entity>(subEle.ToString());
         this.SubmodelElementsAsEntity.Add(entity.idShort, entity);
     }
 }
Пример #3
0
        /// <summary>
        /// Returns the SimulationModel as Entity
        /// </summary>
        /// <param name="simulationModel"></param>
        /// <param name="nameSubmodel"></param>
        /// <returns></returns>
        public AdminShellNS.AdminShell.Entity GetSimModelAsEntity(SimulationModel simulationModel, string nameSubmodel)
        {
            AdminShellNS.AdminShell.Entity entity = new AdminShellNS.AdminShell.Entity();
            entity.idShort        = simulationModel.Name;
            entity.parent         = new AdminShellNS.AdminShell.Referable();
            entity.parent.idShort = nameSubmodel;
            entity.entityType     = "CoManagedEntity";
            entity.semanticId     = simulationModel.SemanticId;

            return(entity);
        }
Пример #4
0
        /// <summary>
        /// Returns the SimulationModel as Entity
        /// </summary>
        /// <param name="simulationModel"></param>
        /// <param name="nameSubmodel"></param>
        /// <returns></returns>
        public AdminShellNS.AdminShell.Entity GetSimModelAsEntity(SimulationModel simulationModel, string nameSubmodel)
        {
            AdminShellNS.AdminShell.Entity entity = new AdminShellNS.AdminShell.Entity();
            entity.idShort    = simulationModel.Name;
            entity.entityType = "CoManagedEntity";
            entity.semanticId = simulationModel.SemanticId;

            // make new parent
            var newpar = new AdminShellNS.AdminShell.Referable();

            newpar.idShort = nameSubmodel;
            entity.parent  = newpar;

            // to be processed further
            return(entity);
        }
Пример #5
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);
        }