Example #1
0
        /***************************************************** TABLA ******************************************************/

        private void generarEventoInicial()
        {
            //Para iniciar la simulacion, generamos el primer evento y calculamos la primer llegada
            actual.evento                = EVENTO_INICIO_DE_SIMULACION;
            actual.tiempoEntreLlegada    = generarTiempoEntreLlegada();
            actual.momentoProximaLlegada = actual.reloj + actual.tiempoEntreLlegada;

            actual.numeroProximaLlegada        = 1;
            actual.tiempoEntreLlegadasPromedio = actual.tiempoEntreLlegada;

            anterior.clonar(actual);
            agregarFila(actual, ref simulacionDiariaDataTable);
        }
Example #2
0
        private void btnIniciarSimulacion_Click(object sender, EventArgs e)
        {
            tomarDatos();

            reiniciarTabla(ref simulacionDiariaDataTable);
            actual   = new VectorEstado();
            anterior = new VectorEstado();

            generarEventoInicial();

            TimeSpan tiempoProximoEvento;
            string   evento = anterior.evento;
            Pedido   pedidoAux;


            while (evento != EVENTO_FIN_DE_SIMULACION)
            {
                actual.productoPedido = "";
                evento = getProximoEvento(out tiempoProximoEvento, out pedidoAux);

                actual.numeroEvento = anterior.numeroEvento + 1;
                actual.reloj        = tiempoProximoEvento;

                if (evento != EVENTO_FIN_DE_SIMULACION)
                {
                    actualizarTiempoLibreServidores();
                }

                verificarPedidosExcedidos();

                switch (evento)
                {
                case EVENTO_LLEGADA_DE_PEDIDO:
                    simularLlegadaDePedido();
                    break;

                case EVENTO_PEDIDO_FINALIZADO:
                    simularPedidoFinalizado(pedidoAux);
                    break;

                case EVENTO_ENTREGA_DE_PEDIDO:
                    simularEntregaDePedido();
                    break;

                case EVENTO_FIN_DE_SIMULACION:
                    actual.evento = evento;
                    actual.reloj  = anterior.reloj;
                    break;

                default:
                    break;
                }

                getPromediosPuntoB();

                // **NOTA: copio los datos de esta manera para trabajar con solo los 2 vectores en memoria y operar con el actual
                anterior.clonar(actual);

                agregarFila(actual, ref simulacionDiariaDataTable);
            }



            mostrarEstadisticas();

            resultados.Add(actual);

            agregarSimulacion(actual);
        }