Package jasima.shopSim.core
Class WorkStation
- java.lang.Object
-
- jasima.core.simulation.SimComponentBase
-
- jasima.shopSim.core.WorkStation
-
- All Implemented Interfaces:
SimComponent,SimLifecycleListener,SimOperations,Notifier<SimComponent,SimComponent.SimComponentEvent>,NotifierListener<Simulation,Simulation.SimLifecycleEvent>,ValueStore,Cloneable
public class WorkStation extends SimComponentBase
Class to represent a workstation. A workstation is a collection of identicalIndividualMachines sharing a common queue.- Author:
- Torsten Hildebrandt
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkStation.WorkStationMessage-
Nested classes/interfaces inherited from interface jasima.core.simulation.SimComponent
SimComponent.ProduceResultsEvent, SimComponent.SimComponentEvent, SimComponent.SimComponentLifeCycleMessage
-
Nested classes/interfaces inherited from interface jasima.core.simulation.SimLifecycleListener
SimLifecycleListener.DoneListener, SimLifecycleListener.OtherListener, SimLifecycleListener.ResetStatsListener, SimLifecycleListener.ResultsListener, SimLifecycleListener.SimEndListener, SimLifecycleListener.SimInitialized, SimLifecycleListener.SimStartListener
-
Nested classes/interfaces inherited from interface jasima.core.simulation.util.SimOperations
SimOperations.SimEventType
-
-
Field Summary
Fields Modifier and Type Field Description static intACTIVATE_PRIOstatic StringBATCH_INCOMPATIBLEConstant to denote the batch family of a job, which is not compatible to any other.IndividualMachinecurrMachinestatic intDEF_SETUPstatic StringDEF_SETUP_STRstatic intDEPART_PRIOprotected intindexJobjustArrivedPrioRuleTargetjustCompletedPrioRuleTargetjustStartedstatic intLOOKAHEAD_PRIOintnewSetupStateintoldSetupStatePriorityQueue<Job>queuestatic intSELECT_PRIOdoublesetupTimeprotected Shopshopstatic intTAKE_DOWN_PRIOprotected doubleworkContentFutureprotected doubleworkContentReal-
Fields inherited from class jasima.core.simulation.SimComponentBase
sim
-
Fields inherited from interface jasima.core.simulation.SimComponent
NAME_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description WorkStation()WorkStation(int numInGroup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleagainIdle()doubleagainIdleIn()WorkStationclone()Public clone method.protected voiddepart()Called when an operation of Job j is finished.voidenqueueOrProcess(Job j)Job 'j' arrives at a machine.voidfutureArrival(Job f, double arrivesAt)The machine is notified of the future arrival of the jobfat a certain time.BatchForminggetBatchForming()PRgetBatchSequencingRule()Collection<IndividualMachine>getFreeMachines()Map<String,List<Job>>getJobsByFamily()StringgetName()Gets the name of this component (must not be changed once set).PrioRuleTargetgetProcessedJob(int machIdx)double[][]getSetupMatrix()intgetSetupState(int machIdx)intindex()voidinit()booleanisFree(IndividualMachine im)IndividualMachine[]machDat()protected PrioRuleTargetnextJobAndMachine()protected voidnotifyJobsOfDepart(PrioRuleTarget b)protected voidnotifyJobsOfProcStart(PrioRuleTarget batch)intnumBusy()intnumFreeMachines()intnumFutures()Returns the number of future jobs in thequeue.intnumInGroup()intnumJobsWaiting()Return the number of jobs waiting inqueue, ready to be started immediately.voidremoveFromQueue(Job j)voidselectAndStart()Selects the next batch from the queue and starts processing.protected voidselectAndStart0()voidsetBatchForming(BatchForming formBatch)voidsetBatchSequencingRule(PR batchSequencingRule)WorkStationsetName(String name)Sets a name for this component.voidsetSetupMatrix(double[][] setupMatrix)StringsetupStateToString(int id)Provides a human-readable string for a numeric setup state.Shopshop()doublestartedWorkInGroup()How much work have all machines in this group to finish their current jobs.protected voidstartProc(PrioRuleTarget batch)Start processing the current batch/job.StringtoString()inttranslateSetupState(String s)Translates a setup statesin a numeric constant.doubleworkContent(boolean includeFutureJobs)Returns the sum of processing times of all operations currently waiting in this machine's queue.-
Methods inherited from class jasima.core.simulation.SimComponentBase
getHierarchicalName, getParent, getSim, isInitialized, notifierImpl, setInitialized, setNameInternal, setParent, setSim, valueStoreImpl
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jasima.core.util.observer.Notifier
addListener, addListener, addListener, fire, fire, getListener, numListener, removeCurrentListener, removeListener
-
Methods inherited from interface jasima.core.simulation.SimComponent
addChild, addComponent, addResult, containsChild, done, getByHierarchicalName, getChild, getChildByName, getChildren, handleOther, inform, isValidName, numChildren, produceResults, removeChild, removeChildren, resetStats, simEnd, simStart
-
Methods inherited from interface jasima.core.simulation.util.SimOperations
activateEntity, currentPrio, end, getRootComponent, initRndGen, initRndGen, isEndRequested, isTraceEnabled, schedule, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleAt, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, scheduleIn, schedulePeriodically, schedulePeriodically, scheduleProcess, scheduleProcess, simTime, simTimeAbs, simTimeToInstant, toSimTime, toSimTime, toSimTime, trace
-
Methods inherited from interface jasima.core.util.ValueStore
valueStoreContains, valueStoreGet, valueStoreGet, valueStoreGetAllKeys, valueStoreGetNumKeys, valueStorePut, valueStoreRemove, valueStoreUpdate
-
-
-
-
Field Detail
-
DEF_SETUP_STR
public static final String DEF_SETUP_STR
- See Also:
- Constant Field Values
-
DEF_SETUP
public static final int DEF_SETUP
- See Also:
- Constant Field Values
-
BATCH_INCOMPATIBLE
public static final String BATCH_INCOMPATIBLE
Constant to denote the batch family of a job, which is not compatible to any other.- See Also:
- Constant Field Values
-
LOOKAHEAD_PRIO
public static final int LOOKAHEAD_PRIO
- See Also:
- Constant Field Values
-
SELECT_PRIO
public static final int SELECT_PRIO
- See Also:
- Constant Field Values
-
DEPART_PRIO
public static final int DEPART_PRIO
- See Also:
- Constant Field Values
-
TAKE_DOWN_PRIO
public static final int TAKE_DOWN_PRIO
- See Also:
- Constant Field Values
-
ACTIVATE_PRIO
public static final int ACTIVATE_PRIO
- See Also:
- Constant Field Values
-
queue
public final PriorityQueue<Job> queue
-
shop
protected Shop shop
-
index
protected int index
-
currMachine
public IndividualMachine currMachine
-
workContentReal
protected double workContentReal
-
workContentFuture
protected double workContentFuture
-
justArrived
public Job justArrived
-
justStarted
public PrioRuleTarget justStarted
-
justCompleted
public PrioRuleTarget justCompleted
-
oldSetupState
public int oldSetupState
-
newSetupState
public int newSetupState
-
setupTime
public double setupTime
-
-
Method Detail
-
init
public void init()
-
enqueueOrProcess
public void enqueueOrProcess(Job j)
Job 'j' arrives at a machine.
-
futureArrival
public void futureArrival(Job f, double arrivesAt)
The machine is notified of the future arrival of the jobfat a certain time. Note that f is not the job itself but a clone of this job with current operation advanced to this machine obtained withJob.getFuture().
-
removeFromQueue
public void removeFromQueue(Job j)
-
startProc
protected void startProc(PrioRuleTarget batch)
Start processing the current batch/job.
-
notifyJobsOfProcStart
protected void notifyJobsOfProcStart(PrioRuleTarget batch)
-
depart
protected void depart()
Called when an operation of Job j is finished.
-
notifyJobsOfDepart
protected void notifyJobsOfDepart(PrioRuleTarget b)
-
selectAndStart
public void selectAndStart()
Selects the next batch from the queue and starts processing. Even though this method is public it should never be called externally unless you know exactly what you are doing.
-
selectAndStart0
protected void selectAndStart0()
-
nextJobAndMachine
protected PrioRuleTarget nextJobAndMachine()
-
isFree
public boolean isFree(IndividualMachine im)
-
numJobsWaiting
public int numJobsWaiting()
Return the number of jobs waiting inqueue, ready to be started immediately. This does not include the KeepIdleDummy. This means, the following equation holds: queue.size()==numJobsWaiting()+numFutures()+1.- See Also:
numFutures()
-
numFutures
public int numFutures()
Returns the number of future jobs in thequeue. This does not include the KeepIdleDummy.- See Also:
numJobsWaiting()
-
startedWorkInGroup
public double startedWorkInGroup()
How much work have all machines in this group to finish their current jobs.
-
againIdleIn
public double againIdleIn()
-
againIdle
public double againIdle()
-
workContent
public double workContent(boolean includeFutureJobs)
Returns the sum of processing times of all operations currently waiting in this machine's queue.
-
getProcessedJob
public PrioRuleTarget getProcessedJob(int machIdx)
-
getSetupState
public int getSetupState(int machIdx)
-
setSetupMatrix
public void setSetupMatrix(double[][] setupMatrix)
-
getSetupMatrix
public double[][] getSetupMatrix()
-
translateSetupState
public int translateSetupState(String s)
Translates a setup statesin a numeric constant.- Parameters:
s- A setup state name.- Returns:
- Numeric constant for
s. - See Also:
setupStateToString(int)
-
setupStateToString
public String setupStateToString(int id)
Provides a human-readable string for a numeric setup state.- Parameters:
id- The numeric setup id. This was usually (optionally) created before usingtranslateSetupState(String)- See Also:
translateSetupState(String)
-
numFreeMachines
public int numFreeMachines()
-
getFreeMachines
public Collection<IndividualMachine> getFreeMachines()
-
machDat
public IndividualMachine[] machDat()
-
numBusy
public int numBusy()
-
numInGroup
public int numInGroup()
-
shop
public Shop shop()
-
index
public int index()
-
toString
public String toString()
- Overrides:
toStringin classSimComponentBase
-
setName
public WorkStation setName(String name)
Description copied from class:SimComponentBaseSets a name for this component.- Specified by:
setNamein interfaceSimComponent- Overrides:
setNamein classSimComponentBase
-
getName
public String getName()
Description copied from interface:SimComponentGets the name of this component (must not be changed once set).- Specified by:
getNamein interfaceSimComponent- Overrides:
getNamein classSimComponentBase
-
setBatchForming
public void setBatchForming(BatchForming formBatch)
-
getBatchForming
public BatchForming getBatchForming()
-
setBatchSequencingRule
public void setBatchSequencingRule(PR batchSequencingRule)
-
getBatchSequencingRule
public PR getBatchSequencingRule()
-
clone
public WorkStation clone()
Description copied from interface:SimComponentPublic clone method. Implementing classes should implement a suitable functionality or throw aCloneNotSupportedExceptionwrapped in aRuntimeException.- Specified by:
clonein interfaceSimComponent- Overrides:
clonein classSimComponentBase
-
-