コード例 #1
0
ファイル: Program.cs プロジェクト: katenovakivska/MSLabs
        static void Main(string[] args)
        {
            //HospitalCreate c = new HospitalCreate(15, "CREATOR", "Exponential");

            //Doctor p0 = new Doctor(5, 8, "DOCTOR", "Exponential", 2);

            ////'''час следования в палату
            ////равномерно от 3 до 8 и следующая 3 это сопровождающие'''
            //HospitalProcess p1 = new HospitalProcess(3, 8, "CHAMBERS", "Exponential", 6);

            ////'''час обслуживания в регестратуре лаборатории
            //// мат.ожидание - 4.5
            ////коэфф. - 3'''
            //HospitalProcess p2 = new HospitalProcess(3, 4.5, "REGISTRATION", "Exponential", 1);

            ////'''час проведения анализа
            ////  мат.ожидание - 4
            //// коэфф. - 2'''
            //Laboratory p3 = new Laboratory(2, 4, "LABORATORY", "Exponential", 2);

            //c.NextElement = p0;
            //p0.NextProcesses = new List<HospitalProcess> { p1, p2 };
            //p2.NextProcesses = new List<HospitalProcess> { p3 };
            //p3.NextProcesses = new List<HospitalProcess> { p0 };

            //List<Element> elementsList = new List<Element> { c, p0, p1, p2, p3 };
            //HospitalModel model = new HospitalModel(elementsList);
            //model.Simulate(1000.0);

            HospitalCreate  c  = new HospitalCreate(10, "CREATOR", "Exponential");
            HospitalProcess p0 = new HospitalProcess(2, 5, "GO TO DOCTOR", "Uniform", 3);
            HospitalProcess p1 = new HospitalProcess(3, 8, "CHAMBERS", "Uniform", 3);
            HospitalProcess d  = new HospitalProcess(3, 8, "EXIT", "Exponential", 3);
            HospitalProcess p2 = new HospitalProcess(3, 4.5, "REGISTRATION", "Erlang", 4);
            Laboratory      p3 = new Laboratory(2, 4, "LABORATORY", "Erlang", 2);
            HospitalProcess p4 = new HospitalProcess(2, 5, "GO TO REGISTRATION", "Exponential", 3);
            Doctor          p5 = new Doctor(2, 5, "DOCTOR", "Uniform", 2);

            c.NextElement   = p0;
            c.PatientsTypes = new List <PatientType> {
                new PatientType(1, 0.5, 1 / 15),
                new PatientType(2, 0.1, 1 / 40),
                new PatientType(3, 0.4, 1 / 30)
            };
            p0.NextProcesses = new List <HospitalProcess> {
                p5
            };
            p5.NextProcesses = new List <HospitalProcess> {
                p1, p4
            };
            p2.NextProcesses = new List <HospitalProcess> {
                p3
            };
            p3.NextProcesses = new List <HospitalProcess> {
                p0, d
            };
            p4.NextProcesses = new List <HospitalProcess> {
                p2
            };

            List <Element> elementsList = new List <Element> {
                c, p0, p1, p2, p3, p4, p5, d
            };
            HospitalModel model = new HospitalModel(elementsList);

            model.Simulate(1000.0);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            HospitalCreate c = new HospitalCreate(15)
            {
                Name         = "CREATOR",
                Distribution = "exp"
            };


            EmergencyRoom emergencyRoom = new EmergencyRoom(15)
            {
                Name         = "EMERGENCY ROOM",
                Distribution = "exp"
            };

            HospitalMassServiceSystem goToChamber = new HospitalMassServiceSystem(3)
            {
                DelayDev     = 8,
                Name         = "GO TO CHAMBER",
                Distribution = "unif",
                NextDespose  = true
            };

            HospitalMassServiceSystem goToRegistration = new HospitalMassServiceSystem(2)
            {
                DelayDev     = 5,
                Name         = "GO TO REGISTRATION",
                Distribution = "unif"
            };

            HospitalMassServiceSystem registration = new HospitalMassServiceSystem(4.5)
            {
                DelayDev     = 3,
                Name         = "REGISTRATION",
                Distribution = "erl"
            };

            Laboratory laboratory = new Laboratory(4)
            {
                DelayDev     = 2,
                Name         = "LABORATORY",
                Distribution = "erl",
                NextDespose  = true
            };

            GoToEmergencyRoom goToEmergencyRoom = new GoToEmergencyRoom(2)
            {
                DelayDev     = 5,
                Name         = "GO TO EMERGENCY ROOM",
                Distribution = "unif"
            };

            //add channels
            emergencyRoom.Channels = new List <HospitalChannel>
            {
                new HospitalChannel
                {
                    Name = "ER Channel 1"
                },
                new HospitalChannel
                {
                    Name = "ER Channel 2"
                }
            };

            goToChamber.Channels = new List <HospitalChannel>
            {
                new HospitalChannel
                {
                    Name = "Chamber Channel 1"
                },
                new HospitalChannel
                {
                    Name = "Chamber Channel 2"
                },
                new HospitalChannel
                {
                    Name = "Chamber Channel 3"
                }
            };

            goToRegistration.Channels = new List <HospitalChannel>
            {
                new HospitalChannel
                {
                    Name = "GoToReg Channel 1"
                },
                new HospitalChannel
                {
                    Name = "GoToReg Channel 2"
                },
                new HospitalChannel
                {
                    Name = "GoToReg Channel 3"
                },
                new HospitalChannel
                {
                    Name = "GoToReg Channel 4"
                },
                new HospitalChannel
                {
                    Name = "GoToReg Channel 5"
                }
            };

            registration.Channels = new List <HospitalChannel>
            {
                new HospitalChannel
                {
                    Name = "Reg Channel 1"
                }
            };

            laboratory.Channels = new List <HospitalChannel>
            {
                new HospitalChannel
                {
                    Name = "Lab Channel 1"
                },
                new HospitalChannel
                {
                    Name = "Lab Channel 2"
                }
            };

            goToEmergencyRoom.Channels = new List <HospitalChannel>
            {
                new HospitalChannel
                {
                    Name = "GoToER Channel 1"
                },
                new HospitalChannel
                {
                    Name = "GoToER Channel 2"
                },
                new HospitalChannel
                {
                    Name = "GoToER Channel 3"
                },
                new HospitalChannel
                {
                    Name = "GoToER Channel 4"
                },
                new HospitalChannel
                {
                    Name = "GoToER Channel 5"
                },
            };

            //add patient types
            c.PatientTypes = new List <PatientType>
            {
                new PatientType
                {
                    Name           = "PatientType2",
                    Frequency      = 0.1,
                    AvRegisterTime = 40
                },
                new PatientType
                {
                    Name           = "PatientType3",
                    Frequency      = 0.4,
                    AvRegisterTime = 30
                },
                new PatientType
                {
                    Name           = "PatientType1",
                    Frequency      = 0.5,
                    AvRegisterTime = 15
                },
            };

            //add relations
            c.NextElement = emergencyRoom;
            emergencyRoom.NextMss.Add(goToChamber);
            emergencyRoom.NextMss.Add(goToRegistration);
            goToRegistration.NextMss.Add(registration);
            registration.NextMss.Add(laboratory);
            laboratory.NextMss.Add(goToEmergencyRoom);
            goToEmergencyRoom.NextMss.Add(emergencyRoom);

            //simulate
            List <Element> list = new List <Element> {
                c, emergencyRoom, goToChamber, goToRegistration, registration, laboratory, goToEmergencyRoom
            };
            HospitalModel model = new HospitalModel(list);

            model.Simulate(1000.0);
        }