Search in sources :

Example 6 with ResourceParameters

use of bpsim.ResourceParameters 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;
}
Also used : UniformDistributionType(bpsim.UniformDistributionType) PoissonDistributionType(bpsim.PoissonDistributionType) CostParameters(bpsim.CostParameters) ElementParameters(bpsim.ElementParameters) NormalDistributionType(bpsim.NormalDistributionType) Parameter(bpsim.Parameter) TimeParameters(bpsim.TimeParameters) ResourceParameters(bpsim.ResourceParameters)

Aggregations

ResourceParameters (bpsim.ResourceParameters)6 CostParameters (bpsim.CostParameters)4 ElementParameters (bpsim.ElementParameters)4 Parameter (bpsim.Parameter)4 TimeParameters (bpsim.TimeParameters)4 FloatingParameterType (bpsim.FloatingParameterType)3 NormalDistributionType (bpsim.NormalDistributionType)3 PoissonDistributionType (bpsim.PoissonDistributionType)3 UniformDistributionType (bpsim.UniformDistributionType)3 ParameterValue (bpsim.ParameterValue)2 EList (org.eclipse.emf.common.util.EList)2 EObject (org.eclipse.emf.ecore.EObject)2 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)2 Match (org.kie.workbench.common.stunner.bpmn.backend.converters.Match)2 SimulationSet (org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationSet)2 BPSimDataType (bpsim.BPSimDataType)1 ControlParameters (bpsim.ControlParameters)1 PriorityParameters (bpsim.PriorityParameters)1 Scenario (bpsim.Scenario)1 DecimalFormat (java.text.DecimalFormat)1