An error occurred while loading the file. Please try again.
-
Grand Francois authored
- bouton "calculer" affiché en rouge (en plus d'être désactivé) lorsque la calculette est invalide - NgParamInputComponent : le message d'erreur n'est pas affiché si le paramètre est à varier ou à calculer - propagation et synthèse de l'événement de validité (calculée par l'UI) depuis les inputs en remontant vers le formulaire - composants GenericCalculatorComponent, FieldSetComponent, ParamValuesComponent et GenericInputComponent basés sur BaseComponent de façon à pouvoir gérer leur initialisation (calculer la validité initiale de l'arbre des composants de la calculatrice, valeurs dans les champs, ...) - les composants NgParamMinComponent, NgParamMaxComponent, NgParamStepComponent et ValueListComponent gèrent directement une instance de NgParameter - déplacement de ValueListComponent dans son propre fichier
ad22310e
package miscellaneous;
import fr.cemagref.simaqualife.pilot.Pilot;
import umontreal.iro.lecuyer.randvar.NormalGen;
import umontreal.iro.lecuyer.randvar.UniformGen;
public class Miscellaneous {
public static long binomialForSuperIndividual(Pilot pilot, long amount, double succesProba, long threshold) {
long amountWithSuccess;
if (amount > threshold) { // use a normal approximation for huge amount
/* double p=-1.;
while (p<0 | p>1){
p = genAleaNormal.nextDouble() *
Math.sqrt(succesProba * (1 - succesProba) /amount) + succesProba;
}
amountWithSuccess = (long) Math.round(p* amount);*/
amountWithSuccess = -1;
while (amountWithSuccess < 0 | amountWithSuccess > amount) {
amountWithSuccess = Math.round(NormalGen.nextDouble(pilot.getRandomStream(), 0., 1.) * Math.sqrt(succesProba * (1 - succesProba) * amount)
+ succesProba * amount);
}
} else {
amountWithSuccess = 0;
for (long i = 0; i < amount; i++) {
if (UniformGen.nextDouble(pilot.getRandomStream(), 0, 1) < succesProba) {
amountWithSuccess++;
}
}
}
return amountWithSuccess;
}
public static long binomialForSuperIndividual(Pilot pilot, long amount, double succesProba) {
return binomialForSuperIndividual(pilot, amount, succesProba, 50);
}
static public double temperatureEffect(double T, double Tmin, double Topt, double Tmax) {
if (T <= Tmin || T >= Tmax) {
return 0;
} else {
return (T - Tmin) * (T - Tmax) / ((T - Tmin) * (T - Tmax) - ((T - Topt) * (T-Topt)));
}
}
}