Пример #1
0
        // Inject the Control to value changes notification list (will be notified for new values)
        // All controls must be added in order to have visualization refresh
        public void addTag(string varName, ref ITag iTag)
        {
            CTag    cTag = Program.sim.getCTag(iTag.getTagName());      // Lookup
            TagItem item = new TagItem(iTag, cTag);                     // Binding

            tagNotificationList__.Add(item);
        }
Пример #2
0
        public Simulator()
        {
            // Creates tags simulating values from PLCs : are the sources
            // This is just a simple and static representation of tags, must be replaced for production projects

            // TagNames MUST match the ITag Control's names placed by toolbox to window (in property pane)
            CTag var;

            var = new CTag(); var.data.TagName = "@VAR1"; var.data.value = 11; plc__.Add(var);
            var = new CTag(); var.data.TagName = "@VAR2"; var.data.value = 17; plc__.Add(var);
            var = new CTag(); var.data.TagName = "@VAR3"; var.data.value = 33; plc__.Add(var);

            timerIntervalInit();
        }
Пример #3
0
        // Lookup into the list
        public CTag getCTag(string tagname)
        {
            CTag res = null;

            foreach (CTag obj in plc__)
            {
                if (obj.data.TagName == tagname)
                {
                    res = obj;
                    goto exitLoop;
                }
            }
            exitLoop : return(res);
        }
Пример #4
0
        public CTag ctagRef;        // Data containing actual tag values (instances are in simulation class)

        // Constructor
        public TagItem(ITag itag, CTag ctag)
        {
            itagRef = itag;
            ctagRef = ctag;
        }