Exemple #1
0
 private static void AddDescriptions(AdminShellV20.Referable r, Iec61360Data data)
 {
     foreach (var lang in data.PreferredName.AvailableLanguages)
     {
         r.AddDescription(lang, data.PreferredName.Get(lang));
     }
 }
Exemple #2
0
        public static AdminShellV20.Submodel CreateSubmodel(
            AdminShellV20.AdministrationShellEnv env,
            AdminShellV20.AdministrationShell adminShell, Iec61360Data data)
        {
            // We need this to ensure that we don't use the same AAS ID twice when importing multiple submodels (as
            // GenerateIdAccordingTemplate uses the timestamp as part of the ID).
            Thread.Sleep(1000);
            var submodel = new AdminShellV20.Submodel()
            {
                identification = new AdminShellV20.Identification(
                    AdminShellV20.Identification.IRI,
                    AasxPackageExplorer.Options.Curr.GenerateIdAccordingTemplate(
                        AasxPackageExplorer.Options.Curr.TemplateIdSubmodelInstance)),
                idShort = data.IdShort,
                kind    = AdminShellV20.ModelingKind.CreateAsInstance(),
            };

            AddDescriptions(submodel, data);
            AddDataSpecification(env, submodel, data);

            adminShell.AddSubmodelRef(submodel.GetReference() as AdminShellV20.SubmodelRef);
            env.Submodels.Add(submodel);

            return(submodel);
        }
Exemple #3
0
        public static AdminShellV20.SubmodelElementCollection CreateCollection(
            AdminShellV20.AdministrationShellEnv env, Iec61360Data data)
        {
            var collection = new AdminShellV20.SubmodelElementCollection()
            {
                idShort = data.IdShort,
                kind    = AdminShellV20.ModelingKind.CreateAsInstance(),
            };

            InitSubmodelElement(env, collection, data);
            return(collection);
        }
Exemple #4
0
        public static AdminShellV20.Property CreateProperty(
            AdminShellV20.AdministrationShellEnv env, Iec61360Data data, string valueType)
        {
            var property = new AdminShellV20.Property()
            {
                idShort   = data.IdShort,
                kind      = AdminShellV20.ModelingKind.CreateAsInstance(),
                valueType = valueType,
            };

            InitSubmodelElement(env, property, data);
            return(property);
        }
Exemple #5
0
        private static void AddDataSpecification(AdminShellV20.AdministrationShellEnv env,
                                                 AdminShellV20.Submodel submodel, Iec61360Data data)
        {
            var cd = CreateConceptDescription(env, data);

            // cd should already contain IEC61360Spec; add data spec
            // TODO (Robin, 2020-09-03): MIHO is not sure, if the data spec reference is correct; please check
            var eds = cd.IEC61360DataSpec;

            if (eds != null)
            {
                eds.dataSpecification = new AdminShellV20.DataSpecificationRef(cd.GetReference());
            }

            submodel.semanticId = new AdminShellV20.SemanticId(cd.GetReference());
        }
Exemple #6
0
        private static AdminShellV20.ConceptDescription CreateConceptDescription(
            AdminShellV20.AdministrationShellEnv env, Iec61360Data data)
        {
            var cd = AdminShellV20.ConceptDescription.CreateNew(
                data.IdShort, AdminShellV20.Identification.IRDI, data.Irdi);

            // TODO (Robin, 2020-09-03): check this code
            cd.IEC61360Content = data.ToDataSpecification();
            // dead-csharp off
            //cd.embeddedDataSpecification = new AdminShellV20.EmbeddedDataSpecification()
            //{
            //    dataSpecificationContent = new AdminShellV20.DataSpecificationContent()
            //    {
            //        dataSpecificationIEC61360 = data.ToDataSpecification(),
            //    },
            //};
            // dead-csharp on

            cd.AddIsCaseOf(AdminShellV20.Reference.CreateIrdiReference(data.Irdi));
            env.ConceptDescriptions.Add(cd);
            return(cd);
        }
Exemple #7
0
        public static AdminShellV20.Submodel CreateSubmodel(
            AdminShellV20.AdministrationShellEnv env,
            AdminShellV20.AdministrationShell adminShell, Iec61360Data data)
        {
            var submodel = new AdminShellV20.Submodel()
            {
                identification = new AdminShellV20.Identification(
                    AdminShellV20.Identification.IRI,
                    AasxPackageExplorer.Options.Curr.GenerateIdAccordingTemplate(
                        AasxPackageExplorer.Options.Curr.TemplateIdSubmodelInstance)),
                idShort = data.IdShort,
                kind    = AdminShellV20.ModelingKind.CreateAsInstance(),
            };

            AddDescriptions(submodel, data);
            AddDataSpecification(env, submodel, data);

            adminShell.AddSubmodelRef(submodel.GetReference() as AdminShellV20.SubmodelRef);
            env.Submodels.Add(submodel);

            return(submodel);
        }
Exemple #8
0
 private static void InitSubmodelElement(AdminShellV20.AdministrationShellEnv env,
                                         AdminShellV20.SubmodelElement submodelElement, Iec61360Data data)
 {
     AddDescriptions(submodelElement, data);
     AddDataSpecification(env, submodelElement, data);
 }