-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
87 lines (68 loc) · 2.33 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//var queue = new QueueSimulator();
var init = function()
{
//Start the policy selection menu with JQuery
$(document).ready(function() {
// $("#loading-bar").hide();
loadingBar.style.display = 'none';
$('select').material_select();
$('.collapsible').collapsible();
});
}
init();
var updateMetricsView = function(){
$('#avg-system-time' ).html( (metrics.T || 0).toFixed(3) );
$('#avg-system-time-1' ).html( (metrics.T1 || 0).toFixed(3) );
$('#avg-system-time-2' ).html( (metrics.T2 || 0).toFixed(3) );
$('#avg-wait-time' ).html( (metrics.W || 0).toFixed(3) );
$('#avg-wait-time-1' ).html( (metrics.W1 || 0).toFixed(3) );
$('#avg-wait-time-2' ).html( (metrics.W2 || 0).toFixed(3) );
$('#avg-residual-time' ).html( (metrics.Xr || 0).toFixed(3) );
$('#avg-residual-time-1').html( (metrics.Xr1 || 0).toFixed(3) );
$('#avg-residual-time-2').html( (metrics.Xr2 || 0).toFixed(3) );
$('#avg-service' ).html( (metrics.X || 0).toFixed(3) );
$('#avg-service-1' ).html( (metrics.X1 || 0).toFixed(3) );
$('#avg-service-2' ).html( (metrics.X2 || 0).toFixed(3) );
$('#avg-pending-service').html( (metrics.U || 0).toFixed(3) );
$('#avg-busy-time' ).html( (metrics.B || 0).toFixed(3) );
$('#avg-clients-queue' ).html( (metrics.N || 0).toFixed(3) );
}
const startButton = document.querySelector('#start-button');
var startWithPolicy = function(value)
{
switch(value){
case 1:
startScenario1();
break;
case 2:
startScenario2();
default:
break;
}
}
startButton.onclick = function() {
resetChart();
resetSimulator();
simulationTime = eval($('#total-time').val());
LAMBDA1 = eval($('#lambda-1').val());
LAMBDA2 = eval($('#lambda-2').val());
MU1 = eval($('#mu-1').val());
MU2 = eval($('#mu-2').val());
animSpeed = eval($('#sim-speed').val());
simAnimation = $('#sim-animation').prop('checked');
chartLimit = $('#chart-limit').prop('checked');
useChart = $('#use-chart').prop('checked');
policy = eval($('#policy-select').val());
// codigo para rodar a simulação 100x e calcular a média das métricas e intervalo de confiança
// resetStandDeviation();
// for(var i = 0; i < 100; i++)
// {
startWithPolicy( policy );
computeTotalMetrics();
// resetSimulator();
// }
// getAverages(100);
// computeStandardDeviation(100);
// resetCalculations();
updateMetricsView();
}