コード例 #1
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);
        }
コード例 #2
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);
        }