Exemplo n.º 1
0
        public static void Main()
        {
            EventSimulator simulator = new EventSimulator();

            simulator.Run();
            simulator.Exit();
        }
Exemplo n.º 2
0
        //SimpleServiceClient client;

        public void Start()
        {
            // Initialize the binding
            string          guid    = "urn:uuid:18571766-87df-06e2-bb68-5136c48f483a";
            ProtocolVersion version = new ProtocolVersion10();

            Device.Initialize(new WS2007HttpBinding(new HttpTransportBindingConfig(guid, 8084)), version);

            // Set device information
            Device.ThisModel.Manufacturer    = "Microsoft Corporation";
            Device.ThisModel.ManufacturerUrl = "http://www.microsoft.com/";
            Device.ThisModel.ModelName       = "SimpleService Test Device";
            Device.ThisModel.ModelNumber     = "1.0";
            Device.ThisModel.ModelUrl        = "http://www.microsoft.com/";
            Device.ThisModel.PresentationUrl = "http://www.microsoft.com/";

            Device.ThisDevice.FriendlyName    = "SimpleService";
            Device.ThisDevice.FirmwareVersion = "alpha";
            Device.ThisDevice.SerialNumber    = "12345678";

            // Add a Host service type
            Device.Host = new SimpleDeviceHost();

            // Add Dpws hosted service(s) to the device
            Device.HostedServices.Add(new SimpleService(new SimpleServiceImplementation()));
            EventingService eventingService = new EventingService();

            Device.HostedServices.Add(eventingService);
            Device.HostedServices.Add(new AttachmentService(new AttachmentServiceImplementation()));

            // Add a Dpws client to this device. Uncomment to run a client and device
            //client = new SimpleServiceClient();

            // Set this device property if you want to ignore this clients request
            Device.IgnoreLocalClientRequest = false;

            // Turn console messages on
            Console.Verbose = true;

            System.Ext.Console.Write("Start DPWS device service with endpoint address: '" + Device.EndpointAddress + "'");

            // Start the device
            ServerBindingContext ctx = new ServerBindingContext(version);

            Device.Start(ctx);

            //TEST RESTART CAPABILITY
            //Thread.Sleep(3000);
            //Device.Stop();
            //Thread.Sleep(100);
            //Device.Start(ctx);

            // Events cause WsFaultExceptions if loopback messages are used.
            if (Device.IgnoreLocalClientRequest)
            {
                // Create and start EventSimulator
                EventSimulator eventSimulator = new EventSimulator(eventingService);
                eventSimulator.StartEventSimulator();
            }
        }
Exemplo n.º 3
0
        public void WriteToCSVTest()
        {
            double paramLambda = 4;

            double[] roValues = new double[] { 0.25, 0.5, 0.75 };
            string   output   = "";

            foreach (double ro in roValues)
            {
                double paramMi = paramLambda / ro;

                var queueSystem = new Mm1QueueSystem(paramMi, paramLambda);
                var simulator   = new EventSimulator(queueSystem);
                simulator.RunSim();

                output += $"Wartości_dla_Ro_{ro}. Oczekiwane_p0_{1 - ro}\n";
                output += string.Join("\n", simulator.P0Points.Select(point => $"{point.X} {point.Y}"));
                output += "\n\n";
            }



            string path = @"C:\Users\Krzysztof Krupiński\Desktop\data.txt";

            using (var file = new System.IO.StreamWriter(path))
            {
                file.Write(output);
            }


            Console.WriteLine(output);
        }
Exemplo n.º 4
0
        public void EventSimulatorTest_Get_EN()
        {
            var events = new List <QEvent>
            {
                new QEvent {
                    Type = QEventType.Arrival, Time = 1
                },
                new QEvent {
                    Type = QEventType.Arrival, Time = 2
                },
                new QEvent {
                    Type = QEventType.Leave, Time = 3
                },
                new QEvent {
                    Type = QEventType.Arrival, Time = 4
                },
                new QEvent {
                    Type = QEventType.Arrival, Time = 5
                },
                new QEvent {
                    Type = QEventType.Leave, Time = 6
                },
                new QEvent {
                    Type = QEventType.Arrival, Time = 7
                }
            };

            var simulator = new EventSimulator(new Mm1QueueSystem(1, 1));

            simulator.EventPool.AddOldEvents(events);

            double wanted = 11.0 / 6.0;

            Assert.AreEqual(wanted, simulator.EN);
        }
Exemplo n.º 5
0
        public void ServiceStepTest()
        {
            double[] roValues    = new double[] { 0.25, 0.5, 0.75 };
            double   paramLambda = 4;

            foreach (double ro in roValues)
            {
                double paramMi = paramLambda / ro;

                var queueSystem = new Mm1Continuous(paramMi, paramLambda);
                var simulator   = new EventSimulator(queueSystem);
                simulator.RunSim();
                Console.WriteLine($"Ro: {ro}, P: " + simulator.QueueSystem.TimeStats.ImgClientServicedProbability);
            }
        }
Exemplo n.º 6
0
        public void ChartTest()
        {
            double[] roValues    = new double[] { 0.25, 0.5, 0.75 };
            double   paramLambda = 4;
            double   ro          = 0.25;

            double paramMi = paramLambda / ro;

            var queueSystem = new Mm1QueueSystem(paramMi, paramLambda);
            var simulator   = new EventSimulator(queueSystem);

            simulator.RunSim();

            var chartMaker = new ChartMaker();

            chartMaker.SetData(simulator.P0Points);
            chartMaker.Show();
        }
Exemplo n.º 7
0
 public static void Init(int seed)
 {
     StaticRandom.Init(seed);
     des     = new EventSimulator <EventQueue>();
     parties = new Dictionary <int, Party>();
 }
Exemplo n.º 8
0
 public DkmsNetwork(EventSimulator s, int seed)
     : base(s, seed)
 {
 }
Exemplo n.º 9
0
 public MaskzNetwork(EventSimulator s, int seed)
     : base(s, seed)
 {
 }
Exemplo n.º 10
0
 public MaskzNetwork(EventSimulator s, int seed)
     : base(s, seed)
 {
 }
Exemplo n.º 11
0
 public static void Init(int seed)
 {
     StaticRandom.Init(seed);
     des = new EventSimulator<EventQueue>();
     parties = new Dictionary<int, Party>();
 }
Exemplo n.º 12
0
 public QuorumSystem(EventSimulator s, int seed)
     : base(s, seed)
 {
 }