private void ClearFloorsHandle()
 {
     try
     {
         Floors.Clear();
         CurrentFloor.ID = 1;
         OnPropertyChanged("CurrentFloor");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
     }
 }
Example #2
0
 public void Clear()
 {
     if (Floors != null)
     {
         for (int i = 0; i < Floors.Count; ++i)
         {
             Floors[i].Clear();
         }
         Floors.Clear();
     }
     if (Walls != null)
     {
         for (int i = 0; i < Walls.Count; ++i)
         {
             Walls[i].Clear();
         }
         Walls.Clear();
     }
     if (bottomEdge != null)
     {
         bottomEdge.Clear();
         bottomEdge = null;
     }
     if (topEdge != null)
     {
         topEdge.Clear();
         topEdge = null;
     }
     if (leftEdge != null)
     {
         leftEdge.Clear();
         leftEdge = null;
     }
     if (rightEdge != null)
     {
         rightEdge.Clear();
         rightEdge = null;
     }
     if (linesParent == null)
     {
         linesParent = transform.Find("Lines").gameObject;
     }
     for (int i = linesParent.transform.childCount - 1; i >= 0; --i)
     {
         DestroyImmediate(linesParent.transform.GetChild(i).gameObject);
     }
 }
Example #3
0
        public void Script()
        {
            Temperature = 20;
            Room r1, r2, r3, r4, r5, r6, r7;

            r1 = new Room("Тамбур", new List <Wall>(), 3.2, 1.75, 18);
            r2 = new Room("Хол", new List <Wall>(), 5.7, 0, 18);
            r3 = new Room("Кухня", new List <Wall>(), 7.5, 1.75, 19);
            r4 = new Room("Гостьова", new List <Wall>(), 21.2, 3.5, 20);
            r5 = new Room("Кімната 1", new List <Wall>(), 10.6, 2.5, 20);
            r6 = new Room("Ванна", new List <Wall>(), 4, 0, 20);
            r7 = new Room("Кімната 2", new List <Wall>(), 9.2, 1.8, 20);

            r1.Walls.Add(new Wall(4.5, null));
            r1.Walls.Add(new Wall(4.5, r2));
            r1.Walls.Add(new Wall(2.5, r7));
            r1.Walls.Add(new Wall(2.5, r3));

            r2.Walls.Add(new Wall(4.5, r1));
            r2.Walls.Add(new Wall(7, r3));
            r2.Walls.Add(new Wall(10.9, r4));
            r2.Walls.Add(new Wall(2.6, r5));
            r2.Walls.Add(new Wall(4.7, r6));
            r2.Walls.Add(new Wall(2, r7));

            r3.Walls.Add(new Wall(14.4, null));
            r3.Walls.Add(new Wall(2.5, r1));
            r3.Walls.Add(new Wall(7, r2));

            r4.Walls.Add(new Wall(18, null));
            r4.Walls.Add(new Wall(10.9, r2));
            r4.Walls.Add(new Wall(7.6, r5));

            r5.Walls.Add(new Wall(17.3, null));
            r5.Walls.Add(new Wall(2.6, r2));
            r5.Walls.Add(new Wall(7.6, r4));
            r5.Walls.Add(new Wall(2.5, r6));

            r6.Walls.Add(new Wall(4.7, null));
            r6.Walls.Add(new Wall(4.7, r2));
            r6.Walls.Add(new Wall(7.6, r5));
            r6.Walls.Add(new Wall(7.6, r7));

            r7.Walls.Add(new Wall(16.1, null));
            r7.Walls.Add(new Wall(2.5, r1));
            r7.Walls.Add(new Wall(2, r2));
            r7.Walls.Add(new Wall(7.6, r6));


            Floors.Clear();
            Floors.Add(new Floor("Поверх 1", new List <Room>
            {
                r1, r2, r3, r4, r5, r6, r7
            }));

            r1 = new Room("Хол", new List <Wall>(), 4, 0, 18);
            r2 = new Room("Кімната 3", new List <Wall>(), 9.9, 2.2, 19);
            r3 = new Room("Ванна", new List <Wall>(), 3, 0, 20);
            r4 = new Room("Кімната 4", new List <Wall>(), 9.8, 1.9, 21);

            r1.Walls.Add(new Wall(7.2, r2));
            r1.Walls.Add(new Wall(5.8, r3));
            r1.Walls.Add(new Wall(7.2, r4));

            r2.Walls.Add(new Wall(42.2, null));
            r2.Walls.Add(new Wall(7.2, r1));
            r2.Walls.Add(new Wall(6.2, r3));

            r3.Walls.Add(new Wall(42.2, null));
            r3.Walls.Add(new Wall(7.2, r1));
            r3.Walls.Add(new Wall(6.2, r3));

            r4.Walls.Add(new Wall(5.8, null));
            r4.Walls.Add(new Wall(7.2, r3));
            r4.Walls.Add(new Wall(7.2, r4));

            Floors.Add(new Floor("Поверх 2", new List <Room>
            {
                r1, r2, r3, r4
            }));

            HouseParams.Add(new HouseThermalParam(Constants.OutsideWalls, 7.41, 0.13));
            HouseParams.Add(new HouseThermalParam(Constants.InsideWalls, 0.37, 2.74));
            HouseParams.Add(new HouseThermalParam(Constants.Floor, 2.83, 0.35));
            HouseParams.Add(new HouseThermalParam(Constants.RoofGround, 3.66, 0.27));
            HouseParams.Add(new HouseThermalParam(Constants.Ground, 1.06, 0.94));
            HouseParams.Add(new HouseThermalParam(Constants.Roof, 1.45, 0.69));
            HouseParams.Add(new HouseThermalParam(Constants.Window, 0.24, 4.24));

            Hel = new HydroElectricLoad
            {
                NumberOfBathUsers      = 1,
                NumberOfShowerUsers    = 3,
                TemperatureOfBath      = 45,
                TemperatureOfShower    = 40,
                TemperatureOfOutput    = 60,
                TemperatureOfInput     = 5,
                WaterQuantityForBath   = 100,
                WaterQuantityForShower = 25,
                Time = 5
            };
        }
Example #4
0
 public static void Reset()
 {
     Floors.Clear();
     ChangeFloor(0);
 }
Example #5
0
        // init floors
        public Space Init(bool report)
        {
            Util.kAllPed  = 0;
            Util.kCumPeds = 0;
            //Util.kTimerTick = 0;
            Floors.Clear();
            Util.kId = 0;
            for (int i = 0; i < Util.kFloorNum; i++)
            {
                var floor = new Floor(i);
                //if (i > 0)
                //    Util.InitRandomPed(floor, this);
                Floors.Add(floor);
            }
            if (Util.kFloorNum >= 10)
            {
                Util.kScale = 14.0;
            }
            else
            {
                Util.kScale = 14.0 + (10 - Util.kFloorNum) * 2.0;
            }



            if (Util.kFloorNum > 40)
            {
                Util.kWidth  = 0;
                Util.kHeight = 0;
            }
            else if (Util.kFloorNum > 30)
            {
                Util.kWidth  = 0;
                Util.kHeight = 7.0;
            }
            else if (Util.kFloorNum > 20)
            {
                Util.kWidth  = 0;
                Util.kHeight = 9.0;
            }
            else if (Util.kFloorNum > 10)
            {
                Util.kWidth  = 0;
                Util.kHeight = 15.0;
            }
            else
            {
                Util.kWidth  = (Util.kFloorNum - 10) * 10.0;
                Util.kHeight = 20.0 + (Util.kFloorNum - 10) * 2.0;
            }

            Util.kPedSum = (Util.kInitPedNum) * (Util.kFloorNum - 1);

            if (report)
            {
                // generate file name for this
                GenerateFileName();
            }

            if (reporter != null)
            {
                reporter.Stop();
            }


            if (report)
            {
                reporter = new Reporter(FileName, Util.kFloorNum);
            }
            else
            {
                reporter = null;
            }

            return(this);
        }