示例#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);
}
示例#2
0
    $f = (double) $s;
    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);
    }