private void inicializarSimulacion() { /*RELOJ DE LA SIMULACION*/ _reloj = 0.0; /*VARIABLES DE ESTADO*/ this.Servidor = new Servidor(); this.Cola = new Cola(); TUE = 0.0; this.clientesAtendidosEnSistema.Clear(); this.catEventos.LEV.Clear(); /*CONTADORES ESTADISTICOS*/ this.acumuladorDemoras = 0; /*Generamos tiempo de arribo, y luego lo guardamos en la LEV*/ Arribo arribo = new Arribo(reloj); this.catEventos.LEV.Add(arribo); Partida partida = new Partida(reloj); partida.SetTiempoServicioInfinito(); catEventos.LEV.Add(partida); }
} //Fin rutina partida private void rutinaArribo() { //checkeamos que el servidor este desocupado. cliente = new Cliente(); cliente.arribo = (Arribo)this.eventoActual; if (this.Servidor.estaOcupado()) { //al estar ocupado el servidor, se agrega el cliente a la cola. //establecemos el TA, para luego saber cuanto tarda el cliente en llegar+ser atendido this.cliente.setTiempoArriboPorServidorOcupado(reloj); Cola.calcularArea(reloj, TUE); Cola.AgregarCliente(cliente); cliente = null; } else /*el servidor desocupado implica un retraso de cero para el cliente.*/ /*ahora incrementamos el nro de clientes retrazados, y hacemos el server ocupado*/ { servidor.TiempoInicioOcupacionServidor = reloj; Servidor.servirCliente(cliente); cliente = null; //ahora creamos evento partida, con un tiempode servicio. //el constructor ya setea el tiempo de servicio Partida partida = new Partida(reloj); this.catEventos.guardarEvento(partida); } //generamos un nuevo arribo //el constructor ya setea el tiempo de arribo Arribo proximoArribo = new Arribo(reloj); this.catEventos.guardarEvento(proximoArribo); }
public Cliente() { TiempoArriboServidorOcupado = 0.0; arribo= new Arribo(0); }
public Cliente() { TiempoArriboServidorOcupado = 0.0; arribo = new Arribo(0); }
private void rutinaArribo() { //checkeamos que el servidor este desocupado. cliente = new Cliente(); cliente.arribo = (Arribo)this.eventoActual; if(this.Servidor.estaOcupado() ) { //al estar ocupado el servidor, se agrega el cliente a la cola. //establecemos el TA, para luego saber cuanto tarda el cliente en llegar+ser atendido this.cliente.setTiempoArriboPorServidorOcupado(reloj); Cola.calcularArea(reloj,TUE ); Cola.AgregarCliente(cliente); cliente = null; } else /*el servidor desocupado implica un retraso de cero para el cliente.*/ /*ahora incrementamos el nro de clientes retrazados, y hacemos el server ocupado*/ { servidor.TiempoInicioOcupacionServidor = reloj; Servidor.servirCliente(cliente); cliente = null; //ahora creamos evento partida, con un tiempode servicio. //el constructor ya setea el tiempo de servicio Partida partida = new Partida(reloj ); this.catEventos.guardarEvento(partida); } //generamos un nuevo arribo //el constructor ya setea el tiempo de arribo Arribo proximoArribo = new Arribo(reloj); this.catEventos.guardarEvento(proximoArribo); }