public TCTestJig(double tSrc, double tMix, double tAmb, double tSet, double rampRatePerMinute, double err, TemperatureControllerMode tcMode, bool tcEnabled)
            {
                BasicReactionSupporter brs = new BasicReactionSupporter();

                Initialize(brs);
                m_mixture = new Mixture(null, "Test Mixture");
                brs.MyReactionProcessor.Watch(m_mixture);
                Container container = new Container(1000, m_mixture);                // Container full volume is 1000 liters.

                m_tempController = new TemperatureController(container);

                m_mixture.AddMaterial(brs.MyMaterialCatalog["Water"].CreateMass(250, tMix));          // Add 250 kg.
                m_mixture.AddMaterial(brs.MyMaterialCatalog["Sodium Nitrite"].CreateMass(100, tMix)); // Add 100 kg NaNO2.

                m_tempController.AmbientTemperature = tAmb;                                           // degreeC

                // Error band functionality has been obsoleted.
                //m_tempController.ErrorBand = err;         // +/- err degreeC dead band.
                m_err = err;                                             // Used for acceptability of non-precise results.

                m_tempController.SetAmbientThermalConductance(.30, .25); // .25 W/degreeC
                m_tempController.SetAmbientThermalConductance(.60, .50); // .50 W/degreeC
                m_tempController.SetAmbientThermalConductance(.90, .75); // .75 W/degreeC
                m_tempController.SetThermalConductance(.30, .40);        // .4 W/degreeC
                m_tempController.SetThermalConductance(.60, .80);        // .8 W/degreeC
                m_tempController.SetThermalConductance(.90, .120);       // 1.2 W/degreeC

                m_tempController.TCEnabled             = tcEnabled;      // Temperature control system is on.
                m_tempController.TCMode                = tcMode;         // Temperature control system maintains a constant deltaT, or a constant tSrc.
                m_tempController.TCSetpoint            = tSet;
                m_tempController.TCSrcTemperature      = tSrc;           // Syltherm (e.g.) temperature.
                m_tempController.TCSrcDelta            = tSrc;           // To be used if/when the system is in constant delta mode.
                m_tempController.TCTemperatureRampRate = new TemperatureRampRate(5.0, TimeSpan.FromMinutes(1));
            }
        public void GetLatestActionListisCorrect()
        {
            var connection = new SqliteConnection("Data Source=:memory:");

            connection.Open();
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseSqlite(connection)
                          .Options;

            using (var context = new ApplicationDbContext(options))
            {
                context.Database.EnsureCreated();
                context.Temperatures.AddRange(
                    new Temperature
                {
                    TemperatureC = 25,
                    Humidity     = 10,
                    Pressure     = 30
                });
                context.SaveChanges();

                var controller = new TemperatureController(null, context);
                var temp       = controller.Get(1);
                Assert.Equal(25, temp.Result.Value.TemperatureC);
            }
        }
示例#3
0
        public async Task Get_WhenCalled_ReturnsOkResult()
        {
            mock.Setup(p => p.TemperatureConverter(1, "f", "c")).ReturnsAsync(12.222222222222223);
            temperatureController = new TemperatureController(mock.Object);
            var result = await temperatureController.Get(1, "f", "c");

            Assert.IsType <OkObjectResult>(result);
        }
示例#4
0
        public void TemperatureGetUnknownLocation()
        {
            TemperatureController controller = new TemperatureController();

            string results = controller.Get("!!!");

            Assert.IsTrue(string.IsNullOrEmpty(results));
        }
示例#5
0
 public void set(AcidityController ac, LightController lc, TemperatureController tc, WetnessController wc)
 {
     listOfControllers.ac = ac;
     listOfControllers.lc = lc;
     listOfControllers.tc = tc;
     listOfControllers.wc = wc;
     //Init cycle??
 }
示例#6
0
        private void InitializeContext()
        {
            var             builder         = new DbContextOptionsBuilder <DatabaseContext>().UseInMemoryDatabase("SampleDB");
            DatabaseContext databaseContext = new DatabaseContext(builder.Options);

            this.TemperatureController = new TemperatureController(databaseContext);
            this.DatabaseContext       = databaseContext;
        }
示例#7
0
        public async Task Get_BadRequest_ReturnsTemperatureConverterNull()
        {
            temperatureController = new TemperatureController(mock.Object);
            var result = await temperatureController.Get(1, "", "");

            var ex = Assert.IsType <BadRequestObjectResult>(result);

            Assert.Equal("Temperature converter type cannot same", ex.Value);
        }
        public TemperatureControllerTest()
        {
            tempReader            = new Mock <ISensorTempReader>();
            temperatureController = new TemperatureController(tempReader.Object);

            fixture = new Fixture();

            fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            fixture.Behaviors.Add(new OmitOnRecursionBehavior());
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            TemperatureController temperature = new TemperatureController(new TemperatureModel(new TemperatureDataAccess(100)));
            PressureController    pressure    = new PressureController(new PressureModel(new PressureDataAccess(100)));
            HumidityController    humidity    = new HumidityController(new HumidityModel(new HumidityDataAccess(100)));

            temperature.Display(new TemperatureView(new WinFormsOutput(tbTemperature)));
            pressure.Display(new PressureView(new WinFormsOutput(tbPressure)));
            humidity.Display(new HumidityView(new WinFormsOutput(tbHumidity)));
        }
示例#10
0
        public void TemperatureGet()
        {
            TemperatureController controller = new TemperatureController();

            controller.Put("location", "98.6");

            string result = controller.Get("location");

            Assert.AreEqual("98.6", result);
        }
示例#11
0
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            TemperatureController temperature = new TemperatureController(new TemperatureModel(new TemperatureDataAccess(100)));
            PressureController    pressure    = new PressureController(new PressureModel(new PressureDataAccess(100)));
            HumidityController    humidity    = new HumidityController(new HumidityModel(new HumidityDataAccess(100)));

            temperature.Display(new TemperatureView(new WpfOutput(Dispatcher, tbTemperature)));
            pressure.Display(new PressureView(new WpfOutput(Dispatcher, tbPressure)));
            humidity.Display(new HumidityView(new WpfOutput(Dispatcher, tbHumidity)));
        }
示例#12
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!int.TryParse(textBox19.Text, out int baudRate))
            {
                MessageBox.Show(DemoUtils.BaudRateInputWrong);
                return;
            }

            if (!int.TryParse(textBox18.Text, out int dataBits))
            {
                MessageBox.Show(DemoUtils.DataBitsInputWrong);
                return;
            }

            if (!int.TryParse(textBox2.Text, out int stopBits))
            {
                MessageBox.Show(DemoUtils.StopBitInputWrong);
                return;
            }

            if (!byte.TryParse(textBox1.Text, out byte Station))
            {
                MessageBox.Show("PLC Station input wrong!");
                return;
            }

            rkc?.Close( );
            rkc = new TemperatureController( );

            try
            {
                rkc.SerialPortInni(sp =>
                {
                    sp.PortName = comboBox3.Text;
                    sp.BaudRate = baudRate;
                    sp.DataBits = dataBits;
                    sp.StopBits = stopBits == 0 ? StopBits.None : (stopBits == 1 ? StopBits.One : StopBits.Two);
                    sp.Parity   = comboBox2.SelectedIndex == 0 ? Parity.None : (comboBox2.SelectedIndex == 1 ? Parity.Odd : Parity.Even);
                });
                //yamateke.ByteTransform.DataFormat = (HslCommunication.Core.DataFormat)comboBox1.SelectedItem;

                rkc.Open( );
                rkc.Station     = Station;
                button2.Enabled = true;
                button1.Enabled = false;
                panel2.Enabled  = true;

                userControlReadWriteOp1.SetReadWriteNet(rkc, "M1", false);
                userControlReadWriteOp1.EnableRKC( );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#13
0
        public void Post()
        {
            // Arrange
            TemperatureController controller = new TemperatureController();

            // Act
            var results = controller.GetTemperature(10, (int)TemperatureType.DegreeCelcius);

            // Assert
            Assert.AreEqual(-12.2232, results.Temperature);
        }
示例#14
0
        static void Main()
        {
            TemperatureController temperature = new TemperatureController(new TemperatureModel(new TemperatureDataAccess(100)));
            PressureController    pressure    = new PressureController(new PressureModel(new PressureDataAccess(100)));
            HumidityController    humidity    = new HumidityController(new HumidityModel(new HumidityDataAccess(100)));

            temperature.Display(new TemperatureView(new ConsoleOutput(0, "Temperature")));
            pressure.Display(new PressureView(new ConsoleOutput(1, "Pressure")));
            humidity.Display(new HumidityView(new ConsoleOutput(2, "Humidity")));

            Console.ReadKey();
        }
示例#15
0
        public void TemperatureGet2Locations()
        {
            TemperatureController controller = new TemperatureController();

            controller.Put("location1", "98.6");
            controller.Put("location2", "32.0");

            string result1 = controller.Get("location1");
            string result2 = controller.Get("location2");

            Assert.AreEqual("98.6", result1);
            Assert.AreEqual("32.0", result2);
        }
示例#16
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var temperatureConverter = new TemperatureConverter();
            var controller           = new TemperatureController(temperatureConverter);
            var view = new TemperatureView(controller);

            controller.SetView(view);

            Application.Run(view);
        }
示例#17
0
    void Start()
    {
        Screen.orientation = ScreenOrientation.LandscapeLeft;

        _currentSceneState = SceneState.Unfavorable;

        _dayNightCycleController   = new DayNightCycleController();
        _windController            = new WindController();
        _cloudController           = new CloudController(StartCoroutine);
        _rainController            = new RainController();
        _temperatureController     = new TemperatureController(StartCoroutine, _dayNightCycleController);
        _waterController           = new WaterController();
        _terrainController         = new TerrainController(StartCoroutine);
        _snowController            = new SnowController();
        _treeGrowthStateController = new TreeGrowthStateController(StartCoroutine, _windController.UpdateTreeWindForceOnGrow);

        _sceneRestarted = false;
    }
        public void GetThreeLatestActionListisCorrect()
        {
            var connection = new SqliteConnection("Data Source=:memory:");

            connection.Open();
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseSqlite(connection)
                          .Options;

            using (var context = new ApplicationDbContext(options))
            {
                context.Database.EnsureCreated();
                context.Temperatures.AddRange(
                    new Temperature
                {
                    TemperatureC = 25,
                    Humidity     = 10,
                    Pressure     = 30
                },
                    new Temperature
                {
                    TemperatureC = 24,
                    Humidity     = 9,
                    Pressure     = 5
                },
                    new Temperature
                {
                    TemperatureC = 23,
                    Humidity     = 2,
                    Pressure     = 1
                });
                context.SaveChanges();

                var controller = new TemperatureController(null, context);
                var date1      = DateTime.Now.AddDays(-1);
                var date2      = DateTime.Now.AddDays(1);
                var temps      = controller.GetByInterval(date1, date2);

                Assert.Equal(25, temps.Value[0].TemperatureC);
                Assert.Equal(24, temps.Value[1].TemperatureC);
                Assert.Equal(23, temps.Value[2].TemperatureC);
            }
        }
 public void SetController(TemperatureController temperatureController)
 {
     _temperatureController = temperatureController;
 }
示例#20
0
 public ClimateController(ClimateMode currentState)
 {
     CurrentMode            = currentState;
     _temperatureController = new TemperatureController(currentState.Temperature);
     _humidityController    = new HumidityController(currentState.Humidity);
 }
        public MainView(AbstractSender sender)
        {
            Sender = sender;

            _referenceTemperaturesLabel = new Label()
            {
                Location = new Point(520, 10),
                Font     = new Font("Arial", 15.0F),
                AutoSize = true,
                Text     = "Reference temperatures:"
            };

            Controls.Add(_referenceTemperaturesLabel);

            // TODO: change locations dynamically
            _lowTemperatureView = new TemperatureView(22)
            {
                Location = new Point(450, 35)
            };
            Controls.Add(_lowTemperatureView);

            _highTemperatureView = new TemperatureView(22)
            {
                Location = new Point(650, 35)
            };
            Controls.Add(_highTemperatureView);

            StartButton           = new Button();
            StartButton.BackColor = Color.White;
            StartButton.Location  = new Point(570, 300);
            StartButton.Text      = "Start";
            StartButton.Size      = new Size(100, 30);
            StartButton.FlatStyle = FlatStyle.Flat;
            StartButton.Click    += StartButton_Click;

            StopButton           = new Button();
            StopButton.BackColor = Color.White;
            StopButton.Location  = new Point(700, 300);
            StopButton.Text      = "Stop";
            StopButton.Size      = new Size(100, 30);
            StopButton.FlatStyle = FlatStyle.Flat;
            StopButton.Enabled   = false;
            StopButton.Click    += StopButton_Click;

            Controls.Add(StartButton);
            Controls.Add(StopButton);

            _automaticFanSpeedRegulationLabel = new Label
            {
                Location = new Point(530, 155),
                AutoSize = true,
                Text     = "Automatic fan speed regulation:",
                Font     = new Font("Arial", 10.0F)
            };

            Controls.Add(_automaticFanSpeedRegulationLabel);

            _automaticMotorSpeedCheckBox = new CheckBox()
            {
                Checked   = false,
                Location  = new Point(750, 150),
                FlatStyle = FlatStyle.Flat,
                Size      = new Size(30, 30)
            };

            _automaticMotorSpeedCheckBox.CheckedChanged += AutomaticMotorSpeedCheckBox_CheckedChanged;
            Controls.Add(_automaticMotorSpeedCheckBox);

            _fanSpeedLabel = new Label()
            {
                Location = new Point(490, 200),
                Font     = new Font("Arial", 15.0F),
                AutoSize = true,
                Text     = "Fan speed:"
            };

            Controls.Add(_fanSpeedLabel);

            MotorSpeedTrackBar = new TrackBar
            {
                Minimum       = 0,
                Maximum       = 100,
                Value         = 20,
                SmallChange   = 0,
                LargeChange   = 20,
                TickFrequency = 20,
                Size          = new Size(270, 40),
                TickStyle     = TickStyle.Both,
                Location      = new Point(480, 230),
            };

            MotorSpeedTrackBar.ValueChanged += MotorSpeedTrackBar_ValueChanged;
            MotorSpeedTrackBar.MouseWheel   += MotorSpeedTrackBar_MouseWheel;
            MotorSpeedTrackBar.MouseUp      += MotorSpeedTrackBar_MouseUp;
            Controls.Add(MotorSpeedTrackBar);

            MotorSpeedLabel = new Label()
            {
                AutoSize  = true,
                Location  = new Point(750, 230),
                ForeColor = System.Drawing.Color.Black,
                Text      = MotorSpeedTrackBar.Value.ToString() + "%",
                Font      = new Font("Arial", 20.0F)
            };

            Controls.Add(MotorSpeedLabel);

            ChartView = new ChartView()
            {
                Location = new Point(10, 10),
                Size     = new Size(400, 300)
            };
            Controls.Add(ChartView);

            _lowTemperatureController  = new TemperatureController(_lowTemperatureView);
            _highTemperatureController = new TemperatureController(_highTemperatureView);

            _connectionStatusTimer = new Timer
            {
                Interval = 500,
                Enabled  = true
            };

            _connectionStatusTimer.Tick += ConnectionStatusTimer_Tick;

            _connectionStatusPanel = new Panel
            {
                Location = new Point(810, 358),
                Size     = new Size(20, 20)
            };

            Controls.Add(_connectionStatusPanel);
        }
示例#22
0
        public void TemperaturePut()
        {
            TemperatureController controller = new TemperatureController();

            controller.Put("location", "98.6");
        }
示例#23
0
 public TemperatureForm(TemperatureController controller)
 {
     this.controller = controller;
     InitializeComponent();
 }
 public void Setup()
 {
     _dummyData  = new HomeMonitorEntitiesStub();
     _controller = new TemperatureController(_dummyData);
 }
示例#25
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     TemperatureController temp = new TemperatureController(zone.MyVent);
 }
示例#26
0
 public FormRkcTemperatureController( )
 {
     InitializeComponent( );
     rkc = new TemperatureController( );
     // omronHostLink.LogNet = new HslCommunication.LogNet.LogNetSingle( "omron.log.txt" );
 }