Beispiel #1
0
        public void ProjectAddSeq(Sequence s)
        {
            oProject.dynamicMode = Dynamic;

            if (oProject.Objects[s.ID] != null)
            {
                Plcs[s.Plc.Tag].Sequnces.Remove(s.Key);
            }

            CimObjectInstance oObj = new CimObjectInstance();

            oObj.ClassID = Class;
            if (Dynamic)
            {
                Cimplicity.PointSet(@"IMPORT.PROGRESS", $"Start Seq: {s.ID} for: {s.Plc.ObjRoot}");
            }

            oObj.ID = s.ID;
            oObj.Attributes.Set("$DESCRIPTION", s.Station);
            oObj.Attributes.Set("$DEVICE_ID", s.Plc.DEVICE_ID);
            oObj.Attributes.Set("$RESOURCE_ID", $"ZONE{s.Plc.ID.ToString("00")}");
            //oObj.Attributes.Set("AL", this.SafetyAreas[s.msObj].ALARM_CLASS);
            oObj.Attributes.Set("SA", this.SafetyAreas[s.msObj].SA);
            oObj.Attributes.Set("PLC", s.Plc.Tag);
            oObj.Attributes.Set("SEQ", s.SeqNum.ToString());

            oObj.Routing.AddAll();

            oProject.Objects.Save(oObj, Dynamic);

            oTableLG_BAD_PART.AddLoggedPoint(s.ID + ".BAD_PART");
            oTableLG_CYCLE_TIME.AddLoggedPoint(s.ID + ".CYCLE_TIME");
            oTableLG_FAULT_CODE.AddLoggedPoint(s.ID + ".FAULT_CODE");
            oTableLG_GOOD_PART.AddLoggedPoint(s.ID + ".GOOD_PART");
            oTableLG_PART_TYPE.AddLoggedPoint(s.ID + ".PART_TYPE");
            oTableLG_REASON_CODE.AddLoggedPoint(s.ID + ".REASON_CODE");
            oTableLG_STATUS.AddLoggedPoint(s.ID + ".STATUS");

            if (Dynamic)
            {
                Cimplicity.PointSet(@"IMPORT.PROGRESS", $"End Seq: {s.ID} for: {s.Plc.ObjRoot}");
                Cimplicity.PointSet(@"IMPORT.NEW_SEQ_NAME", s.ID);
            }

            Plc      p  = AddPLC(s.Plc.Tag, s.Plc.DEVICE_ID);
            Sequence s1 = AddSequence(this.Plcs[s.Plc.Tag], s.SeqNum, $"ZONE0{s.Plc.ID.ToString()}", s.MSNum, s.Station);

            NewSeq?.Invoke(s1.Plc, s);
        }
Beispiel #2
0
        public void ProjectDeleteSeq(Sequence s)
        {
            oProject.dynamicMode = Dynamic;
            if (oProject.Objects[s.ID] != null)
            {
                oProject.Objects.Delete(s.ID, Dynamic);
            }

            s.Plc.Sequnces.Remove(s.Key);
            if (s.Plc.Sequnces.Count == 0)
            {
                Plcs.Remove(s.Plc.Tag);
            }

            if (Dynamic)
            {
                Cimplicity.PointSet(@"IMPORT.NEW_SEQ_NAME", "Del: " + s.ID);
            }
        }