예제 #1
0
        public void CalcTeploBalanceOnTonOfSmelt(InputDataModel input, ResultDataModel result)
        {
            var Gas   = result.TeploBalance_Gas * 1000 / result.MaterialBalance_Smelt;
            var Cocks = result.TeploBalance_Cocks * 1000 / result.MaterialBalance_Smelt;
            var Air   = result.TeploBalance_Air * 1000 / result.MaterialBalance_Smelt;

            var SumPlus = Gas + Cocks + Air;


            var MeltGeneration        = result.TeploBalance_MeltGeneration * 1000 / result.MaterialBalance_Smelt;
            var OutputGas             = result.TeploBalance_OutputGas * 1000 / result.MaterialBalance_Smelt;
            var Dust                  = result.TeploBalance_Dust * 1000 / result.MaterialBalance_Smelt;
            var ChemistryUnderburning = result.TeploBalance_ChemistryUnderburning * 1000 / result.MaterialBalance_Smelt;
            var CoolingWater          = result.TeploBalance_CoolingWater * 1000 / result.MaterialBalance_Smelt;
            var Endoterm_Reactions    = result.TeploBalance_Endoterm_Reactions * 1000 / result.MaterialBalance_Smelt;

            var SumWaste = MeltGeneration + OutputGas + Dust + ChemistryUnderburning + CoolingWater + Endoterm_Reactions;


            result.TeploBalanceOnTonOfSmelt_Gas     = Gas;
            result.TeploBalanceOnTonOfSmelt_Cocks   = Cocks;
            result.TeploBalanceOnTonOfSmelt_Air     = Air;
            result.TeploBalanceOnTonOfSmelt_SumPlus = SumPlus;


            result.TeploBalanceOnTonOfSmelt_MeltGeneration = MeltGeneration;
            result.TeploBalanceOnTonOfSmelt_OutputGas      = OutputGas;
            result.TeploBalanceOnTonOfSmelt_Dust           = Dust;

            result.TeploBalanceOnTonOfSmelt_ChemistryUnderburning = ChemistryUnderburning;
            result.TeploBalanceOnTonOfSmelt_Endoterm_Reactions    = Endoterm_Reactions;
            result.TeploBalanceOnTonOfSmelt_CoolingWater          = CoolingWater;
            result.TeploBalanceOnTonOfSmelt_SumWaste = SumWaste;
        }
예제 #2
0
        public IActionResult Create(
            [Bind("" +
                  "ID," +
                  "Date," +

                  "LabResult," +
                  // TODO, Add your attributes here.  Make sure to include the comma , after the attribute name

                  "")] ResultDataModel data)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Error", "Home"));
            }

            // Todo Save Change
            var result = Backend.Create(data);

            if (result == null)
            {
                return(RedirectToAction("Error", "Home"));
            }

            return(RedirectToAction(nameof(Index)));
        }
예제 #3
0
        /// <summary>
        /// Расчётная функция
        /// </summary>
        /// <param name="input"></param>
        public void CalculateResult(InputDataModel input)
        {
            Result = new ResultDataModel();

            Result.СrossSectionalArea       = Math.PI * Math.Pow(input.DeviceDiameter, 2) / 4;
            Result.GasConsumption           = input.GasSpeedFreeCrossSection * Result.СrossSectionalArea;
            Result.FlowHeatCapacitiesRatio  = input.MaterialConsumption * input.MaterialHeatCapacity / (Result.GasConsumption * input.GasAverageHeatСapacity);
            Result.LayerTotalRelativeHeight = input.VolumeHeatTransferCoefficient * Result.СrossSectionalArea * input.LayerHeight / (input.GasSpeedFreeCrossSection * Result.СrossSectionalArea * input.GasAverageHeatСapacity * 1000);
            Result.CorrespondingAttitude    = 1 - Result.FlowHeatCapacitiesRatio * Math.Exp(-(1 - Result.FlowHeatCapacitiesRatio) * Result.LayerTotalRelativeHeight / Result.FlowHeatCapacitiesRatio);


            double[] coordinates = new double[] { 0, 0.5, 1, 1.5, 2, 2.5, 3 };

            Result.Coordinates            = coordinates;
            Result.MaterialTemperatures   = new double[coordinates.Length];
            Result.GasTemperatures        = new double[coordinates.Length];
            Result.TemperatureDifferences = new double[coordinates.Length];

            for (int i = 0; i < coordinates.Length; i++)
            {
                double Y      = input.VolumeHeatTransferCoefficient * coordinates[i] / (input.GasAverageHeatСapacity * input.GasSpeedFreeCrossSection * 1000);
                double Exp    = 1 - Math.Exp((Result.FlowHeatCapacitiesRatio - 1) * Y / Result.FlowHeatCapacitiesRatio);
                double mExp   = 1 - Result.FlowHeatCapacitiesRatio * Math.Exp((Result.FlowHeatCapacitiesRatio - 1) * Y / Result.FlowHeatCapacitiesRatio);
                double uCoeff = Exp / (1 - Result.FlowHeatCapacitiesRatio * Math.Exp((Result.FlowHeatCapacitiesRatio - 1) * Result.LayerTotalRelativeHeight / Result.FlowHeatCapacitiesRatio));
                double oCoeff = mExp / (1 - Result.FlowHeatCapacitiesRatio * Math.Exp((Result.FlowHeatCapacitiesRatio - 1) * Result.LayerTotalRelativeHeight / Result.FlowHeatCapacitiesRatio));

                Result.MaterialTemperatures[i]   = input.MaterialStartTemperature + (input.GasStartTemperature - input.MaterialStartTemperature) * uCoeff;
                Result.GasTemperatures[i]        = input.MaterialStartTemperature + (input.GasStartTemperature - input.MaterialStartTemperature) * oCoeff;
                Result.TemperatureDifferences[i] = Result.GasTemperatures[i] - Result.MaterialTemperatures[i];
            }
        }
예제 #4
0
        /// <summary>
        /// Used by the API to create a new empty Data
        /// Records the ID in the Database
        /// This allows the API to then update the record in the future
        /// </summary>
        /// <returns></returns>
        public ResultDataModel CreateNewEmpty()
        {
            var myData   = new ResultDataModel();
            var myResult = Create(myData);

            return(myResult);
        }
예제 #5
0
        public IActionResult Update(
            [Bind("" +
                  "ID," +
                  "Date," +

                  "LabResult," +
                  // TODO, Add your attributes here.  Make sure to include the comma , after the attribute name

                  "")] ResultDataModel data)
        {
            if (!ModelState.IsValid)
            {
                return(NotFound());
            }

            //Look up the ID
            var dataExist = Backend.Read(data.ID);

            if (dataExist == null)
            {
                return(NotFound());
            }

            var dataResult = Backend.Update(data);

            if (dataResult == null)
            {
                return(NotFound());
            }

            return(RedirectToAction(nameof(Index)));
        }
예제 #6
0
        public async Task <ResultDataModel <Dictionary <string, PaymentProjectionResultModel> > > GetProjection(int userId, int month, int year)
        {
            var result     = new ResultDataModel <Dictionary <string, PaymentProjectionResultModel> >();
            var baseFilter = new BaseFilter()
            {
                UserId = userId
            };
            var types = await _paymentRepository.GetTypes();

            var cards = await _creditCardRepository.GetSome(baseFilter);

            var dates = LoadDates(month, year);
            var list  = new List <PaymentProjectionModel>();

            await FillBenefits(list, dates, types, baseFilter);
            await FillPayments(list, dates, types, cards, baseFilter);
            await FillVehicleExpenses(list, dates, types, baseFilter);
            await FillHouseholdExpense(list, dates, types, baseFilter);
            await FillRecurringExpenses(list, dates, types, cards, baseFilter);
            await FillRemainingBalance(list, dates, types, cards, baseFilter);

            dates.OrderBy(p => p.Ticks).ToList().ForEach(date =>
            {
                var monthYear   = date.ToString("MM/yyyy");
                var resultModel = new PaymentProjectionResultModel();
                resultModel.Payments.AddRange(list.Where(p => p.MonthYear == monthYear));
                result.Data.Add(monthYear, resultModel);
                resultModel.AccumulatedValue = result.Data.Values.Sum(p => p.Total + p.PreviousMonthBalanceValue);
            });

            return(result);
        }
        /// <summary>
        /// Add the ResultData item to the data store
        /// </summary>
        /// <param name="data">
        /// The new ResultData item to add to the data store
        /// </param>
        /// <returns>return the passed in ResultData item</returns>
        public ResultDataModel Create(ResultDataModel data, DataSourceEnum dataSourceEnum = DataSourceEnum.Unknown)
        {
            if (data == null)
            {
                return(null);
            }

            dataset.Add(data);
            return(data);
        }
예제 #8
0
        public void ResultData_Default_Should_Pass()
        {
            // Arrange

            // Act
            var result = new ResultDataModel();

            // Assert
            Assert.IsNotNull(result);
        }
예제 #9
0
        public ResultDataModel CalculateResult(InputDataModel input)
        {
            var result = new ResultDataModel();

            result.Gas.A = 1f / (1f - 3.76f * (input.O2_Percentage - 0.5f * input.CO_Percentage) / input.N2_Percentage);

            //result.Gas.V_Alpha = result.Gas.A*

            return(result);
        }
예제 #10
0
        //РАСЧЕТ ГАЗА И ПРИБОРА
        public void CalcGas(InputDataModel input, ResultDataModel result)
        {
            double _A       = 1f / (1f - 3.76f * (input.O2_Percentage - 0.5f * input.CO_Percentage) / input.N2_Percentage);
            double _V_Alpha = L0 * _A + DeltaV;
            double _V_Waste = input.Cocks * ((12d / 22.4d) * input.CO_Percentage + (12d / 22.4d) * input.CO2_Percentage);

            result.Gas_A       = _A;
            result.Gas_V_Alpha = _V_Alpha;
            result.Gas_V_Waste = _V_Waste;
        }
예제 #11
0
        public void CalcDevice(InputDataModel input, ResultDataModel result)
        {
            double _A       = input.Air_Spend / (input.Cocks * L0);
            double _V_Alpha = L0 * _A + DeltaV;
            double _V_Waste = input.Cocks * _V_Alpha;

            result.Device_A       = _A;
            result.Device_V_Alpha = _V_Alpha;
            result.Device_V_Waste = _V_Waste;
        }
예제 #12
0
        public void ResultData_Update_InValid_Data_Null_Should_Fail()
        {
            // Arrange
            var myData = new ResultDataModel();

            // Act
            var result = myData.Update(null);

            // Assert
            Assert.AreEqual(false, result);
        }
예제 #13
0
        public void ResultData_Get_Should_Pass()
        {
            // Arrange
            var myData = new ResultDataModel();

            // Act

            // Assert
            Assert.AreEqual(0, myData.LabResult);
            Assert.AreNotEqual("000000", myData.ResultCode);
        }
예제 #14
0
        //ТЕПЛОВОЙ БАЛАНС
        public void CalcTeploBalance(InputDataModel input, ResultDataModel result)
        {
            var Gas   = 33500d * input.Gas / 3600d;
            var Cocks = input.Cocks * Cocks_Combustion_Temperature / 3600d;
            var Air   = input.Air_Spend * (0.00000009d * input.Air_Temperature * input.Air_Temperature + 0.00004d * input.Air_Temperature + 1.296d) * input.Air_Temperature / 3600d;

            var SumPlus = Gas + Cocks + Air;


            var MeltGeneration = result.MaterialBalance_Smelt * input.Smelt_Temperature *
                                 (AverageSiO2 * (0.00007d * input.Smelt_Temperature + 1.1296d) +
                                  AverageAl2O3 * (0.0002d * input.Smelt_Temperature + 1.0934d) +
                                  AverageCaO * (0.00009d * input.Smelt_Temperature + 0.8804d) +
                                  AverageMgO * (0.0001d * input.Smelt_Temperature + 1.2024d) +
                                  AverageFeO * (0.0001d * input.Smelt_Temperature + 0.7232d)) / 3600d;

            var OutputGas = result.Device_V_Waste * input.Smoke_Temperature * (input.CO_Percentage *
                                                                               (0.0000001d * input.Smoke_Temperature * input.Smoke_Temperature + 0.00005d * input.Smoke_Temperature + 1.2979) / 100d + input.CO2_Percentage *
                                                                               (0.0000005d * input.Smoke_Temperature * input.Smoke_Temperature + 0.001d * input.Smoke_Temperature + 1.6016d) / 100d + 0.0125d *
                                                                               (0.00000003d * input.Smoke_Temperature * input.Smoke_Temperature + 0.0002d * input.Smoke_Temperature + 1.301d) + input.N2_Percentage *
                                                                               (0.0000007d * input.Smoke_Temperature * input.Smoke_Temperature + 0.00001d * input.Smoke_Temperature + 1.2981d) / 100d) / 3600d;

            var Dust = input.Limestone * input.Smoke_Temperature *
                       (0.4915d * (0.00007d * input.Smoke_Temperature + 1.1296d) +
                        0.1323d * (0.0002d * input.Smoke_Temperature + 1.0934d) +
                        0.2243d * (0.00009d * input.Smoke_Temperature + 0.8804d) +
                        0.1077d * (0.0001d * input.Smoke_Temperature + 1.2024d) +
                        0.0345d * (0.0001d * input.Smoke_Temperature + 0.7232d)) / 3600d;

            var ChemistryUnderburning = result.Device_V_Waste * input.CO_Percentage * 127.7d / 3600d;

            var CoolingWater = input.AverageWaterSteamTemperature * (input.InputWaterWaste * 4.2023d - input.OutputWaterWaste * 4.1934d) * 1000d / 3600d;


            var Endoterm_Reactions = SumPlus - MeltGeneration - OutputGas - Dust - ChemistryUnderburning - CoolingWater;

            var SumWaste = Endoterm_Reactions + CoolingWater + ChemistryUnderburning + Dust + OutputGas + MeltGeneration;


            result.TeploBalance_Gas     = Gas;
            result.TeploBalance_Cocks   = Cocks;
            result.TeploBalance_Air     = Air;
            result.TeploBalance_SumPlus = SumPlus;


            result.TeploBalance_MeltGeneration = MeltGeneration;
            result.TeploBalance_OutputGas      = OutputGas;
            result.TeploBalance_Dust           = Dust;

            result.TeploBalance_ChemistryUnderburning = ChemistryUnderburning;
            result.TeploBalance_Endoterm_Reactions    = Endoterm_Reactions;
            result.TeploBalance_CoolingWater          = CoolingWater;
            result.TeploBalance_SumWaste = SumWaste;
        }
예제 #15
0
        public void ResultData_Set_Should_Pass()
        {
            // Arrange
            var myData = new ResultDataModel();

            // Act
            myData.LabResult  = 12;
            myData.ResultCode = "123456";

            // Assert
            Assert.AreEqual(12, myData.LabResult);
            Assert.AreEqual("123456", myData.ResultCode);
        }
예제 #16
0
        public IActionResult UpdateLab(
            [Bind("" +
                  "ID," +
                  "Date," +

                  "LabResult," +
                  "ResultCode," +

                  "")] ResultDataModel data)
        {
            if (!ModelState.IsValid)
            {
                return(NotFound());
            }

            //Use the Result Code to lookup a Record
            var dataID = ResultDataHelper.ConvertResultCodeToID(data.ResultCode);

            if (string.IsNullOrEmpty(dataID))
            {
                return(NotFound());
            }

            //Look up the ID
            var dataExist = Backend.Read(dataID);

            if (dataExist == null)
            {
                return(NotFound());
            }

            /*
             * Do not want to update everything, just the Lab Result.
             * So rather than pass the new data to Update
             * Will manualy update just the Lab Result field on dataExist to be the data Lab Result passed in
             * Then will update the dataExist
             *
             */

            // Update just the LabResult value
            dataExist.LabResult = data.LabResult;

            var dataResult = Backend.Update(dataExist);

            if (dataResult == null)
            {
                return(NotFound());
            }

            return(RedirectToAction(nameof(Index)));
        }
예제 #17
0
        /// <summary>
        /// Makes a new AvatarItem
        /// </summary>
        /// <param name="data"></param>
        /// <returns>AvatarItem Passed In</returns>
        public ResultDataModel Create(ResultDataModel data, DataSourceEnum dataSourceEnum = DataSourceEnum.Unknown)
        {
            if (data == null)
            {
                return(null);
            }

            dataset.Add(data);

            // Add to Storage
            var myResult = DataSourceBackendTable.Instance.Create <ResultDataModel>(tableName, partitionKey, data.ID, data, dataSourceEnum);

            return(data);
        }
예제 #18
0
        public void ResultData_Create_Post_Default_Should_Pass()
        {
            // Arrange
            var myController = new ResultDataController();
            var myData       = new ResultDataModel();

            // Act
            var result = myController.Create(myData);

            // Reset

            // Assert
            Assert.IsNotNull(result);
        }
예제 #19
0
        public void ResultData_Constructor_Data_Valid_Should_Pass()
        {
            // Arrange
            var myData = new ResultDataModel
            {
                LabResult = 123
            };

            // Act
            var myNewData = new ResultDataModel(myData);

            // Assert
            Assert.AreEqual(123, myNewData.LabResult);
        }
예제 #20
0
        public void CalcMaterialBalanceOnTonOfSmelt(InputDataModel input, ResultDataModel result)
        {
            result.MaterialBalanceOnTonOfSmelt_Cocks       = input.Cocks * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_Gabbro      = input.Gabbro * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_Limestone   = input.Limestone * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_M_Limestone = input.M_Limestone * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_Gas         = input.Gas * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_Air         = result.MaterialBalance_Air * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_SumPlus     = result.MaterialBalance_SumPlus * 1000 / result.MaterialBalance_Smelt;

            result.MaterialBalanceOnTonOfSmelt_Smelt     = result.MaterialBalance_Smelt * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_OutputGas = result.MaterialBalance_OutputGas * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_Dust      = result.MaterialBalance_Dust * 1000 / result.MaterialBalance_Smelt;
            result.MaterialBalanceOnTonOfSmelt_WasteSum  = result.MaterialBalance_WasteSum * 1000 / result.MaterialBalance_Smelt;
        }
예제 #21
0
        public void ResultData_Delete_Post_Invalid_Model_Should_Send_Back_For_Edit()
        {
            // Arrange
            var controller = new ResultDataController();
            var data       = new ResultDataModel();

            // Make ModelState Invalid
            controller.ModelState.AddModelError("test", "test");

            // Act
            var result = controller.DeleteConfirmed(data.ID) as NotFoundResult;

            // Assert
            Assert.AreEqual(404, result.StatusCode);
        }
예제 #22
0
        public void ResultData_Create_Post_Default_Should_Pass()
        {
            // Arrange
            var myBackend = ResultDataBackend.Instance;
            var myData    = new ResultDataModel();

            // Act
            var result = myBackend.Create(myData);

            // Reset
            BiliWeb.Backend.DataSourceBackend.Instance.Reset();

            // Assert
            Assert.IsNotNull(result);
        }
예제 #23
0
        public void ResultData_Create_Post_Invalid_Model_Should_Send_Back_For_Edit()
        {
            // Arrange
            var controller = new ResultDataController();
            var data       = new ResultDataModel();

            // Make ModelState Invalid
            controller.ModelState.AddModelError("test", "test");

            // Act
            var result = controller.Create(data) as RedirectToActionResult;

            // Assert
            Assert.AreEqual("Error", result.ActionName);
        }
예제 #24
0
        public void ResultData_Create_InValid_Null_Should_Fail()
        {
            // Arrange
            var myBackend = ResultDataRepositoryMock.Instance;
            var myData    = new ResultDataModel();

            // Act
            var result = myBackend.Create(null);

            // Reset
            myBackend.Reset();

            // Assert
            Assert.IsNull(result);
        }
예제 #25
0
        public void ResultData_Create_Default_Should_Pass()
        {
            // Arrange
            var myBackend = ResultDataRepositoryMock.Instance;
            var myData    = new ResultDataModel();

            // Act
            var result = myBackend.Create(myData);

            // Reset
            myBackend.Reset();

            // Assert
            Assert.IsNotNull(result);
        }
예제 #26
0
        public async void Predict()
        {
            if (IsNewConfiguration())
            {
                TextBlockMessage = "Can't predict a plot for an unknown configuration.";
                return;
            }
            var result = new ResultDataModel();

            LayerSetter();
            _activeModel = DataMapper.Default.Map <BaseDataModel>(UiModel);
            BaseModel inputData = DataMapper.Default.Map <BaseModel>(ActiveModel);

            try
            {
                var tuple = await _manager.GetPredictedPlot(inputData);

                result.CorrectPoints   = tuple.Item1;
                result.IncorrectPoints = tuple.Item2;
                result.Error           = tuple.Item3;
                result.ErrorX          = tuple.Item4;
                result.ErrorY          = tuple.Item5;

                CorrectPointsGraph   = null;
                TrainedPointsGraph   = new PointCollection();
                PredictedPointsGraph = null;

                var correctPointsList = new List <Point>();
                for (int i = 0; i < result.CorrectPoints.GetLength(0); i++)
                {
                    correctPointsList.Add(new Point(result.CorrectPoints[i][0], result.CorrectPoints[i][1]));
                }
                var predictedPointsList = new List <Point>();
                for (int i = 0; i < result.IncorrectPoints.GetLength(0); i++)
                {
                    predictedPointsList.Add(new Point(result.IncorrectPoints[i][0], result.IncorrectPoints[i][1]));
                }

                CorrectPointsGraph   = new PointCollection(correctPointsList);
                PredictedPointsGraph = new PointCollection(predictedPointsList);

                TextBlockMessage = $"error: {result.Error}\nerrorX: {result.ErrorX}\nerrorY: {result.ErrorY}";
            }
            catch (Exception e)
            {
                TextBlockMessage = e.Message;
            }
        }
예제 #27
0
        public void ResultData_Delete_Post_Empty_Id_Should_Send_Back_For_Edit()
        {
            // Arrange
            var             controller = new ResultDataController();
            ResultDataModel dataEmpty  = new ResultDataModel
            {
                // Make data.Id empty
                ID = ""
            };

            // Act
            var result = controller.DeleteConfirmed(dataEmpty.ID) as RedirectToActionResult;

            // Assert
            Assert.AreEqual("Error", result.ActionName);
        }
        public void ResultData_Create_InValid_Null_Should_Fail()
        {
            // Arrange
            DataSourceBackend.Instance.SetDataSource(DataSourceEnum.Local);
            var myBackend = DataSourceBackend.Instance.ResultDataBackend;
            var myData    = new ResultDataModel();

            // Act
            var result = myBackend.Create(null);

            // Reset
            DataSourceBackend.Instance.Reset();
            DataSourceBackend.Instance.SetDataSource(DataSourceEnum.Mock);

            // Assert
            Assert.IsNull(result);
        }
        public void ResultData_Create_Default_Should_Pass()
        {
            // Arrange
            DataSourceBackend.Instance.SetDataSource(DataSourceEnum.Local);
            var myBackend = DataSourceBackend.Instance.ResultDataBackend;
            var myData    = new ResultDataModel();

            // Act
            var result = myBackend.Create(myData);

            // Reset
            DataSourceBackend.Instance.Reset();
            DataSourceBackend.Instance.SetDataSource(DataSourceEnum.Mock);

            // Assert
            Assert.IsNotNull(result);
        }
예제 #30
0
        public void ResultData_Update_InValid_Bogus_Should_Fail()
        {
            // Arrange
            var myBackend  = ResultDataRepositoryMock.Instance;
            var myDataCopy = new ResultDataModel
            {
                ID = "bogus"
            };

            // Act
            var result = myBackend.Update(myDataCopy);

            // Reset
            myBackend.Reset();

            // Assert
            Assert.AreEqual(null, result);
        }