Search in sources :

Example 6 with ElementParameters

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);
}
Also used : ElementParameters(bpsim.ElementParameters)

Example 7 with ElementParameters

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;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) ElementParameters(bpsim.ElementParameters) HashMap(java.util.HashMap) Relationship(org.eclipse.bpmn2.Relationship) List(java.util.List) BPSimDataType(bpsim.BPSimDataType) Scenario(bpsim.Scenario)

Example 8 with ElementParameters

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

Example 9 with 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();
}
Also used : NormalDistributionType(bpsim.NormalDistributionType) ParameterValue(bpsim.ParameterValue) Parameter(bpsim.Parameter) PoissonDistributionType(bpsim.PoissonDistributionType) Match(org.kie.workbench.common.stunner.bpmn.backend.converters.Match) ElementParameters(bpsim.ElementParameters) TimeParameters(bpsim.TimeParameters) Factories.bpsim(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpsim) UniformDistributionType(bpsim.UniformDistributionType) SimulationAttributeSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet) PoissonDistributionType(bpsim.PoissonDistributionType) SimulationAttributeSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet) ParameterValue(bpsim.ParameterValue) NormalDistributionType(bpsim.NormalDistributionType) Parameter(bpsim.Parameter) TimeParameters(bpsim.TimeParameters)

Example 10 with ElementParameters

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;
}
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

ElementParameters (bpsim.ElementParameters)13 TimeParameters (bpsim.TimeParameters)8 Parameter (bpsim.Parameter)7 UniformDistributionType (bpsim.UniformDistributionType)7 NormalDistributionType (bpsim.NormalDistributionType)6 PoissonDistributionType (bpsim.PoissonDistributionType)6 CostParameters (bpsim.CostParameters)5 ResourceParameters (bpsim.ResourceParameters)5 ParameterValue (bpsim.ParameterValue)4 Match (org.kie.workbench.common.stunner.bpmn.backend.converters.Match)4 BPSimDataType (bpsim.BPSimDataType)3 FloatingParameterType (bpsim.FloatingParameterType)3 Scenario (bpsim.Scenario)3 EList (org.eclipse.emf.common.util.EList)3 SimulationAttributeSet (org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet)3 SimulationSet (org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationSet)3 HashMap (java.util.HashMap)2 Relationship (org.eclipse.bpmn2.Relationship)2 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)2 VoidMatch (org.kie.workbench.common.stunner.bpmn.backend.converters.VoidMatch)2