public void Distill() { CurrentState.PlateauTemp = CurrentRun.Last().rrColumnHeadTemp; BackGroundWorkers.EnableRelay(SystemProperties.CoolantPump); //Once the first plateau is reached allowing for a 4 degree change at the most //or end the batch if the saftey limit switch is triggered also reset the Delta counters so the next step is not skipped while (CurrentState.StillEmpty == false && CurrentState.RVFull == false && (CurrentRun.Last().rrColumnHeadTemp - CurrentState.PlateauTemp) < 5) { decimal Temp1 = CurrentRun.Last().rrColumnHeadTemp; decimal Temp2 = CurrentRun[CurrentRun.Count - 20].rrColumnHeadTemp; RecordCurrentState(); Thread.Sleep(RefreshRate); } BackGroundWorkers.DisableRelay(SystemProperties.StillElement); CurrentState.ElementOn = false; }
public void FillStill() { PressureRegulator.RunWorkerAsync(); BackGroundWorkers.EnableRelay(SystemProperties.StillFillValve); CurrentState.StillValveOpen = true; Thread.Sleep(3000); //Wait 3 seconds for the valve to open BackGroundWorkers.EnableRelay(SystemProperties.StillFluidPump); CurrentState.StillPumpOn = true; while (CurrentState.StillFull == false) { Thread.Sleep(RefreshRate); } BackGroundWorkers.DisableRelay(SystemProperties.StillFillValve); CurrentState.StillValveOpen = false; BackGroundWorkers.DisableRelay(SystemProperties.StillFluidPump); CurrentState.StillPumpOn = false; }
public void DrainVessels() { PressureRegulator.CancelAsync(); ElementRegulator.CancelAsync(); //FanController1.CancelAsync(); //FanController2.CancelAsync(); //while (PressureRegulator.CancellationPending == true || FanController1.CancellationPending == true || FanController2.CancellationPending == true) while (PressureRegulator.CancellationPending == true) { Thread.Sleep(100); } //Fill the system with air so it is at a neutral pressure before pumping any fluids -- note that the system will pull air from the drain valve //since it eventually vents somewhere that is at atmospheric pressure BackGroundWorkers.EnableRelay(SystemProperties.StillDrainValve); while (CurrentState.StillEmpty == false || CurrentState.Pressure <= -0.2M) { Thread.Sleep(RefreshRate); } BackGroundWorkers.DisableRelay(SystemProperties.StillDrainValve); Thread.Sleep(3000); //Make sure that the switches are working then pump the Recieving vessels contents into a storage tank so the next run can begin BackGroundWorkers.EnableRelay(SystemProperties.RVDrainValve); Thread.Sleep(3000); //3 second delay so the valve has time to open BackGroundWorkers.EnableRelay(SystemProperties.RVFluidPump); while (CurrentState.RVEmpty == false) { Thread.Sleep(RefreshRate); } BackGroundWorkers.DisableRelay(SystemProperties.RVFluidPump); BackGroundWorkers.DisableRelay(SystemProperties.RVDrainValve); }