コード例 #1
0
 /// <summary>
 /// Creates a new semantic id for the summing points
 /// </summary>
 /// <returns></returns>
 private AdminShellNS.AdminShell.SemanticId createSemanticIdSummingPoint()
 {
     AdminShellNS.AdminShell.SemanticId semanticId = new AdminShellNS.AdminShell.SemanticId();
     AdminShellNS.AdminShell.Key        key        = new AdminShellNS.AdminShell.Key();
     key.value  = SemanticPort.GetInstance().GetSemanticForPort("BoM_SmdComp_Sum");
     key.type   = "ConceptDescription";
     key.local  = true;
     key.index  = 0;
     key.idType = "IRI";
     semanticId.Keys.Add(key);
     return(semanticId);
 }
コード例 #2
0
        /// <summary>
        /// Creates a node, represented as a Simulationmodel, for all physical ports which are connected.
        /// </summary>
        public void CreateNodesForPhysicalPorts()
        {
            int nodeCount = 0;
            List <SimulationModel> newSimMod = new List <SimulationModel>();


            AdminShellNS.AdminShell.SemanticId semanticId = new AdminShellNS.AdminShell.SemanticId();
            AdminShellNS.AdminShell.Key        key        = new AdminShellNS.AdminShell.Key();
            key.value  = "www.tedz.itsowl.com/ids/cd/1132_9030_2102_4033";
            key.type   = "ConceptDescription";
            key.local  = true;
            key.index  = 0;
            key.idType = "IRI";
            semanticId.Keys.Add(key);

            List <List <IOput> > nodeLists = new List <List <IOput> >();

            foreach (var simmod in SimulationsModels.Values)
            {
                foreach (var port in simmod.PhysicalPorts)
                {
                    if (!nodeLists.Contains(port.ConnectedTo) && port.ConnectedTo.Count > 1)
                    {
                        nodeLists.Add(port.ConnectedTo);
                    }
                }
            }

            foreach (var list in nodeLists)
            {
                SimulationModel nodeModel = createNode(nodeCount, semanticId, list);

                if (nodeModel.PhysicalPorts.Count > 0)
                {
                    newSimMod.Add(nodeModel);
                    nodeCount++;
                }
            }

            foreach (var simmod in newSimMod)
            {
                SimulationsModels.Add(simmod.Name, simmod);
            }
        }
コード例 #3
0
        /// <summary>
        /// Sets the SemanticID of the relation depending in the semanticPort class.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public AdminShellNS.AdminShell.SemanticId SetSemanticIdRelEle(IOput input, IOput output, int type)
        {
            AdminShellNS.AdminShell.SemanticId semantic = new AdminShellNS.AdminShell.SemanticId();
            AdminShellNS.AdminShell.Key        key      = new AdminShellNS.AdminShell.Key();
            key.idType = "IRI";
            key.index  = 0;
            key.local  = true;
            key.type   = "ConceptDescription";
            switch (type)
            {
            case 0: key.value = SemanticPort.GetInstance().GetSemanticForPort("SmdComp_SignalFlow"); break;

            case 1: key.value = SemanticPort.GetInstance().GetSemanticForPort("SmdComp_PhysicalElectric"); break;

            case 2: key.value = "mechanic"; break;
            }
            semantic.JsonKeys.Add(key);
            return(semantic);
        }
コード例 #4
0
        /// <summary>
        /// Creates multiplication points in case there is a connection where the ports to not share the same unit
        /// but were connected because of a mapping. The mapping conatains a value which is used here as the factor
        /// for the multiplication. The existing output port of the existing connection gets connected to the multports
        /// input port and the input port of the connection gets connected to the multports output port.
        /// The old connection is removed.
        /// </summary>
        /// <returns></returns>
        public bool CreateMultPoints()
        {
            int multCount = 0;
            List <SimulationModel> newSimMod = new List <SimulationModel>();


            AdminShellNS.AdminShell.SemanticId semanticId = new AdminShellNS.AdminShell.SemanticId();
            AdminShellNS.AdminShell.Key        key        = new AdminShellNS.AdminShell.Key();
            key.value  = SemanticPort.GetInstance().GetSemanticForPort("BoM_SmdComp_Mult");
            key.type   = "ConceptDescription";
            key.local  = true;
            key.index  = 0;
            key.idType = "IRI";
            semanticId.Keys.Add(key);

            foreach (var simmod in SimulationsModels.Values)
            {
                foreach (var input in simmod.Inputs)
                {
                    if (input.EclassID != null && simmod.Mappings.ContainsKey(input.EclassID))
                    {
                        foreach (var connected in input.ConnectedTo.ToList())
                        {
                            string          name     = "mult_" + multCount++;
                            SimulationModel multPort = new SimulationModel();
                            multPort.SemanticId = semanticId;
                            multPort.Multfactor = simmod.Mappings[input.EclassID].Value;

                            IOput iput = new IOput("in", name);
                            iput.SemanticId = input.SemanticId;

                            IOput oput = new IOput("out", name);
                            oput.SemanticId = input.SemanticId;

                            input.RemoveConnection(connected);

                            oput.AddConnection(input);
                            iput.AddConnection(connected);

                            multPort.Outputs.Add(oput);
                            multPort.Inputs.Add(iput);
                            multPort.Name = name;
                            newSimMod.Add(multPort);
                        }
                    }
                }


                foreach (var output in simmod.Outputs)
                {
                    if (output.EclassID != null && simmod.Mappings.ContainsKey(output.EclassID))
                    {
                        foreach (var connected in output.ConnectedTo.ToList())
                        {
                            string          name     = "mult_" + multCount++;
                            SimulationModel multPort = new SimulationModel();
                            multPort.SemanticId = semanticId;
                            multPort.Multfactor = simmod.Mappings[output.EclassID].Value;

                            IOput iput = new IOput("in", name);
                            iput.SemanticId = output.SemanticId;

                            IOput oput = new IOput("out", name);
                            oput.SemanticId = output.SemanticId;

                            output.RemoveConnection(connected);

                            iput.AddConnection(output);
                            oput.AddConnection(connected);

                            multPort.Outputs.Add(oput);
                            multPort.Inputs.Add(iput);
                            multPort.Name = name;
                            newSimMod.Add(multPort);
                        }
                    }
                }
            }
            foreach (var simMod in newSimMod)
            {
                SimulationsModels.Add(simMod.Name, simMod);
            }

            return(true);
        }