public void Transfer(TrueTank to, int numAtoms)
 {
     to.Fill(this.Drain(numAtoms));
 }
 public void RemoveAtomsDPriority(TrueTank t, int numAtoms)
 {
     List<Atom> AtomsToRemove = new List<Atom>();
     int Count = 0;
     int DirtyAtoms = CountDirtyAtoms(t);
     while (DirtyAtoms > 0 && numAtoms > 0)
     {
         if (t.Atoms[Count].IsDirty == true) { t.Atoms.RemoveAt(Count); Count--; numAtoms--; DirtyAtoms--; }
         Count++;
     }
     t.Drain(numAtoms);
 }
 public int CountDirtyAtoms(TrueTank t)
 {
     int ReturnInt = 0;
     foreach (Atom a in t.Atoms)
     {
         if (a.IsDirty == true) { ReturnInt += 1; }
     }
     return ReturnInt;
 }
 //initialize the model
 public void init()
 {
     PLC = new PLCHelpers(HETankIP, BeltPressIP);
     TickDuration = Globals.MilliSecondPerTick;
     HETank = new TrueTank(HTankCap, PLC.GetHeatTankVolume, PLC.GetHeatTankTemp);
     StorTank = new TrueTank(StorTankCap, PLC.GetHoldTankVolume, PLC.GetHoldTankTemp);
     HExchanger = new TrueHeatExchanger(HExchangerCap, PLC.GetHETempIn, PLC.GetHETempOut);
     StartTime = DateTime.Now;
     PrevTime = StartTime;
     CurTime = StartTime;
     PHT = PLC.GetHoldTankVolume(); //magic initial value
     PHTT = PLC.GetHeatTankVolume(); //magic initial value
     Tracker = new IngressTracker(PLC, PHT, PHTT);
     SetInitValues();
     Thread.Sleep(5000);
 }
 public void CloneAtoms(TrueTank t, int numAtoms)
 {
     int random;
     Atom CloneAtom;
     for (int x = 0; x < numAtoms; x++)
     {
         random = Helpers.GetRandomElement(t.Atoms.Count);
         CloneAtom = t.Atoms[random].DirtyCopy();
         t.Atoms.Add(CloneAtom);
     }
 }