/// <summary> /// 配置CPU模块 /// </summary> public void ConfigCPUUnits(YZXCPUProject Project) { int statusL = YZXUDT.GetUDTLength(YZXUDTTypes.UnitStatus); UnitStatus = new YZXCPUMemory("UnitStatus", Project.Units.Count * statusL); Mermories["UnitStatus"] = UnitStatus; Units = new Dictionary <string, YZXUnit>(); for (int i = 0; i < Project.Units.Count; i++) { System.Tuple <YZXUnitTypes, YZXUnit> tu = Project.Units[i]; YZXUnit unit = tu.Item2; if (tu.Item1 == YZXUnitTypes.Snap7ClientDB) { Snap7ClientDBUnit u = unit as Snap7ClientDBUnit; u.Client.con(); } unit.Init(); YZXUnitStatus status = (YZXUnitStatus) UnitStatus.InitUDT(YZXUDTTypes.UnitStatus, this, (i * statusL).ToString()); status.Unit = unit; unit.Status = status; Units[unit.Name] = unit; } }
/// <summary> /// 配置CPU内存区域 /// </summary> public void ConfigCPUMermories(YZXCPUProject Project) { foreach (KeyValuePair <string, int> item in Project.Mermories) { Mermories[item.Key] = new YZXCPUMemory(item.Key, item.Value); } int statusL = YZXUDT.GetUDTLength(YZXUDTTypes.CPUStatus); CPUStatus = new YZXCPUMemory("CPUStatus", statusL); Mermories["CPUStatus"] = CPUStatus; }