use of bpsim.ElementParameters in project kie-wb-common by kiegroup.
the class SubProcessPropertyWriter method addChildElement.
public void addChildElement(PropertyWriter p) {
this.childElements.put(p.getElement().getId(), p);
process.getFlowElements().add(p.getFlowElement());
ElementParameters simulationParameters = p.getSimulationParameters();
if (simulationParameters != null) {
this.simulationParameters.add(simulationParameters);
}
this.itemDefinitions.addAll(p.itemDefinitions);
this.dataInputs.addAll(p.dataInputs);
this.dataOutputs.addAll(p.dataOutputs);
this.rootElements.addAll(p.rootElements);
}
use of bpsim.ElementParameters in project kie-wb-common by kiegroup.
the class DefinitionResolver method initSimulationParameters.
private Map<String, ElementParameters> initSimulationParameters(Definitions definitions) {
Map<String, ElementParameters> simulationParameters = new HashMap<>();
List<Relationship> relationships = definitions.getRelationships();
if (relationships.isEmpty()) {
return Collections.emptyMap();
}
FeatureMap value = relationships.get(0).getExtensionValues().get(0).getValue();
Object simData = value.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
List<BPSimDataType> bpsimExtensions = (List<BPSimDataType>) simData;
Scenario scenario = bpsimExtensions.get(0).getScenario().get(0);
for (ElementParameters parameters : scenario.getElementParameters()) {
simulationParameters.put(parameters.getElementRef(), parameters);
}
return simulationParameters;
}
use of bpsim.ElementParameters in project kie-wb-common by kiegroup.
the class SimulationAttributeSets method toElementParameters.
public static ElementParameters toElementParameters(SimulationAttributeSet simulationSet) {
ElementParameters elementParameters = bpsim.createElementParameters();
TimeParameters timeParameters = bpsim.createTimeParameters();
Parameter processingTime = bpsim.createParameter();
timeParameters.setProcessingTime(processingTime);
switch(simulationSet.getDistributionType().getValue()) {
case "normal":
NormalDistributionType ndt = bpsim.createNormalDistributionType();
ndt.setMean(simulationSet.getMean().getValue());
ndt.setStandardDeviation(simulationSet.getStandardDeviation().getValue());
processingTime.getParameterValue().add(ndt);
break;
case "uniform":
UniformDistributionType udt = bpsim.createUniformDistributionType();
udt.setMin(simulationSet.getMin().getValue());
udt.setMax(simulationSet.getMax().getValue());
processingTime.getParameterValue().add(udt);
break;
case "poisson":
PoissonDistributionType pdt = bpsim.createPoissonDistributionType();
pdt.setMean(simulationSet.getMean().getValue());
processingTime.getParameterValue().add(pdt);
break;
}
elementParameters.setTimeParameters(timeParameters);
return elementParameters;
}
use of bpsim.ElementParameters in project kie-wb-common by kiegroup.
the class SimulationAttributeSets method of.
public static SimulationAttributeSet of(ElementParameters eleType) {
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams == null) {
return new SimulationAttributeSet();
}
Parameter processingTime = timeParams.getProcessingTime();
ParameterValue paramValue = processingTime.getParameterValue().get(0);
return Match.of(ParameterValue.class, SimulationAttributeSet.class).when(NormalDistributionType.class, ndt -> {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
simulationSet.getMean().setValue(ndt.getMean());
simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation());
simulationSet.getDistributionType().setValue("normal");
return simulationSet;
}).when(UniformDistributionType.class, udt -> {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
simulationSet.getMin().setValue(udt.getMin());
simulationSet.getMax().setValue(udt.getMax());
simulationSet.getDistributionType().setValue("uniform");
return simulationSet;
}).when(PoissonDistributionType.class, pdt -> {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
simulationSet.getMean().setValue(pdt.getMean());
simulationSet.getDistributionType().setValue("poisson");
return simulationSet;
}).apply(paramValue).asSuccess().value();
}
use of bpsim.ElementParameters in project kie-wb-common by kiegroup.
the class SimulationSets method toElementParameters.
public static ElementParameters toElementParameters(SimulationSet simulationSet) {
ElementParameters elementParameters = bpsim.createElementParameters();
TimeParameters timeParameters = bpsim.createTimeParameters();
Parameter processingTime = bpsim.createParameter();
timeParameters.setProcessingTime(processingTime);
switch(simulationSet.getDistributionType().getValue()) {
case "normal":
NormalDistributionType ndt = bpsim.createNormalDistributionType();
ndt.setMean(simulationSet.getMean().getValue());
ndt.setStandardDeviation(simulationSet.getStandardDeviation().getValue());
processingTime.getParameterValue().add(ndt);
break;
case "uniform":
UniformDistributionType udt = bpsim.createUniformDistributionType();
udt.setMin(simulationSet.getMin().getValue());
udt.setMax(simulationSet.getMax().getValue());
processingTime.getParameterValue().add(udt);
break;
case "poisson":
PoissonDistributionType pdt = bpsim.createPoissonDistributionType();
pdt.setMean(simulationSet.getMean().getValue());
processingTime.getParameterValue().add(pdt);
break;
}
elementParameters.setTimeParameters(timeParameters);
Double unitCost = simulationSet.getUnitCost().getValue();
Double quantity = simulationSet.getQuantity().getValue();
Double workingHours = simulationSet.getWorkingHours().getValue();
CostParameters costParameters = bpsim.createCostParameters();
costParameters.setUnitCost(toParameter(unitCost));
elementParameters.setCostParameters(costParameters);
ResourceParameters resourceParameters = bpsim.createResourceParameters();
resourceParameters.setQuantity(toParameter(quantity));
resourceParameters.setAvailability(toParameter(workingHours));
elementParameters.setResourceParameters(resourceParameters);
return elementParameters;
}
Aggregations