Home Nach oben Link Job Maschine Maschine_seq Maschinengroup Process Simulation Statistic_List Werkhalle File Read Report
| |
package jobshop;
import EventSim.*;
import SingleLink.*;
/**
* Title: Maschine
* Description: class of active Objects maschines
* Copyright: Dirk Schmit & Guido Moser Copyright (c) 2001
* Company:no
* @author: Dirk Schmitt & Guido Moser
* @version 1.0
*/
public class Maschine extends process
{
int r;
int id;
public Maschine(int id, int r)
{
this.id=id;
this.r=r;
}
//Gebe id zurueck
public int get_id()
{
return id;
}
//Ermittlung der Bearbeitungszeit
public double get_Erlang(double b)
{
double x=0;
int i=0;
while (i<r)
{
x+=-b*Math.log(1-Math.random());
i++;
}
return (x/r);
}
//suche Objekt in Liste
public NamedLink searchTyp(NamedLink finder, int such_index)
{
NamedLink ptr=null;
while (finder.next() !=null)
{
finder=finder.next();
if (finder.get_id()==such_index)
{
ptr=finder;
}
}
return (ptr);
}
//rufe Statistic der Maschinenauf
//public void make_statistic(double bacc, Maschinegroup mg)
//{
//mg.st_mlist.setstatistic(bacc);
//}
//run Methode der einzelnen Maschine
public void run()
{
//linke auf Maschinengruppe
Maschinegroup c=(Maschinegroup)searchTyp(Maschinegroup.queue_Maschinegroup,this.id);
if (c.queue_jobs.empty())
{
c.queue_Maschine.in(this);
}
else
{
//Nehme Job aus Warteschlange
Job job_act=(Job)(c.queue_jobs.out());
double z=get_Erlang(job_act.get_act());
//rufe Statistics der Wartezeiten der Maschinengruppe auf
c.st_mwlist.setstatistic(Simulation.time()-job_act.t());
//rufe Statistic der Bedienzeiten auf
c.st_mblist.setstatistic(z);
//Aktiviere Maschine
activateAt(Simulation.time()+z);
//route Job an nächste Maschine (Verarbeitung in der run() des Jobs)
job_act.activateAt(Simulation.time()+z);
}
}
} |