//taking the value of stationScheme list, checking type and creating instance of current type of the component public void CreatePumpStationComponentsByScheme(StationScheme stationScheme) { foreach (var schemeComponent in stationScheme.stationChemeComponents) { string[] s1 = schemeComponent.Key.ToString().Split('_'); if (schemeComponent.Key.Equals(StationComponentTypeEnum.Насос_основной)) { Pump stationPump = mainPump; StationComponentInitialize(stationPump, stationScheme); stationComponents.Add(stationPump); } else if (schemeComponent.Equals(StationComponentTypeEnum.Насос_жокей)) { Pump stationJockeyPump = jockeyPump; StationComponentInitialize(stationJockeyPump, stationScheme); stationComponents.Add(stationJockeyPump); } #region UnEqualsFittings else if (s1[0].Equals("КЭ") || s1[0].Equals("КЭР") || s1[0].Equals("КК") || s1[0].Equals("ККР") || s1[0].Equals("ТВ") || s1[0].Equals("ТН") || s1[0].Equals("КВ") || s1[0].Equals("КН")) { UnequalFittings unequalFitting = new UnequalFittings(this, schemeComponent.Key); StationComponentInitialize(unequalFitting, stationScheme); stationComponents.Add(unequalFitting); } #endregion #region EqualsFittings else if (s1[0].Equals("К") || s1[0].Equals("КР") || s1[0].Equals("ЗД") || s1[0].Equals("ОКФ") || s1[0].Equals("ОКР") || s1[0].Equals("РК") || s1[0].Equals("Американка") || s1[0].Equals("НиппельВнВн") || s1[0].Equals("НиппельВнН") || s1[0].Equals("НиппельНН") || s1[0].Equals("КВЖ") || s1[0].Equals("КНЖ") || s1[0].Equals("ФланецСРеле") || s1[0].Equals("ФланцевыйПереход")) { Fittings fitting = new Fittings(this, schemeComponent.Key); StationComponentInitialize(fitting, stationScheme); stationComponents.Add(fitting); } #endregion else if (schemeComponent.Key.Equals(StationComponentTypeEnum.ама_)) { Frame frame = new Frame(this, StationComponentTypeEnum.ама_); StationComponentInitialize(frame, stationScheme); stationComponents.Add(frame); } else if (schemeComponent.Key.Equals(StationComponentTypeEnum.ШУ_)) { ControlCabinet controlCabinet = new ControlCabinet(this, StationComponentTypeEnum.ШУ_, "ШУ_" + ControlCabinetSize); StationComponentInitialize(controlCabinet, stationScheme); stationComponents.Add(controlCabinet); } } }
public void StationComponentInitialize(StationComponent stationComponent, StationScheme stationScheme) { foreach (var schemeComponent in stationScheme.stationChemeComponents) { if (stationComponent.ComponentType.Equals(schemeComponent.Key) && schemeComponent.Value.Item3.Length > 0) { stationComponent.RotationComponentArray = schemeComponent.Value.Item3; stationComponent.IsComponentForPressureLine = schemeComponent.Value.Item4; } else if (stationComponent.ComponentType.Equals(schemeComponent.Key)) { stationComponent.RotationComponentArray = new int[] { 1, 0, 0, 0, 1, 0, 0, 0, 1 }; stationComponent.IsComponentForPressureLine = schemeComponent.Value.Item4; } } }
public PumpStation(ComponentsLocationPaths _componentsLocation, Pump _mainPump, Pump _jockeyPump, string _controlCabinetName, bool _isAutoCalculationDiameterConnection, int _pumpsCount, double _waterConsumption, int _dnSuctionCollector, int _dnPressureCollector, double _pressureValueForStation, CollectorsMaterialEnum _collectorMaterial, StationScheme _stationScheme) { stationComponents = new List <StationComponent>(); StationScheme = _stationScheme; componentsLocation = _componentsLocation; mainPump = _mainPump; jockeyPump = _jockeyPump; ControlCabinetSize = _controlCabinetName; IsAutoCalculationDiameterConnection = _isAutoCalculationDiameterConnection; PumpsCount = _pumpsCount; WaterConsumption = _waterConsumption; DnSuctionCollector = _dnSuctionCollector; DnPressureCollector = _dnPressureCollector; PressureValueForStation = _pressureValueForStation; CollectorMaterial = _collectorMaterial; SecondaryLineDn = GetSecondaryLineDn(DnSuctionCollector); DistanceBetweenAxis = ComponentsValCalculator.GetDistanceBetweenPumpsAxis(mainPump.PumpsWidth); CreatePumpStationComponentsByScheme(StationScheme); }