Search in sources :

Example 6 with PoissonDistributionType

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

Example 7 with PoissonDistributionType

use of bpsim.PoissonDistributionType 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)

Example 8 with PoissonDistributionType

use of bpsim.PoissonDistributionType in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method extractTimeParamsToProperties.

private void extractTimeParamsToProperties(ElementParameters eleType, Map<String, Object> properties) {
    TimeParameters timeParams = eleType.getTimeParameters();
    if (timeParams != null) {
        Parameter processingTime = timeParams.getProcessingTime();
        if (processingTime != null && processingTime.getParameterValue() != null && processingTime.getParameterValue().size() > 0) {
            ParameterValue paramValue = processingTime.getParameterValue().get(0);
            if (paramValue instanceof NormalDistributionType) {
                NormalDistributionType ndt = (NormalDistributionType) paramValue;
                properties.put(MEAN, ndt.getMean());
                properties.put(STANDARDDEVIATION, ndt.getStandardDeviation());
                properties.put(DISTRIBUTIONTYPE, "normal");
            } else if (paramValue instanceof UniformDistributionType) {
                UniformDistributionType udt = (UniformDistributionType) paramValue;
                properties.put(MIN, udt.getMin());
                properties.put(MAX, udt.getMax());
                properties.put(DISTRIBUTIONTYPE, "uniform");
            } else if (paramValue instanceof PoissonDistributionType) {
                PoissonDistributionType pdt = (PoissonDistributionType) paramValue;
                properties.put(MEAN, pdt.getMean());
                properties.put(DISTRIBUTIONTYPE, "poisson");
            }
            if (timeParams.getWaitTime() != null) {
                extractParamTypeToProperties(WAITTIME, timeParams.getWaitTime().getParameterValue(), properties);
            }
        }
    }
}
Also used : UniformDistributionType(bpsim.UniformDistributionType) PoissonDistributionType(bpsim.PoissonDistributionType) ParameterValue(bpsim.ParameterValue) NormalDistributionType(bpsim.NormalDistributionType) Parameter(bpsim.Parameter) TimeParameters(bpsim.TimeParameters)

Aggregations

NormalDistributionType (bpsim.NormalDistributionType)8 Parameter (bpsim.Parameter)8 PoissonDistributionType (bpsim.PoissonDistributionType)8 TimeParameters (bpsim.TimeParameters)8 UniformDistributionType (bpsim.UniformDistributionType)8 ArrayList (java.util.ArrayList)5 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)5 EObject (org.eclipse.emf.ecore.EObject)5 CostParameters (bpsim.CostParameters)4 FloatingParameterType (bpsim.FloatingParameterType)4 DecimalFormat (java.text.DecimalFormat)4 List (java.util.List)4 Assignment (org.eclipse.bpmn2.Assignment)4 DataInput (org.eclipse.bpmn2.DataInput)4 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)4 DataOutput (org.eclipse.bpmn2.DataOutput)4 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)4 FormalExpression (org.eclipse.bpmn2.FormalExpression)4 EAttributeImpl (org.eclipse.emf.ecore.impl.EAttributeImpl)4 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)4