Search in sources :

Example 1 with Workload

use of org.palladiosimulator.pcm.usagemodel.Workload in project iobserve-analysis by research-iobserve.

the class WorkloadEvaluation method calculateRME.

/**
 * Calculates the relative measurement error between a reference workload and the approach's
 * calculated workload. For an open workload the relative error of the mean inter arrival time
 * is calculated. For a closed workload the relative error of the mean number of concurrent
 * users is calculated. RME = (mw - rw) / rw, mw = measured workload, rw = reference workload
 *
 * @param usageModel
 *            contains the calculated workload
 * @param referenceElements
 *            contains the reference workload
 * @return return the relative measurement error
 */
public static double calculateRME(final UsageModel usageModel, final ReferenceElements referenceElements) {
    double rme = 0;
    final UsageScenario usageScenarioOfUsageModel = usageModel.getUsageScenario_UsageModel().get(0);
    final Workload workload = usageScenarioOfUsageModel.getWorkload_UsageScenario();
    // We distinguish between a closed and an open workload
    if (workload.getClass().equals(ClosedWorkloadImpl.class)) {
        final ClosedWorkload closedWorkloadOfUsageModel = (ClosedWorkload) workload;
        // The RME is calculated by the mean number of concurrent users that states the
        // population count of a closed workload
        final int usageModelWorkload = closedWorkloadOfUsageModel.getPopulation();
        final int referenceWorkload = referenceElements.getMeanConcurrentUserSessions();
        rme = (1.0 * usageModelWorkload - 1.0 * referenceWorkload) / (1.0 * referenceWorkload);
    } else if (workload.getClass().equals(OpenWorkloadImpl.class)) {
        final OpenWorkload openWorkloadOfUsageModel = (OpenWorkload) workload;
        final String interArrivalTime = openWorkloadOfUsageModel.getInterArrivalTime_OpenWorkload().getSpecification();
        // The RME is calculated by the mean inter arrival time that states an open workload
        final long usageModelWorkload = Long.parseLong(interArrivalTime);
        final long referenceWorkload = referenceElements.getMeanInterArrivalTime();
        rme = (1.0 * usageModelWorkload - 1.0 * referenceWorkload) / (1.0 * referenceWorkload);
    }
    rme = Math.abs(rme) * 100;
    return rme;
}
Also used : ClosedWorkload(org.palladiosimulator.pcm.usagemodel.ClosedWorkload) OpenWorkloadImpl(org.palladiosimulator.pcm.usagemodel.impl.OpenWorkloadImpl) UsageScenario(org.palladiosimulator.pcm.usagemodel.UsageScenario) OpenWorkload(org.palladiosimulator.pcm.usagemodel.OpenWorkload) Workload(org.palladiosimulator.pcm.usagemodel.Workload) OpenWorkload(org.palladiosimulator.pcm.usagemodel.OpenWorkload) ClosedWorkload(org.palladiosimulator.pcm.usagemodel.ClosedWorkload)

Aggregations

ClosedWorkload (org.palladiosimulator.pcm.usagemodel.ClosedWorkload)1 OpenWorkload (org.palladiosimulator.pcm.usagemodel.OpenWorkload)1 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)1 Workload (org.palladiosimulator.pcm.usagemodel.Workload)1 OpenWorkloadImpl (org.palladiosimulator.pcm.usagemodel.impl.OpenWorkloadImpl)1