Exemplo n.º 1
0
		public GKDoor()
		{
			PlanElementUIDs = new List<Guid>();
			OpenRegimeLogic = new GKLogic();
			NormRegimeLogic = new GKLogic();
			CloseRegimeLogic = new GKLogic();
			Delay = 15;
			Hold = 20;
			PimEnter = new GKPim
			{
				IsAutoGenerated = true,
				DoorUID = UID,
				UID = GuidHelper.CreateOn(UID, 0)
			};
			PimExit = new GKPim
			{
				IsAutoGenerated = true,
				DoorUID = UID,
				UID = GuidHelper.CreateOn(UID, 1)
			};

			PimCrossing = new GKPim
			{
				IsAutoGenerated = true,
				DoorUID = UID,
				UID = GuidHelper.CreateOn(UID, 2)
			};
		}
Exemplo n.º 2
0
		public LogicViewModel(GKBase gkBase, GKLogic logic, bool hasOffClause = false, bool hasOnNowClause = false, bool hasOffNowClause = false, bool hasStopClause = false, bool hasOnClause = true, bool hasOn2Clause = false, bool isIC = false)
		{
			if (gkBase != null)
				Title = "Настройка логики " + gkBase.PresentationName;
			else
				Title = "Настройка логики";

			if (logic.OnClausesGroup.Clauses.Count == 0 && logic.OnClausesGroup.ClauseGroups.Count == 0 && hasOnClause)
			{
				logic.OnClausesGroup.Clauses.Add(new GKClause());
			}

			OnClausesGroup = new ClauseGroupViewModel(gkBase, logic.OnClausesGroup);
			On2ClausesGroup = new ClauseGroupViewModel(gkBase, logic.On2ClausesGroup);
			OffClausesGroup = new ClauseGroupViewModel(gkBase, logic.OffClausesGroup);
			OnNowClausesGroup = new ClauseGroupViewModel(gkBase, logic.OnNowClausesGroup);
			OffNowClausesGroup = new ClauseGroupViewModel(gkBase, logic.OffNowClausesGroup);
			StopClausesGroup = new ClauseGroupViewModel(gkBase, logic.StopClausesGroup);
			RedIndicatorLogic = new ICIndicatorLogicViewModel(gkBase, logic.RedIndicatorLogic);
			GreenIndicatorLogic = new ICIndicatorLogicViewModel(gkBase, logic.GreenIndicatorLogic);
			YellowIndicatorLogic = new ICIndicatorLogicViewModel(gkBase, logic.YellowIndicatorLogic);
			UseOffCounterLogic = logic.UseOffCounterLogic;

			HasOnClause = hasOnClause;
			HasOffClause = hasOffClause;
			HasOnNowClause = hasOnNowClause;
			HasOffNowClause = hasOffNowClause;
			HasStopClause = hasStopClause;
			HasOn2Clause = hasOn2Clause;
			IsIC = isIC;
		}
Exemplo n.º 3
0
		public GKMPT()
		{
			MptLogic = new GKLogic();
			MPTDevices = new List<GKMPTDevice>();
			Delay = 60;
			PlanElementUIDs = new List<Guid>();
		}
Exemplo n.º 4
0
		public GKLogic GetModel()
		{
			var logic = new GKLogic();
			logic.OnClausesGroup = OnClausesGroup.GetClauseGroup();
			logic.On2ClausesGroup = On2ClausesGroup.GetClauseGroup();
			logic.OffClausesGroup = OffClausesGroup.GetClauseGroup();
			logic.OnNowClausesGroup = OnNowClausesGroup.GetClauseGroup();
			logic.OffNowClausesGroup = OffNowClausesGroup.GetClauseGroup();
			logic.StopClausesGroup = StopClausesGroup.GetClauseGroup();
			logic.UseOffCounterLogic = UseOffCounterLogic;
			logic.RedIndicatorLogic = RedIndicatorLogic.GetModel();
			logic.GreenIndicatorLogic = GreenIndicatorLogic.GetModel();
			logic.YellowIndicatorLogic = YellowIndicatorLogic.GetModel();
			return logic;
		}
Exemplo n.º 5
0
		public GKDevice()
		{
			Children = new List<GKDevice>();
			Properties = new List<GKProperty>();
			DeviceProperties = new List<GKProperty>();
			ZoneUIDs = new List<Guid>();
			Logic = new GKLogic();
			NSLogic = new GKLogic();
			PlanElementUIDs = new List<Guid>();
			GKReflectionItem = new GKReflectionItem();
			AllowMultipleVizualization = false;
			Zones = new List<GKZone>();
			GuardZones = new List<GKGuardZone>();
			PmfUsers = new List<GKUser>();
		}
Exemplo n.º 6
0
		public GKPumpStation()
		{
			Delay = 30;
			Hold = 600;
			DelayRegime = DelayRegime.Off;
			NSPumpsCount = 1;
			NSDeltaTime = 5;
			StartLogic = new GKLogic();
			StopLogic = new GKLogic();
			AutomaticOffLogic = new GKLogic();
			this.PlanElementUIDs = new List<Guid>();

			NSDevices = new List<GKDevice>();
			NSDeviceUIDs = new List<Guid>();

			Pim = new GKPim()
			{
				IsAutoGenerated = true,
				PumpStationUID = UID,
				UID = GuidHelper.CreateOn(UID, 0)
			};
		}
Exemplo n.º 7
0
		public void RemoveDeviceTestLogicForMptNsDoor()
		{
			var device = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1);
			var device2 = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1);
			GKManager.UpdateConfiguration();

			var clause = new GKClause
			{
				ClauseOperationType = ClauseOperationType.AllDevices,
				DeviceUIDs = { device.UID }
			};

			var gkLogic = new GKLogic();
			gkLogic.OnClausesGroup.Clauses.Add(clause);

			var mpt = new GKMPT();
			var gkMptDevice = new GKMPTDevice { Device = device, DeviceUID = device.UID };
			GKManager.AddMPT(mpt);
			GKManager.SetMPTLogic(mpt, gkLogic);
			mpt.MPTDevices.Add(gkMptDevice);
			Assert.IsTrue(mpt.MptLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsTrue(mpt.MPTDevices.Any(x => x.DeviceUID == device.UID));
			Assert.IsTrue(mpt.InputDependentElements.Contains(device));
			Assert.IsTrue(device.OutputDependentElements.Contains(mpt));

			var pump = new GKPumpStation();
			GKManager.AddPumpStation(pump);
			GKManager.SetPumpStationStartLogic(pump, gkLogic);
			GKManager.ChangePumpDevices(pump, new List<GKDevice>() {device});
			Assert.IsTrue(pump.StartLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsTrue(pump.NSDevices.Contains(device));
			Assert.IsTrue(pump.InputDependentElements.Contains(device));
			Assert.IsTrue(device.OutputDependentElements.Contains(pump));

			var door = new GKDoor();
			GKManager.AddDoor(door);
			GKManager.SetDoorOpenRegimeLogic(door, gkLogic);
			GKManager.SetDoorCloseRegimeLogic(door, gkLogic);
			GKManager.ChangeEnterButtonDevice(door, device);
			Assert.IsTrue(door.EnterButton == device);
			Assert.IsTrue(door.EnterButtonUID == device.UID);
			Assert.IsTrue(device.Door == door);
			Assert.IsTrue(device.OutputDependentElements.Contains(door));
			Assert.IsTrue(door.InputDependentElements.Contains(device));
			door.EnterButton = null;
			door.EnterButtonUID = Guid.Empty;

			GKManager.ChangeExitButtonDevice(door, device);
			Assert.IsTrue(door.ExitButton == device);
			Assert.IsTrue(door.ExitButtonUID == device.UID);
			Assert.IsTrue(device.Door == door);
			door.ExitButton = null;
			door.ExitButtonUID = Guid.Empty;

			GKManager.ChangeLockControlDevice(door, device);
			Assert.IsTrue(door.LockControlDevice == device);
			Assert.IsTrue(door.LockControlDeviceUID == device.UID);
			Assert.IsTrue(device.Door == door);
			door.LockDevice = null;
			door.LockControlDeviceUID = Guid.Empty;

			GKManager.ChangeLockControlDeviceExit(door, device);
			Assert.IsTrue(door.LockControlDeviceExitUID == device.UID);
			Assert.IsTrue(door.LockControlDeviceExit == device);
			Assert.IsTrue(device.Door == door);
			door.LockDeviceExit = null;
			door.LockControlDeviceExitUID = Guid.Empty;

			GKManager.ChangeLockDevice(door, device);
			Assert.IsTrue(door.LockDevice == device);
			Assert.IsTrue(door.LockDeviceUID == device.UID);
			Assert.IsTrue(device.Door == door);
			door.LockDeviceUID = Guid.Empty;
			door.LockDevice = null;

			GKManager.ChangeLockDeviceExit(door, device);
			Assert.IsTrue(door.LockDeviceExit == device);
			Assert.IsTrue(door.LockDeviceExitUID == device.UID);
			Assert.IsTrue(device.Door == door);
			Assert.IsTrue(door.OpenRegimeLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains( device.UID)));
			Assert.IsTrue(door.CloseRegimeLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));

			GKManager.RemoveDevice(device);
			Assert.IsFalse(mpt.MptLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(mpt.InputDependentElements.Any(x => x.UID ==  device.UID));
			Assert.IsFalse(pump.StartLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(pump.InputDependentElements.Any(x => x.UID == device.UID));
			Assert.IsFalse(mpt.MPTDevices.Any(x => x.DeviceUID == device.UID));
			Assert.IsFalse(pump.NSDevices.Contains(device));
			Assert.IsFalse(door.InputDependentElements.Any(x => x.UID == device.UID));
		}
Exemplo n.º 8
0
		/// <summary>
		/// Изменение логики задержки
		/// </summary>
		/// <param name="delay"></param>
		/// <param name="logic"></param>
		public static void SetDelayLogic(GKDelay delay, GKLogic logic)
		{
			delay.Logic = logic;
			delay.ChangedLogic();
		}
Exemplo n.º 9
0
		public static void SetPumpStationAutomaticOffLogic(GKPumpStation pumpStation, GKLogic newLogic)
		{
			pumpStation.AutomaticOffLogic = newLogic;
			pumpStation.ChangedLogic();
		}
Exemplo n.º 10
0
		public static void SetPumpStationStopLogic(GKPumpStation pumpStation, GKLogic newLogic)
		{
			pumpStation.StopLogic = newLogic;
			pumpStation.ChangedLogic();
		}
Exemplo n.º 11
0
		public void InvalidateOneLogic(GKBase gkBase, GKLogic logic)
		{
			logic.OnClausesGroup = InvalidateOneClauseGroup(gkBase, logic.OnClausesGroup);
			logic.On2ClausesGroup = InvalidateOneClauseGroup(gkBase, logic.On2ClausesGroup);
			logic.OffClausesGroup = InvalidateOneClauseGroup(gkBase, logic.OffClausesGroup);
			logic.StopClausesGroup = InvalidateOneClauseGroup(gkBase, logic.StopClausesGroup);
			logic.OnNowClausesGroup = InvalidateOneClauseGroup(gkBase, logic.OnNowClausesGroup);
			logic.OffNowClausesGroup = InvalidateOneClauseGroup(gkBase, logic.OffNowClausesGroup);
			InvalidateICIndicatorLogic(gkBase, logic.RedIndicatorLogic);
			InvalidateICIndicatorLogic(gkBase, logic.GreenIndicatorLogic);
			InvalidateICIndicatorLogic(gkBase, logic.YellowIndicatorLogic);
		}
Exemplo n.º 12
0
		public void ChangeGroupDeviceWithLogicTest()
		{
			SetMokForNewDeviceViewModel(GKDriverType.RSR2_MDU);
			var devicesViewModel = GroupControllerModule.DevicesViewModel;
			var selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif);
			devicesViewModel.SelectedDevice.AddCommand.Execute();
			GKManager.UpdateConfiguration();
			var delay = new GKDelay();
			var clause = new GKClause
			{
				ClauseOperationType = ClauseOperationType.AllDevices,
				DeviceUIDs = { selectedDevice.Device.Children[0].UID }
			};

			var gkLogic = new GKLogic();
			gkLogic.OnClausesGroup.Clauses.Add(clause);
			GKManager.AddDelay(delay);
			GKManager.SetDelayLogic(delay, gkLogic);
			GKManager.SetDeviceLogic(selectedDevice.Device.Children[0], gkLogic);
			selectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Device == selectedDevice.Device.Children[0]);
			selectedDevice.Driver = RSR2_RM_2_Helper.Create();
			selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif);
			var device = selectedDevice.Device.Children[0];
			Assert.IsTrue(device.DriverType == GKDriverType.RSR2_RM_2);
			Assert.IsTrue(device.Logic.GetObjects().Count == 0);
			Assert.IsTrue(device.InputDependentElements.Count == 0);
			Assert.IsTrue(delay.OutputDependentElements.Count == 0);
			Assert.IsTrue(delay.Logic.GetObjects().Count == 0);
		}
Exemplo n.º 13
0
		public static GKLogic PasteLogic(GKAdvancedLogic targetLogic)
		{
			var gkLogic = new GKLogic();
			if (targetLogic.HasOnClause)
				gkLogic.OnClausesGroup = LogicToCopy.OnClausesGroup;
			if (targetLogic.HasOnNowClause)
				gkLogic.OnNowClausesGroup = LogicToCopy.OnNowClausesGroup;
			if (targetLogic.HasOffClause)
			{
				gkLogic.OffClausesGroup = LogicToCopy.OffClausesGroup;
				gkLogic.UseOffCounterLogic = LogicToCopy.UseOffCounterLogic;
			}
			if (targetLogic.HasOffNowClause)
				gkLogic.OffNowClausesGroup = LogicToCopy.OffNowClausesGroup;
			if (targetLogic.HasStopClause)
				gkLogic.StopClausesGroup = LogicToCopy.StopClausesGroup;
			return gkLogic;
		}
Exemplo n.º 14
0
		GKLogic CreateLogic(GKDevice device)
		{
			var clause = new GKClause() { ClauseOperationType = ClauseOperationType.AnyDevice, StateType = GKStateBit.Fire1 };
			clause.Devices.Add(device);
			clause.DeviceUIDs.Add(device.UID);
			var clauseGroup = new GKClauseGroup();
			clauseGroup.Clauses.Add(clause);
			var logic = new GKLogic();
			logic.OnClausesGroup = clauseGroup;
			return logic;
		}
Exemplo n.º 15
0
		public void RemoveDeviceTestLogicForDelayAndDirection()
		{
			var device = AddDevice(kauDevice11, GKDriverType.RSR2_MDU);
			GKManager.UpdateConfiguration();

			var clause = new GKClause
			{
				ClauseOperationType = ClauseOperationType.AllDevices,
				DeviceUIDs = { device.UID }
			};

			var gkLogic = new GKLogic();
			gkLogic.OnClausesGroup.Clauses.Add(clause);

			GKManager.SetDeviceLogic(device, gkLogic);
			Assert.IsTrue(device.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(device.OutputDependentElements.Any(x => x.UID == device.UID));
			Assert.IsFalse(device.InputDependentElements.Any(x => x.UID == device.UID));

			var delay = new GKDelay();
			GKManager.AddDelay(delay);
			GKManager.SetDelayLogic(delay, gkLogic);
			Assert.IsTrue(delay.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsTrue(device.OutputDependentElements.Any(x => x.UID == delay.UID));
			Assert.IsTrue(delay.InputDependentElements.Any(x => x.UID == device.UID));

			var direction = new GKDirection();
			GKManager.AddDirection(direction);
			GKManager.SetDirectionLogic(direction,gkLogic);
			Assert.IsTrue(direction.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Any()));
			Assert.IsTrue(device.OutputDependentElements.Any(x => x.UID == direction.UID));
			Assert.IsTrue(direction.InputDependentElements.Any(x => x.UID == device.UID));

			GKManager.RemoveDevice(device);
			Assert.IsFalse(delay.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(direction.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(delay.InputDependentElements.Any(x => x.UID == device.UID));
			Assert.IsFalse(direction.InputDependentElements.Any(x => x.UID == device.UID));

		}
Exemplo n.º 16
0
		public GKDirection()
		{
			DelayRegime = DelayRegime.On;
			Logic = new GKLogic();
			PlanElementUIDs = new List<Guid>();
		}
Exemplo n.º 17
0
		public static void SetDeviceLogic(GKDevice device, GKLogic logic, bool isNs = false)
		{
			if (isNs)
				device.NSLogic = logic;
			else
				device.Logic = logic;

			device.ChangedLogic();
			device.OnChanged();
		}
Exemplo n.º 18
0
		/// <summary>
		/// Изменение логики направления
		/// </summary>
		/// <param name="direction"></param>
		/// <param name="logic"></param>
		public static void SetDirectionLogic(GKDirection direction, GKLogic logic)
		{
			direction.Logic = logic;
			direction.ChangedLogic();
		}
Exemplo n.º 19
0
		public GKDelay()
		{
			Logic = new GKLogic();
			DelayRegime = DelayRegime.On;
			PlanElementUIDs = new List<Guid>();
		}
Exemplo n.º 20
0
		public static string GetPresentationLogic(GKLogic logic)
		{
			var list = new List<StringBuilder>();
			AppendClauseGroupString(logic.OnClausesGroup, "Условие включения", list);
			AppendClauseGroupString(logic.On2ClausesGroup, "Условие включения 2", list);
			AppendClauseGroupString(logic.OnNowClausesGroup, "Условие включения немедленно", list);
			AppendClauseGroupString(logic.OffClausesGroup, "Условие выключения", list);
			AppendClauseGroupString(logic.OffNowClausesGroup, "Условие выключения немедленно", list);
			AppendClauseGroupString(logic.StopClausesGroup, "Условие остановки", list);
			AppendICIndicatorLogic(logic.RedIndicatorLogic, "Красный индикатор", list);
			AppendICIndicatorLogic(logic.YellowIndicatorLogic, "Жёлтый индикатор", list);
			AppendICIndicatorLogic(logic.GreenIndicatorLogic, "Зелёный индикатор", list);
			return string.Join("\n", list);
		}
Exemplo n.º 21
0
		public static void SetMPTLogic(GKMPT MPT, GKLogic logic)
		{
			MPT.MptLogic = logic;
			MPT.ChangedLogic();
		}
Exemplo n.º 22
0
		public static void CopyLogic(GKLogic sourceLogic, bool hasOnClause = false, bool hasOnNowClause = false, bool hasOffClause = false, bool hasOffNowClause = false, bool hasStopClause = false)
		{
			LogicToCopy = new GKAdvancedLogic(hasOnClause, hasOnNowClause, hasOffClause, hasOffNowClause, hasStopClause);
			if (hasOnClause)
				LogicToCopy.OnClausesGroup = sourceLogic.OnClausesGroup.Clone();
			if (hasOnNowClause)
				LogicToCopy.OnNowClausesGroup = sourceLogic.OnNowClausesGroup.Clone();
			if (hasOffClause)
			{
				LogicToCopy.OffClausesGroup = sourceLogic.OffClausesGroup.Clone();
				LogicToCopy.UseOffCounterLogic = sourceLogic.UseOffCounterLogic;
			}
			if (hasOffNowClause)
				LogicToCopy.OffNowClausesGroup = sourceLogic.OffNowClausesGroup.Clone();
			if (hasStopClause)
				LogicToCopy.StopClausesGroup = sourceLogic.StopClausesGroup.Clone();
			LogicToCopy.UseOffCounterLogic = sourceLogic.UseOffCounterLogic;
		}
Exemplo n.º 23
0
		public static void SetDoorCloseRegimeLogic(GKDoor door, GKLogic newLogic)
		{
			door.CloseRegimeLogic = newLogic;
			door.ChangedLogic();
		}