Está en la página 1de 18

Instituto Tecnológico Superior De Pánuco

Carrera:
Ingeniería En Sistemas Computacionales

Materia:
Simulación

Docente:
Gil Santana Esparza

Alumno:
Victor Daniel Vicencio Morato
Fecha:

15/01/2021

Introducción:
En el presente trabajo se enfocara en como es que trabaja un cajero automático
proceso a proceso que pasa desde que un cliente llega a formarse a una fila para
hacer cualquier transacción y se va, y para esto usaremos una herramienta muy
importante que es la simulación que se puede hacer en algunos procesos, esto
para saber con exactitud que es lo que pasa dentro de esos procesos y que
pudiera presentarse para poder mejorar esos procesos en los que estamos
enfocando la simulación, como sabemos la Simulación permite predecir el
comportamiento de los sistemas logístico/productivos bajo diversas situaciones
reales o previsibles (o lo que es lo mismo, situaciones simuladas). Imaginemos
diversos escenarios como roturas de stock, huelgas de transporte que nos impiden
el abastecimiento de materias primas por unos días, etc. Desde la Simulación,
podemos contemplar toda esta casuística o escenarios, proyectando como va a
reaccionar nuestra capacidad productiva frente a estas situaciones anómalas
(elaboración de Planes de Contingencia).

Objetivo:

Simular los distintos procesos que se llevan a cabo cuando una persona hace
cualquier transacción a un cajero automático.

Calendario de actividades:

Análisis 2 hr

Diseño 3-4 hr

codificación 6-7 hr

Pruebas 3 hr

Recursos:

 Laptop Dell Latitude E7470, 16gb Memoria ram, 64 bits


 Entorno de desarrollo NetBeans
 Calculadora CASIO
 Internet para documentarme

Redacción/desarrollo:

Análisis:
En el análisis se desarrollará un programa que sea capaz de simular los procesos
que se llevan a cabo en un cajero automático. La simulación se enfocara desde
que una persona llega a formarse a la fila de un para ingresar el cajero, el
simulador se encargara de simular el tiempo que se lleva en llegar una persona a
otra el tiempo que tardara en hacer cualquier transacción, ingresándole el número
de clientes que pueden llegar al cajero e un día normal y el simulador será capaz
de darnos un promedio de espera entre cada cliente y obtener los resultados que
deseamos.

Diseño:
Codificación:
package cajerooxxo;
import javax.swing.table.DefaultTableModel;

public class Interfaz extends javax.swing.JFrame {


/**
* Creates new form Interfaz
*/
DefaultTableModel MiTabla;
String[] Titulos= {"Cliente", "Llegada cliente","Rp","Pn","Inicio servicio",
"Tiempo espera", "Rq", "qn", "Tiempo salida"};
String[][] Datos = {};

public Interfaz() {
initComponents();
MiTabla =new DefaultTableModel(Datos,Titulos);
Tabla.setModel(MiTabla);
}

/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
always
* regenerated by the Form Editor.
*/

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jPanel1 = new javax.swing.JPanel();


jLabel1 = new javax.swing.JLabel();
txttiempollegadas = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txtserv1 = new javax.swing.JTextField();
txtserv2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtclientes = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtpromedio = new javax.swing.JTextField();
btncalcular = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
Tabla = new javax.swing.JTable();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 204, 51));

jPanel1.setBackground(new java.awt.Color(255, 204, 51));

jLabel1.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N


jLabel1.setText("Tiempo entre llegadas:");

jLabel2.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N


jLabel2.setText("Tiempo de servicio:");

jLabel3.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N


jLabel3.setText("No. Clientes:");

txtclientes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtclientesActionPerformed(evt);
}
});

jLabel4.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N


jLabel4.setText("Promedio espera:");

btncalcular.setText("Calcular");
btncalcular.setName(""); // NOI18N
btncalcular.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btncalcularActionPerformed(evt);
}
});

jLabel5.setFont(new java.awt.Font("Arial Black", 0, 24)); // NOI18N


jLabel5.setForeground(new java.awt.Color(255, 51, 0));
jLabel5.setText("CADENA COMERCIAL OXXO (CAJA)");

javax.swing.GroupLayout jPanel1Layout = new


javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(107, 107, 107)
.addComponent(jLabel5,
javax.swing.GroupLayout.PREFERRED_SIZE, 523,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(txttiempollegadas,
javax.swing.GroupLayout.PREFERRED_SIZE, 109,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41)
.addComponent(jLabel2))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(txtpromedio,
javax.swing.GroupLayout.PREFERRED_SIZE, 183,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(229, 229, 229)
.addComponent(btncalcular))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(txtserv1,
javax.swing.GroupLayout.PREFERRED_SIZE, 59,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELAT
ED)
.addComponent(txtserv2,
javax.swing.GroupLayout.PREFERRED_SIZE, 62,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(55, 55, 55)
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(txtclientes,
javax.swing.GroupLayout.PREFERRED_SIZE, 62,
javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(151, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5,
javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.BASELINE)
.addComponent(jLabel1)
.addComponent(txttiempollegadas,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(txtserv1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtserv2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(txtclientes,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtpromedio,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btncalcular))
.addContainerGap(51, Short.MAX_VALUE))
);

Tabla.setBackground(new java.awt.Color(255, 204, 51));


Tabla.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(Tabla);

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(jPanel1,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1))
.addContainerGap())
);
layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 237,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(91, Short.MAX_VALUE))
);

pack();
}// </editor-fold>

private void txtclientesActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
}

int c, i=0, t;

double s1, s2, st ,tlc;


double []Rp={0.7548, 0.9691, 0.7038, 0.6062, 0.8165, 0.2537, 0.3745, 0.417,
0.6782, 0.7218, 0.4106, 0.5027, 0.3271, 0.511, 0.6412, 0.443, 0.282, 0.1058,
0.7144, 0.2829, 0.5785, 0.5232, 0.8796, 0.2963, 0.5541, 0.3711, 0.996, 0.7233,
0.726, 0.6695};
double []Rq={0.7713, 0.6634, 0.3295, 0.9973, 0.6733, 0.18, 0.5124, 0.619,
0.9728, 0.395, 0.6672, 0.23, 0.6956, 0.2606, 0.3602, 0.4464, 0.5887, 0.9231,
0.8383, 0.1221, 0.9705, 0.9554, 0.5013, 0.6495, 0.4963, 0.5582, 0.2925, 0.2837,
0.1333, 0.5796};
double Pn, inc, tesp , Qn, tsal, tsalp, suma, prom;

private void btncalcularActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
c=Integer.parseInt(txtclientes.getText());
t=Integer.parseInt(txttiempollegadas.getText());
s1=Double.parseDouble(txtserv1.getText());
s2=Double.parseDouble(txtserv2.getText());

String[] filas=new String[9];


st=s1 + s2;
Pn=-((Math.abs(t))*(Math.log(Rp[i])));
inc=inc;
tesp= tesp;
Qn=Math.abs(s1)+(Math.abs(s2)*Rq[i]);
tsal=tesp+Qn;
i++;
Object[] fila1={i, tlc, Rp[i], Pn, inc, tesp, Rq[i], Qn, tsal};
MiTabla.addRow(fila1);
tsalp=tsal;
suma=suma+tesp;

/*Resto de filas*/
do{
tlc=tlc + Pn;
Pn=-((Math.abs(t))*(Math.log(Rp[i])));

if(tsalp<tlc){
inc=tlc;
}else{
inc=tsalp;
}
if((inc-tlc)<0){
tesp=0;
}else{
tesp=inc-tlc;
}

Qn = Math.abs(s1)+(Math.abs(s2)*Rq[i]);
tsal=inc+Qn;
i++;
Object[] fila2 = {i, tlc, Rp[i], Pn, inc, tesp, Rq[i], Qn, tsal};
MiTabla.addRow(fila2);
tsalp=tsal;
suma=suma+tesp;
}while(i<c);

prom=suma/c;
txtpromedio.setText(txtpromedio.getText().toString() + prom);
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting
code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Interfaz.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Interfaz.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Interfaz.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Interfaz.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Interfaz().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JTable Tabla;
private javax.swing.JButton btncalcular;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField txtclientes;
private javax.swing.JTextField txtpromedio;
private javax.swing.JTextField txtserv1;
private javax.swing.JTextField txtserv2;
private javax.swing.JTextField txttiempollegadas;
// End of variables declaration
}
Pruebas:
Conclusiones:
Como conclusión se simulo cada proceso que se genera en un cajero automático
y se llego a posibles tiempos que se pueden generar cuando una persona realiza
cualquier proceso en un cajero automático esto con el fin de conocer los posibles
tiempos que se lleva un cliente de otro para realizar cada proceso que se lleva
acabo.

También podría gustarte