示例#1
0
		public KauDatabase(GKDevice kauDevice)
		{
			DatabaseType = kauDevice.DriverType == GKDriverType.GKMirror ? DatabaseType.Mirror : DatabaseType.Kau;
			RootDevice = kauDevice;

			AddChild(RootDevice);
			Devices.ForEach(x => x.KauDatabaseParent = RootDevice);

			GlobalPim = new GKPim { Name = "Автоматика" + "(" + kauDevice.PresentationName + ")", IsGlobalPim = true };
			GlobalPim.DeviceUid = kauDevice.UID;
			GlobalPimDescriptor = new PimDescriptor(GlobalPim);
		}
示例#2
0
		public GkDatabase(GKDevice gkControllerDevice)
		{
			KauDatabases = new List<KauDatabase>();
			DatabaseType = DatabaseType.Gk;
			RootDevice = gkControllerDevice;

			AddDevice(gkControllerDevice);
			gkControllerDevice.AllChildren.FindAll(x => (x.DriverType == GKDriverType.GKIndicator || x.DriverType == GKDriverType.GKRele) && x.AllParents.All(y => y.DriverType != GKDriverType.GKMirror)).ForEach(AddDevice);
			Devices.ForEach(x => x.GkDatabaseParent = RootDevice);

			GlobalPim = new GKPim { Name = "Автоматика" + "(" + gkControllerDevice.PresentationName + ")", IsGlobalPim = true };
			GlobalPim.DeviceUid = gkControllerDevice.UID;
			GlobalPimDescriptor = new PimDescriptor(GlobalPim);
		}
示例#3
0
		void CreatePim()
		{
			PumpStation.Pim.IsLogicOnKau = PumpStation.IsLogicOnKau;
			var pimDescriptor = new PimDescriptor(PumpStation.Pim);
			Database.Descriptors.Add(pimDescriptor);

			pimDescriptor.Formula = new FormulaBuilder();
			var inputDevices = new List<GKBase>(PumpStation.StartLogic.GetObjects().Where(x => x is GKDevice));
			inputDevices.AddRange(PumpStation.StopLogic.GetObjects().Where(x => x is GKDevice));
			inputDevices.AddRange(PumpStation.AutomaticOffLogic.GetObjects().Where(x => x is GKDevice));
			inputDevices.AddRange(PumpStation.NSDevices);
			foreach (var inputDevice in inputDevices)
			{
				PumpStation.Pim.LinkToDescriptor(inputDevice);
			}
			for (int i = 0; i < inputDevices.Count; i++)
			{
				var nsDevice = inputDevices[i];
				pimDescriptor.Formula.AddGetBit(GKStateBit.Failure, nsDevice);
				if (i > 0)
				{
					pimDescriptor.Formula.Add(FormulaOperationType.OR);
				}
			}
			if (inputDevices.Count > 0)
				pimDescriptor.Formula.AddPutBit(GKStateBit.Failure, PumpStation.Pim);

			pimDescriptor.Formula.Add(FormulaOperationType.END);
			pimDescriptor.IsFormulaGeneratedOutside = true;
		}
示例#4
0
		void CreatePim()
		{
			Pim = new XPim()
			{
				Name = PumpStation.PresentationName
			};
			Pim.UID = GuidHelper.CreateOn(PumpStation.UID);
			GkDatabase.AddPim(Pim);
			var pimDescriptor = new PimDescriptor(Pim);
			GkDatabase.Descriptors.Add(pimDescriptor);

			var formula = new FormulaBuilder();

			var inputDevices = new List<XBase>();
			inputDevices.AddRange(PumpStation.InputDevices);
			foreach (var nsDevice in PumpStation.NSDevices)
			{
				if (!inputDevices.Contains(nsDevice))
					inputDevices.Add(nsDevice);
			}
			foreach (var inputDevice in inputDevices)
			{
				UpdateConfigurationHelper.LinkXBases(Pim, inputDevice);
			}
			for (int i = 0; i < inputDevices.Count; i++)
			{
				var nsDevice = inputDevices[i];
				formula.AddGetBit(XStateBit.Failure, nsDevice);
				if (i > 0)
				{
					formula.Add(FormulaOperationType.OR);
				}
			}
			formula.AddPutBit(XStateBit.Failure, Pim);

			formula.Add(FormulaOperationType.END);
			pimDescriptor.Formula = formula;
			pimDescriptor.FormulaBytes = formula.GetBytes();
		}