![JAR search and dependency download from the Maven repository](/logo.png)
jasima.shopSim.util.MachineStatCollector Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2010-2015 Torsten Hildebrandt and jasima contributors
*
* This file is part of jasima, v1.2.
*
* jasima is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* jasima is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with jasima. If not, see .
*******************************************************************************/
package jasima.shopSim.util;
import jasima.core.statistics.SummaryStat;
import jasima.core.statistics.TimeWeightedSummaryStat;
import jasima.shopSim.core.IndividualMachine;
import jasima.shopSim.core.Job;
import jasima.shopSim.core.Operation;
import jasima.shopSim.core.PrioRuleTarget;
import jasima.shopSim.core.WorkStation;
import java.util.Map;
/**
* Produces basic statistics for each workstation it is installed on (like
* utilization, average queue length, average setup time per operation).
*
* @author Torsten Hildebrandt
* @version
* "$Id: MachineStatCollector.java 550 2015-01-23 15:07:23Z [email protected] $"
*/
public class MachineStatCollector extends WorkStationListenerBase {
/*
* Continuous statistic time average number of number of machines busy at
* each station and time average number in queue
*/
public TimeWeightedSummaryStat aveMachinesBusy;
public TimeWeightedSummaryStat aniq;
// Discrete statistics average delay at station
public SummaryStat stationDelay;
public SummaryStat capacityUtilized;
public SummaryStat aveBatchSize;
public SummaryStat setupTime;
public SummaryStat procTime;
public MachineStatCollector() {
super();
}
@Override
protected void init(WorkStation m) {
aveMachinesBusy = new TimeWeightedSummaryStat();
aveMachinesBusy.value(m.numBusy(), m.shop().simTime());
aniq = new TimeWeightedSummaryStat();
stationDelay = new SummaryStat();
capacityUtilized = new SummaryStat();
aveBatchSize = new SummaryStat();
setupTime = new SummaryStat();
procTime = new SummaryStat();
aniq.clear();
stationDelay.clear();
capacityUtilized.clear();
aveBatchSize.clear();
setupTime.clear();
}
@Override
protected void produceResults(WorkStation m, Map res) {
res.put(m.getName() + ".qLen", aniq);
res.put(m.getName() + ".util", aveMachinesBusy);
res.put(m.getName() + ".capUtil", capacityUtilized);
res.put(m.getName() + ".bSize", aveBatchSize);
res.put(m.getName() + ".setup", setupTime);
res.put(m.getName() + ".qWait", stationDelay);
}
@Override
protected void done(WorkStation m) {
// properly "close" time weighted stats
aniq.value(Double.NaN, m.shop().simTime());
aveMachinesBusy.value(Double.NaN, m.shop().simTime());
}
@Override
protected void arrival(WorkStation m, Job j) {
if (!j.isFuture()) {
aniq.value(m.numJobsWaiting(), m.shop().simTime());
}
}
@Override
protected void activated(WorkStation m, IndividualMachine justActivated) {
aveMachinesBusy.value(m.numBusy(), m.shop().simTime());
}
@Override
protected void operationStarted(WorkStation m, PrioRuleTarget jobOrBatch,
int oldSetupState, int newSetupState, double setTime) {
if (jobOrBatch == null)
return;
double simTime = m.shop().simTime();
aveMachinesBusy.value(m.numBusy(), simTime);
// Record delay for station
for (int i = 0; i < jobOrBatch.numJobsInBatch(); i++) {
stationDelay.value(simTime - jobOrBatch.job(i).getArriveTime());
}
// Schedule a service completion for this batch at this
// station.
Operation op = jobOrBatch.getCurrentOperation();
capacityUtilized.value((double) jobOrBatch.numJobsInBatch()
/ op.maxBatchSize);
aveBatchSize.value(jobOrBatch.numJobsInBatch());
aniq.value(m.numJobsWaiting(), simTime);
setupTime.value(setTime);
procTime.value(jobOrBatch.currProcTime());
}
@Override
protected void operationCompleted(WorkStation m,
PrioRuleTarget justCompleted) {
aveMachinesBusy.value(m.numBusy(), m.shop().simTime());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy