Beispiel #1
0
function main($argc, $argv)
{
    if ($argc < 5) {
        printf("Usage: %s m S N Z\n", $argv[0]);
        printf("Where:\n");
        printf("\tm = Number of servicemem\n");
        printf("\tS = Mean service time\n");
        printf("\tN = Number of machine\n");
        printf("\tZ = Mean time to failure (MTTF)\n");
        printf("\n");
        exit(1);
    }
    $m = atol($argv[1]);
    $S = atof($argv[2]);
    $N = atol($argv[3]);
    $Z = atof($argv[4]);
    repair($m, $S, $N, $Z);
}
Beispiel #2
0
printf("\nMean Value Analysis algorithm for single class workload\n");
while (TRUE) {
    printf("\n(Hit RETURN to exit) ");
    printf("Enter no. of centers (K): ");
    gets($input);
    if ($input == "") {
        break;
    } else {
        $K = atoi($input);
    }
    for ($k = 1; $k <= $K; $k++) {
        printf("Enter demand at center %d (D[%d]): ", $k, $k);
        gets($input);
        $D[$k] = atof($input);
    }
    printf("Enter think time (Z):");
    gets($input);
    $Z = atof($input);
    while (TRUE) {
        printf("\n(Hit RETURN to stop) ");
        printf("Enter no. of terminals (N): ");
        gets($input);
        if ($input == "") {
            break;
        } else {
            $N = atoi($input);
            mva();
        }
    }
}
// main
Beispiel #3
0
    return $f;
}
if ($argc < 5) {
    printf("Usage: %s m S N Z\n", $argv[0]);
    printf("Where:\n");
    printf("\tm = Number of servicemem\n");
    printf("\tS = Mean service time\n");
    printf("\tN = Number of machine\n");
    printf("\tZ = Mean time to failure (MTTF)\n");
    printf("\n");
    exit(1);
}
$m = atol($argv[1]);
$S = atof($argv[2]);
$N = atol($argv[3]);
$Z = atof($argv[4]);
$p = 1;
$p0 = 1;
$L = 0;
for ($k = 1; $k <= $N; $k++) {
    $p *= ($N - $k + 1) * $S / $Z;
    if ($k <= $m) {
        $p /= $k;
    } else {
        $p /= $m;
    }
    $p0 += $p;
    if ($k > $m) {
        $L += $p * ($k - $m);
    }
}