use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class Simulations method simulationAttributeSet.
public static SimulationAttributeSet simulationAttributeSet(ElementParameters eleType) {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams == null) {
return simulationSet;
}
Parameter processingTime = timeParams.getProcessingTime();
ParameterValue paramValue = processingTime.getParameterValue().get(0);
return Match.of(ParameterValue.class, SimulationAttributeSet.class).when(NormalDistributionType.class, ndt -> {
simulationSet.getMean().setValue(ndt.getMean());
simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation());
simulationSet.getDistributionType().setValue("normal");
return simulationSet;
}).when(UniformDistributionType.class, udt -> {
simulationSet.getMin().setValue(udt.getMin());
simulationSet.getMax().setValue(udt.getMax());
simulationSet.getDistributionType().setValue("uniform");
return simulationSet;
}).when(PoissonDistributionType.class, pdt -> {
simulationSet.getMean().setValue(pdt.getMean());
simulationSet.getDistributionType().setValue("poisson");
return simulationSet;
}).apply(paramValue).asSuccess().value();
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class Simulations method simulationSet.
public static SimulationSet simulationSet(ElementParameters eleType) {
SimulationSet simulationSet = new SimulationSet();
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams == null) {
return simulationSet;
}
Parameter processingTime = timeParams.getProcessingTime();
ParameterValue paramValue = processingTime.getParameterValue().get(0);
VoidMatch.of(ParameterValue.class).when(NormalDistributionType.class, ndt -> {
simulationSet.getMean().setValue(ndt.getMean());
simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation());
simulationSet.getDistributionType().setValue("normal");
}).when(UniformDistributionType.class, udt -> {
simulationSet.getMin().setValue(udt.getMin());
simulationSet.getMax().setValue(udt.getMax());
simulationSet.getDistributionType().setValue("uniform");
}).when(PoissonDistributionType.class, pdt -> {
simulationSet.getMean().setValue(pdt.getMean());
simulationSet.getDistributionType().setValue("poisson");
}).apply(paramValue).asSuccess().value();
CostParameters costParams = eleType.getCostParameters();
if (costParams != null) {
simulationSet.getUnitCost().setValue(extractDouble(costParams.getUnitCost()));
}
// controlParams(eleType, simulationSet);
ResourceParameters resourceParams = eleType.getResourceParameters();
if (resourceParams != null) {
Double quantity = extractDouble(resourceParams.getQuantity());
simulationSet.getQuantity().setValue(quantity);
Double availability = extractDouble(resourceParams.getAvailability());
simulationSet.getWorkingHours().setValue(availability);
}
return simulationSet;
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class Simulations method extractDouble.
private static Double extractDouble(EList<ParameterValue> parameterValues) {
if (parameterValues.isEmpty()) {
throw new IllegalArgumentException("failure params");
}
ParameterValue value = parameterValues.get(0);
FloatingParameterType floatingValue = (FloatingParameterType) value;
return floatingValue.getValue();
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class SimulationSets method of.
public static SimulationSet of(ElementParameters eleType) {
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams == null) {
return new SimulationSet();
}
Parameter processingTime = timeParams.getProcessingTime();
ParameterValue paramValue = processingTime.getParameterValue().get(0);
SimulationSet simulationSet = Match.of(ParameterValue.class, SimulationSet.class).when(NormalDistributionType.class, ndt -> {
SimulationSet sset = new SimulationSet();
sset.getMean().setValue(ndt.getMean());
sset.getStandardDeviation().setValue(ndt.getStandardDeviation());
sset.getDistributionType().setValue("normal");
return sset;
}).when(UniformDistributionType.class, udt -> {
SimulationSet sset = new SimulationSet();
sset.getMin().setValue(udt.getMin());
sset.getMax().setValue(udt.getMax());
sset.getDistributionType().setValue("uniform");
return sset;
}).when(PoissonDistributionType.class, pdt -> {
SimulationSet sset = new SimulationSet();
sset.getMean().setValue(pdt.getMean());
sset.getDistributionType().setValue("poisson");
return sset;
}).apply(paramValue).asSuccess().value();
CostParameters costParams = eleType.getCostParameters();
if (costParams != null) {
simulationSet.getUnitCost().setValue(extractDouble(costParams.getUnitCost()));
}
ResourceParameters resourceParams = eleType.getResourceParameters();
if (resourceParams != null) {
Double quantity = extractDouble(resourceParams.getQuantity());
simulationSet.getQuantity().setValue(quantity);
Double availability = extractDouble(resourceParams.getAvailability());
simulationSet.getWorkingHours().setValue(availability);
}
return simulationSet;
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class SimulationSets method extractDouble.
private static Double extractDouble(EList<ParameterValue> parameterValues) {
if (parameterValues.isEmpty()) {
throw new IllegalArgumentException("failure params");
}
ParameterValue value = parameterValues.get(0);
FloatingParameterType floatingValue = (FloatingParameterType) value;
return floatingValue.getValue();
}
Aggregations