Example #1
0
        // Constructor
        public Pump2ViewModel()
        {
            // Initializing model instances
            brewery = new Brewery();

            // Registering to incoming messages
            Messenger.Default.Register<Brewery>(this, "Pump2Update", Pump2Update_MessageReceived);
        }
        public DebugToolViewModel()
        {
            // Model Instances
            brewery = new Brewery();

            // Timer Instances
            UpdateTimer = new DispatcherTimer();
            UpdateTimer.Tick += UpdateTimer_Tick;
            UpdateTimer.Interval = TimeSpan.FromMilliseconds(100);
            UpdateTimer.Start();
        }
Example #3
0
        public BreweryCommands()
        {
            arduino = new ArduinoCommands(device = new LSPProtocol(new SimplePacketProtocolPacketEncoder()));
            hardwareSettings = new HardwareSettings();
            brewery = new Brewery();
            ProcessSettings = new Process.settings();

            Messenger.Default.Register<AnalogReturn>(this, "VolumeUpdate", VolumeUpdate_MessageReceived);
            Messenger.Default.Register<DigitalReturn>(this, DigitalReturn_MessageReceived);
            Messenger.Default.Register<HardwareSettings>(this, "HardwareSettingsUpdate", UpdateHardwareSettings);
            Messenger.Default.Register<Probes>(this, "TemperatureUpdate", TemperatureUpdate_MessageReceived);
            Messenger.Default.Register <bool>(this, "DesignMode", DesignMode_MessageReceived);
        }
Example #4
0
        private void MLTVolumeUpdate_MessageReceived(Brewery _brewery)
        {
            // Update the Volume
            brewery.MLT.Volume.Value = _brewery.MLT.Volume.Value;

            // Raise the volume related properties changed event
            RaisePropertyChanged(MLT_VolumePropertyName);
            RaisePropertyChanged(WaterHeightPropertyName);
        }
Example #5
0
 private void DesignModeTempUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.HLT.Temp.Value = _brewery.HLT.Temp.Value;
     brewery.MLT.Temp.Value = _brewery.MLT.Temp.Value;
     brewery.BK.Temp.Value = _brewery.BK.Temp.Value;
 }
Example #6
0
 private void HLTTempSetPointUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.HLT.Temp.SetPoint = _brewery.HLT.Temp.SetPoint;
     RaisePropertyChanged(Thermo_Height_SetPointPropertyName);
     RaisePropertyChanged(Thermo_SetPointPropertyName);
 }
Example #7
0
 private void HLTVolumeSetPointUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.HLT.Volume.SetPoint = _brewery.HLT.Volume.SetPoint;
     RaisePropertyChanged(HLT_Volume_SetPointPropertyName);
     RaisePropertyChanged(WaterHeightSetPointPropertyName);
 }
Example #8
0
        private void VolumeUpdate_MessageReceived(Brewery _brewery)
        {
            // Update the Volume
            if(_brewery.HLT.Volume.Value == 500) { return; }
            brewery.HLT.Volume.Value = _brewery.HLT.Volume.Value;

            // Raise the volume related properties changed event
            RaisePropertyChanged(HLT_VolumePropertyName);
            RaisePropertyChanged(WaterHeightPropertyName);
        }
Example #9
0
 // BK Set Point Update
 private void BKTempSetPointUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.BK.Temp.SetPoint = _brewery.BK.Temp.SetPoint;
 }
Example #10
0
 // MLT Set Point Update
 private void MLTTempSetPointUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.MLT.Temp.SetPoint = _brewery.MLT.Temp.SetPoint;
 }
Example #11
0
 // Pump 2 Update
 private void Pump2Update_MessageReceived(Brewery _brewery)
 {
     brewery.Pump2.IsOn = _brewery.Pump2.IsOn;
 }
Example #12
0
 // BK Burner Update
 private void BKBurnerUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.BK.Burner.IsOn = _brewery.BK.Burner.IsOn;
 }
Example #13
0
 // MLT Burner Update
 private void MLTBurnerUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.MLT.Burner.IsOn = _brewery.MLT.Burner.IsOn;
 }
Example #14
0
 private void DesignModeVolumeUpdate_MessageReceived(Brewery _brewery)
 {
     if (_brewery.HLT.Volume.Value != 500) { brewery.HLT.Volume.Value = _brewery.HLT.Volume.Value; }
     if (_brewery.BK.Volume.Value != 500) { brewery.BK.Volume.Value = _brewery.BK.Volume.Value; }
 }
Example #15
0
        public HLTViewModel()
        {
            // Create new instances of model classes
            brewery = new Brewery();

            // Register to sensor update messages
            Messenger.Default.Register<Brewery>(this, "VolumeUpdate", VolumeUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "TemperatureUpdate", TemperatureUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTBurnerUpdate", HLTBurnerUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTVolumeSetPointUpdate", HLTVolumeSetPointUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTVolumeSetPointReachedUpdate", HLTVolumeSetPointReachedUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTTempSetPointUpdate", HLTTempSetPointUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTTempSetPointReachedUpdate", HLTTempSetPointReachedUpdate_MessageReceived);
        }
Example #16
0
        private void TemperatureUpdate_MessageReceived(Brewery _brewery)
        {
            // Update the Tempperature
            brewery.HLT.Temp.Value = _brewery.HLT.Temp.Value;

            // Raise the temp related properties changed event
            RaisePropertyChanged(HLT_TempPropertyName);
            RaisePropertyChanged(Thermo_HeightPropertyName);
        }
Example #17
0
 // BK Set Point Reached Update
 private void BKTempSetPointReachedUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.BK.Temp.SetPointReached = _brewery.BK.Temp.SetPointReached;
 }
Example #18
0
        // HLT Burner Update
        private void HLTBurnerUpdate_MessageReceived(Brewery _brewery)
        {
            // Update the HLT burner state
            brewery.HLT.Burner.IsOn = _brewery.HLT.Burner.IsOn;

            // Raise the flames visibility changed event
            RaisePropertyChanged(Flames_VisibilityPropertyName);
        }
Example #19
0
        // MainViewModel Class Constructor
        public MainViewModel()
        {
            // Creating new instance of model
            breweryCommand = new BreweryCommands();
            hardwareSettings = new HardwareSettings();
            brewery = new Brewery();
            process = new Process();
            probes = new Probes();
            userAlarm = new UserAlarm(); 

            // Initializing RelayCommand Instances
            ConnectionSetupClickCommand = new RelayCommand(connectionSetupClickCommand);
            HardwareSetupClickCommand = new RelayCommand(hardwareSetupClickCommand);
            StartBrewSessionClickCommand = new RelayCommand(startBrewSessionClickCommand);
            MainClosingCommand = new RelayCommand(mainClosing);
            LoadRecipeClickCommand = new RelayCommand(loadRecipeClickCommand);
            DebugDesignSessionClickCommand = new RelayCommand(debugDesignClickCommand);

            // Initializing Timers
            UpdateTempSensorTimer = new DispatcherTimer();
            UpdateVolSensorTimer = new DispatcherTimer();
            AlarmTimer = new DispatcherTimer();
            PrimingTimer = new DispatcherTimer();
            MashStepTimer = new DispatcherTimer();
            BoilTimer = new DispatcherTimer();

            // Initializing Sound Player
            Player = new MediaPlayer();

            // Initializing Machine State Variables
            MashStepComplete = false;
            FirstMashStep = true;
            FirstSparge = true;
            SpargeModeOn = false;
            BoilOverSent = false;
            BoilComplete = false;
            StepStartTime = new TimeSpan();
            RemainingTime = new TimeSpan();
            StepEndTime = new TimeSpan();

            // Initializing the brewery State
            breweryState = BreweryState.StandBy;
            RaisePropertyChanged(BreweryStateDisplayPropertyName);

            // Initializing Messenger Registers
            Messenger.Default.Register<NotificationMessage>(this, "BreweryCommand", BreweryCommand_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "ConnectionUpdate" , ConnectionUpdate_MessageReceived);
            Messenger.Default.Register<HardwareSettings>(this, "HardwareSettingsUpdate", HardwareSettings_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "TemperatureUpdate", TemperatureUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "VolumeUpdate", VolumeUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTBurnerUpdate", HLTBurnerUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "MLTBurnerUpdate", MLTBurnerUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "BKBurnerUpdate", BKBurnerUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "Pump1Update", Pump1Update_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "Pump2Update", Pump2Update_MessageReceived);
            Messenger.Default.Register<string>(this, "SelectedcomPort", SelectedcomPort_MessageReceived);
            Messenger.Default.Register<Process>(this, Process_MessageReceived);
            Messenger.Default.Register<Probes>(this, "GetConnectedProbes", GetConnectedProbes_MessageReceived);
            Messenger.Default.Register<UserAlarm>(this, "UserAlarmReturn", UserAlarmReturn_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTTempSetPointUpdate", HLTTempSetPointUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "MLTTempSetPointUpdate", MLTTempSetPointUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "BKTempSetPointUpdate", BKTempSetPointUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "HLTTempSetPointReachedUpdate", HLTTempSetPointReachedUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "MLTTempSetPointReachedUpdate", MLTTempSetPointReachedUpdate_MessageReceived);
            Messenger.Default.Register<Brewery>(this, "BKTempSetPointReachedUpdate", BKTempSetPointReachedUpdate_MessageReceived);
        }
Example #20
0
 private void HLTVolumeSetPointReachedUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.HLT.Volume.SetPointReached = _brewery.HLT.Volume.SetPointReached;
     RaisePropertyChanged(HLT_SetPoint_Label_VisibilityPropertyName);
 }
Example #21
0
 // Temperature Update
 private void TemperatureUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.HLT.Temp.Value = _brewery.HLT.Temp.Value;
     brewery.MLT.Temp.Value = _brewery.MLT.Temp.Value;
     brewery.BK.Temp.Value = _brewery.BK.Temp.Value;
     RunAutoStateMachine();
 }
Example #22
0
 private void HLTTempSetPointReachedUpdate_MessageReceived(Brewery _brewery)
 {
     brewery.HLT.Temp.SetPointReached = _brewery.HLT.Temp.SetPointReached;
     RaisePropertyChanged(Thermo_SetPoint_VisibilityPropertyName);
 }
Example #23
0
 // Volume Update
 private void VolumeUpdate_MessageReceived(Brewery _brewery)
 {
     if (_brewery.HLT.Volume.Value != 500) { brewery.HLT.Volume.Value = _brewery.HLT.Volume.Value; }
     if (_brewery.BK.Volume.Value != 500) { brewery.BK.Volume.Value = _brewery.BK.Volume.Value; }
     RunAutoStateMachine();
 }
Example #24
0
 // Message Received handling
 private void Pump2Update_MessageReceived(Brewery _brewery)
 {
     brewery.Pump2.IsOn = _brewery.Pump2.IsOn;
     RaisePropertyChanged(PumpIsOnColorPropertyName);
 }
Example #25
0
 // Connection State
 private void ConnectionUpdate_MessageReceived(Brewery _brewery)
 {
     if(_brewery.IsConnected != brewery.IsConnected)
     {
         brewery.IsConnected = _brewery.IsConnected;
         Messenger.Default.Send<bool>(brewery.IsConnected, "ConnectButtonContent");
         RaisePropertyChanged(ConnectionStatusPropertyName);
         if (process.Session.StartRequested) { startBrewSessionClickCommand(); }
         if(brewery.IsConnected) { Messenger.Default.Send<NotificationMessageAction>(new NotificationMessageAction("CloseConnectionSetup",ConnectionSetupCloseCallback), "WindowOperation"); }
     }
 }