/* * Currently unused. */ public void moveToDepot(Endstation place) { if (indepot) { return; } Position.RemoveTram(this); int i = 0; while (i < place.depot.Length) { if (place.depot[i] == null) { place.depot[i] = this; break; } i++; } indepot = true; Position = place; if (!place.Name.Equals(Position.Name)) { Console.WriteLine("WTF"); Console.ReadLine(); } }
private Simulation Sim; //Only used to call emergency exit. public Tram(int number, Endstation place, int max, string datafolder, Simulation sim) { PassMax = max; PassCurr = 0; TramNo = number; indepot = true; busy = false; Position = place; hasloaded = false; TotIn = 0; TotOut = 0; cameFromDepot = false; Sim = sim; int i = 0; while (i < place.depot.Length) { if (place.depot[i] == null) { place.depot[i] = this; break; } i++; } logger = new StreamWriter(datafolder + "Tram" + TramNo.ToString() + ".csv"); logger.WriteLine("time , place of departure , place of arrival"); tramActivitylog = new StreamWriter(datafolder+"activityLogTram" + TramNo.ToString() + ".txt"); logPassengers = new StreamWriter(datafolder + "Tram" +TramNo.ToString() + "PassLog.csv"); logPassengers.WriteLine("time, location, passengers, passengers in, passengers out"); }
private Simulation Sim; //Only used to call emergency exit. public Tram(int number, Endstation place, int max, string datafolder, Simulation sim) { PassMax = max; PassCurr = 0; TramNo = number; indepot = true; busy = false; Position = place; hasloaded = false; TotIn = 0; TotOut = 0; cameFromDepot = false; Sim = sim; int i = 0; while (i < place.depot.Length) { if (place.depot[i] == null) { place.depot[i] = this; break; } i++; } logger = new StreamWriter(datafolder + "Tram" + TramNo.ToString() + ".csv"); logger.WriteLine("time , place of departure , place of arrival"); tramActivitylog = new StreamWriter(datafolder + "activityLogTram" + TramNo.ToString() + ".txt"); logPassengers = new StreamWriter(datafolder + "Tram" + TramNo.ToString() + "PassLog.csv"); logPassengers.WriteLine("time, location, passengers, passengers in, passengers out"); }
public RecruitTram(int time, Tram tram, iHasRails place) { Priority = 0; ETime = time; Subject = tram; Place = place; Name = "RecruitTram"; base.addToList(); }
public StartPassTransfer(int time, Tram tram, iHasRails place) { EventList.checkForTram(tram); Priority = 2; tram.busy = true; ETime = time; Subject = tram; Place = place; Name = "StartPassTransfer"; base.addToList(); }
public EndPassTransfer(int time, Tram tram, iHasRails place, int In, int Out, bool cont) { EventList.checkForTram(tram); Priority = 4; PassIn = In; PassOut = Out; ETime = time; Subject = tram; Place = place; Cont = cont; Name = "EndPassTransfer"; base.addToList(); }
/* In addition to moving the tram: logs some data on tram activity. */ private void moveTo(iHasRails place) { if (Simulation.EXPLICIT) Console.WriteLine("Moving tram " + TramNo.ToString() + " from " + Position.Name + " to " + place.Name); if (!place.AddTram(this)) { Console.WriteLine("Error trying to move Tram" + TramNo.ToString() + " to station " + place.Name); Console.ReadLine(); Sim.EmergencyExit(); } Position.RemoveTram(this); logger.WriteLine(Time.Now().ToString() + " , " + Position.Name + " , " + place.Name); tramActivitylog.WriteLine(Time.Now().ToString() + " , Move , " + Position.Name + " , " + place.Name); Position = place; }
public EndTransit(int time, Tram tram, iHasRails place) { EventList.checkForTram(tram); Priority = 5; ETime = time; Subject = tram; Place = place; tram.busy = true; if (!place.Name.Trim().Equals(tram.Position.Next.Name.Trim())) { Console.WriteLine("AT EndTransit: place and subject.position.next do not match. \"" + Place.Name + "\" vs \"" + Subject.Position.Next.Name + "\""); Console.ReadLine(); EventList.Sim.EmergencyExit(); } Name = "Endtransit"; base.addToList(); }
public PassEmbarkWait(int time, Tram tram, int pin, iHasRails place) { EventList.checkForTram(tram); Priority = 3; ETime = time; Subject = tram; Place = place; Subject.busy = true; Pin = pin; Name = "PassEmbarkWait"; if (!Place.Name.Trim().Equals(Subject.Position.Name.Trim())) { Console.WriteLine("At creation of passembarkwait: place and subject.position do not match. " + Place.Name + " vs " + Subject.Position.Name); Console.ReadLine(); EventList.Sim.EmergencyExit(); } base.addToList(); }
public TrackLock(int time, Tram tram, iHasRails place, int track, bool incoming) { Priority = 6; ETime = time; Place = place; Track = track; Incoming = incoming; Place.LockTrack(track); Name = "TrackLock"; if (Simulation.EXPLICIT) { Console.WriteLine("Starting tracklock of at station " + Place.Name + " at time " + Time.Now().ToString()); if (Simulation.WAIT) { Console.ReadLine(); } } base.addToList(); }
/* * In addition to moving the tram: logs some data on tram activity. */ private void moveTo(iHasRails place) { if (Simulation.EXPLICIT) { Console.WriteLine("Moving tram " + TramNo.ToString() + " from " + Position.Name + " to " + place.Name); } if (!place.AddTram(this)) { Console.WriteLine("Error trying to move Tram" + TramNo.ToString() + " to station " + place.Name); Console.ReadLine(); Sim.EmergencyExit(); } Position.RemoveTram(this); logger.WriteLine(Time.Now().ToString() + " , " + Position.Name + " , " + place.Name); tramActivitylog.WriteLine(Time.Now().ToString() + " , Move , " + Position.Name + " , " + place.Name); Position = place; }
public StartTransit(int time, Tram tram, iHasRails place, int timenumber) { EventList.checkForTram(tram); Priority = 5; ETime = time; Subject = tram; Place = place; number = timenumber; Subject.busy = true; if (Place != tram.Position) { Console.WriteLine("At StartTransit event: place and subject.Position did not match. " + Place.Name + " vs " + Subject.Position.Name); Console.ReadLine(); EventList.Sim.EmergencyExit(); } if (Simulation.EXPLICIT) { Console.WriteLine("Planned Starttransit of tram" + Subject.TramNo.ToString() + " at station " + Place.Name + " at time " + Time.Now().ToString()); } Name = "StartTransit"; base.addToList(); }
public TrackLock(int time, Tram tram, iHasRails place, int track, bool incoming ) { Priority = 6; ETime = time; Place = place; Track = track; Incoming = incoming; Place.LockTrack(track); Name = "TrackLock"; if (Simulation.EXPLICIT) { Console.WriteLine("Starting tracklock of at station " + Place.Name + " at time " + Time.Now().ToString()); if (Simulation.WAIT) Console.ReadLine(); } base.addToList(); }
public EndTransit(int time, Tram tram, iHasRails place) { EventList.checkForTram(tram); Priority = 5; ETime = time; Subject = tram; Place = place; tram.busy = true; if ( !place.Name.Trim().Equals( tram.Position.Next.Name.Trim())) { Console.WriteLine("AT EndTransit: place and subject.position.next do not match. \"" + Place.Name + "\" vs \"" + Subject.Position.Next.Name + "\""); Console.ReadLine(); EventList.Sim.EmergencyExit(); } Name = "Endtransit"; base.addToList(); }
public StartTransit(int time, Tram tram, iHasRails place, int timenumber) { EventList.checkForTram(tram); Priority = 5; ETime = time; Subject = tram; Place = place; number = timenumber; Subject.busy = true; if (Place != tram.Position) { Console.WriteLine("At StartTransit event: place and subject.Position did not match. " + Place.Name + " vs " + Subject.Position.Name); Console.ReadLine(); EventList.Sim.EmergencyExit(); } if (Simulation.EXPLICIT) Console.WriteLine("Planned Starttransit of tram" + Subject.TramNo.ToString() + " at station " + Place.Name + " at time " + Time.Now().ToString()); Name = "StartTransit"; base.addToList(); }
/* Currently unused. */ public void moveToDepot (Endstation place) { if (indepot) return; Position.RemoveTram(this); int i = 0; while (i < place.depot.Length) { if (place.depot[i] == null) { place.depot[i] = this; break; } i++; } indepot = true; Position = place; if (!place.Name.Equals(Position.Name)) { Console.WriteLine("WTF"); Console.ReadLine(); } }
//Cannot do this upon construction; not all iHasRails have been contructed by then. public virtual void initStuff(iHasRails prev, iHasRails next) { Previous = prev; Next = next; }
public override void initStuff(iHasRails prev, iHasRails next) { base.initStuff(prev, next); }
public override void initStuff (iHasRails prev, iHasRails next) { base.initStuff(prev, next); }
public RecruitTram (int time, Tram tram, iHasRails place){ Priority = 0; ETime = time; Subject = tram; Place= place; Name = "RecruitTram"; base.addToList(); }
public PassEmbarkWait(int time, Tram tram, int pin, iHasRails place){ EventList.checkForTram(tram); Priority = 3; ETime = time; Subject = tram; Place= place; Subject.busy = true; Pin = pin; Name = "PassEmbarkWait"; if ( !Place.Name.Trim().Equals( Subject.Position.Name.Trim())) { Console.WriteLine("At creation of passembarkwait: place and subject.position do not match. " +Place.Name + " vs " + Subject.Position.Name); Console.ReadLine(); EventList.Sim.EmergencyExit(); } base.addToList(); }