
jasima.shopSim.core.IndividualMachine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasima-main Show documentation
Show all versions of jasima-main Show documentation
JAva SImulatior for MAnufacturing and logistics - A framework for discrete event simulation and computer experiments with a main focus on modelling and analyzing logistic/manufacturing systems.
/*******************************************************************************
* Copyright (c) 2010-2013 Torsten Hildebrandt and jasima contributors
*
* This file is part of jasima, v1.0.
*
* 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 .
*
* $Id: IndividualMachine.java 114 2013-05-16 15:27:04Z [email protected] $
*******************************************************************************/
package jasima.shopSim.core;
import jasima.core.random.continuous.DblStream;
import jasima.core.simulation.Event;
/**
* This class represents a single machine, which is part of a
* {@link WorkStation}.
*
* @author Torsten Hildebrandt
* @version
* "$Id: IndividualMachine.java 114 2013-05-16 15:27:04Z [email protected] $"
*/
public class IndividualMachine {
public enum MachineState {
DOWN, IDLE, WORKING
}
public final WorkStation workStation;
public final int idx; // index in workStation.machDat
public double relDate;
public int initialSetup;
public String name = null;
public DblStream timeBetweenFailures;
public DblStream timeToRepair;
public MachineState state;
public double procStarted;
public double procFinished;
public int setupState;
public PrioRuleTarget curJob;
public IndividualMachine(WorkStation workStation, int idx) {
super();
this.workStation = workStation;
this.idx = idx;
timeBetweenFailures = null;
timeToRepair = null;
state = MachineState.DOWN;
initialSetup = WorkStation.DEF_SETUP;
relDate = 0.0;
}
// called whenever an operation is finished
Event onDepart = new Event(0.0d, WorkStation.DEPART_PRIO) {
@Override
public void handle() {
workStation.currMachine = IndividualMachine.this;
workStation.depart();
workStation.currMachine = null;
}
};
Event activateEvent = new Event(0.0d, WorkStation.ACTIVATE_PRIO) {
@Override
public void handle() {
workStation.currMachine = IndividualMachine.this;
workStation.activate();
workStation.currMachine = null;
}
@Override
public boolean isAppEvent() {
return false;
}
};
Event takeDownEvent = new Event(0.0d, WorkStation.TAKE_DOWN_PRIO) {
@Override
public void handle() {
workStation.currMachine = IndividualMachine.this;
workStation.takeDown();
workStation.currMachine = null;
}
@Override
public boolean isAppEvent() {
return false;
}
};
@Override
public String toString() {
if (name == null)
name = workStation.getName()
+ (workStation.numInGroup() > 1 ? "." + idx : "");
return name;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy