예제 #1
0
        /**
         *  Initialize the GOMSpace EPS with the corresponding i2cAddress. This function can only be called once.
         *
         *  @param[in] i2c_address array of GOMSpace EPS I2C bus address
         *  @param[in] number number of attached EPS in the system to be initialized
         *  @return Error code according to <hal/errors.h>
         */

        public int GomEpsInitialize(byte i2c_address, byte number)
        {
            logs.Add(DateTime.Now + " IsisTrxvu_initialize");
            logs.Add("address: " + i2c_address + ", number: " + number);
            if (eps_table == null)
            {
                if (number > 0)
                {
                    eps_num   = number;
                    eps_table = new EPS[eps_num];
                    for (int i = 0; i < eps_num; i++)
                    {
                        eps_table[i] = new EPS();
                    }
                    logs.Add(DateTime.Now + "Exit Status: " + Constants.MapIdToError[Constants.E_NO_SS_ERR]);
                    return(Constants.E_NO_SS_ERR);
                }
                else
                {
                    logs.Add(DateTime.Now + "Exit Status: " + Constants.MapIdToError[Constants.E_INDEX_ERROR]);
                    return(Constants.E_INDEX_ERROR);
                }
            }
            else
            {
                logs.Add(DateTime.Now + "Exit Status: " + Constants.MapIdToError[Constants.E_IS_INITIALIZED]);
                return(Constants.E_IS_INITIALIZED);
            }
        }
예제 #2
0
        public void GET_HK_1Test()
        {
            EPS eps = new EPS();

            EPS.hkparam_t ans          = eps.GET_HK_1();
            ushort        photoCurrent = 0;

            for (int i = 0; i < 3; i++)
            {
                photoCurrent += eps.BoostConverters[i].CurrentOut;
            }
            Assert.AreEqual(ans.pc, photoCurrent);
            Assert.AreEqual(ans.bv, eps.OnboardBattery.Vbat);
            Assert.AreEqual(ans.sc, eps.OnboardBattery.CurrentOut);
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(ans.temp[i], eps.BoostConverters[i].Temperture);
            }
            Assert.AreEqual(ans.temp[3], eps.OnboardBattery.Temperture);
            Assert.AreEqual(ans.batt_temp[0], eps.OnboardBattery.Temperture);
            Assert.AreEqual(ans.batt_temp[1], eps.OnboardBattery.Temperture);
            for (int i = 0; i < 6; i++)
            {
                Assert.AreEqual(ans.latchup[i], ((Channel)eps.Outputs[i]).LatchupNum);
            }
            Assert.AreEqual(ans.reset, eps.LastResetCause);
            Assert.AreEqual(ans.bootcount, eps.RebootCount);
            Assert.AreEqual(ans.sw_errors, eps.SwErrors);
            Assert.AreEqual(ans.ppt_mode, (byte)eps.CurrentConfig.PptMode);
            Assert.AreEqual(ans.channel_status, 255);
        }
예제 #3
0
        public void SET_OUTPUTTest()
        {
            EPS eps = new EPS();

            byte output1 = 0;   //00000000
            byte output2 = 120; //01111000
            byte output3 = 255; //11111111
            int  i;

            eps.SET_OUTPUT(output1);
            for (i = 0; i < 8; i++)
            {
                Assert.AreEqual(eps.Outputs[i].Status, 0);
            }
            eps.SET_OUTPUT(output2);
            Assert.AreEqual(eps.Outputs[0].Status, 0);
            Assert.AreEqual(eps.Outputs[1].Status, 0);
            Assert.AreEqual(eps.Outputs[2].Status, 0);
            Assert.AreEqual(eps.Outputs[3].Status, 1);
            Assert.AreEqual(eps.Outputs[4].Status, 1);
            Assert.AreEqual(eps.Outputs[5].Status, 1);
            Assert.AreEqual(eps.Outputs[6].Status, 1);
            Assert.AreEqual(eps.Outputs[7].Status, 0);
            eps.SET_OUTPUT(output3);
            for (i = 0; i < 8; i++)
            {
                Assert.AreEqual(eps.Outputs[i].Status, 1);
            }
        }
예제 #4
0
        public void RESET_WDTTest()
        {
            EPS eps = new EPS();

            eps.RESET_WDT(0x78);
            Assert.AreEqual(eps.Wdts[(int)WdtType.GND].TimeLeft, (uint)EPSConstants.WDT_GND_INIT_TIME);
        }
예제 #5
0
        public void HARD_RESETTest()
        {
            EPS eps = new EPS();

            eps.HARD_RESET();
            Assert.AreEqual(eps.LastResetCause, EPSConstants.HARD_RESET_R);
        }
예제 #6
0
        public void GomEpsConfigSet_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            EPS.eps_config_t conf = new EPS.eps_config_t();
            //conf.output = new EPS.eps_config_t();
            EPS eps = gom.eps_table[0];

            conf.ppt_mode                 = (byte)eps.CurrentConfig.PptMode;
            conf.battheater_mode          = (byte)eps.CurrentConfig.BattheaterMode;
            conf.battheater_low           = eps.CurrentConfig.BattheaterLow;
            conf.battheater_high          = eps.CurrentConfig.BattheaterHigh;
            conf.output_initial_off_delay = new ushort[8];
            conf.output_initial_on_delay  = new ushort[8];
            conf.output_normal_value      = new byte[8];
            conf.output_safe_value        = new byte[8];
            for (int i = 0; i < 8; i++)
            {
                conf.output_initial_off_delay[i] = eps.CurrentConfig.OutputInitialOffDelay[i];
                conf.output_initial_on_delay[i]  = eps.CurrentConfig.OutputInitialOnDelay[i];
                conf.output_normal_value[i]      = eps.CurrentConfig.OutputNormalValue[i];
                conf.output_safe_value[i]        = eps.CurrentConfig.OutputSafeValue[i];
            }
            conf.vboost = new ushort[3];
            for (int i = 0; i < 3; i++)
            {
                conf.vboost[i] = eps.CurrentConfig.Vboost[i];
            }
            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsConfigSet(0, conf));
        }
예제 #7
0
        public override int GetHashCode()
        {
            var hashCode = -298693766;

            hashCode = hashCode * -1521134295 + EPS.GetHashCode();
            hashCode = hashCode * -1521134295 + MonthsInReport.GetHashCode();
            hashCode = hashCode * -1521134295 + NextReportDate.GetHashCode();
            return(hashCode);
        }
예제 #8
0
        public void CONFIG2_CMDTest()
        {
            EPS eps = new EPS();

            eps.CONFIG2_CMD(1);
            Assert.AreEqual(eps.CurrentConfig.BattSafeVoltage, EPSConstants.SAFE_VBAT);
            Assert.AreEqual(eps.CurrentConfig.BattNormalVoltage, EPSConstants.NORMAL_VBAT);
            Assert.AreEqual(eps.CurrentConfig.BattMaxVoltage, EPSConstants.MAX_VBAT);
            Assert.AreEqual(eps.CurrentConfig.BattCriticalVoltage, EPSConstants.CRITICAL_VBAT);
        }
예제 #9
0
        public void CONFIG2_GETTest()
        {
            EPS eps = new EPS();

            EPS.eps_config2_t config2 = eps.CONFIG2_GET();
            Assert.AreEqual(config2.batt_safevoltage, eps.CurrentConfig.BattSafeVoltage);
            Assert.AreEqual(config2.batt_normalvoltage, eps.CurrentConfig.BattNormalVoltage);
            Assert.AreEqual(config2.batt_maxvoltage, eps.CurrentConfig.BattMaxVoltage);
            Assert.AreEqual(config2.batt_criticalvoltage, eps.CurrentConfig.BattCriticalVoltage);
        }
예제 #10
0
        public void GET_HK_2Test()
        {
            EPS eps = new EPS();

            EPS.eps_hk_t ans = eps.GET_HK_2(0);
            int          i;

            for (i = 0; i < 3; i++)
            {
                Assert.AreEqual(ans.vboost[i], eps.BoostConverters[i].Volt);
                Assert.AreEqual(ans.curin[i], eps.BoostConverters[i].CurrentIn);
            }
            Assert.AreEqual(ans.vbatt, eps.OnboardBattery.Vbat);
            ushort photoCurrent = 0;

            for (i = 0; i < 3; i++)
            {
                photoCurrent += eps.BoostConverters[i].CurrentOut;
            }
            Assert.AreEqual(ans.cursun, photoCurrent);
            Assert.AreEqual(ans.cursys, eps.OnboardBattery.CurrentOut);
            for (i = 0; i < 6; i++)
            {
                Assert.AreEqual(ans.curout[i], ((Channel)eps.Outputs[i]).CurrentOut);
            }
            for (i = 0; i < 8; i++)
            {
                Assert.AreEqual(ans.output[i], eps.Outputs[i].Status);
                Assert.AreEqual(ans.output_on_delta[i], eps.CurrentConfig.OutputInitialOnDelay[i]);
                Assert.AreEqual(ans.output_off_delta[i], eps.CurrentConfig.OutputInitialOffDelay[i]);
            }
            for (i = 0; i < 6; i++)
            {
                Assert.AreEqual(ans.latchup[i], ((Channel)eps.Outputs[i]).LatchupNum);
            }
            Assert.AreEqual(ans.wdt_csp_pings_left[0], eps.Wdts[(int)WdtType.CSP0].PingLeft);
            Assert.AreEqual(ans.wdt_csp_pings_left[1], eps.Wdts[(int)WdtType.CSP1].PingLeft);
            Assert.AreEqual(ans.wdt_gnd_time_left, eps.Wdts[(int)WdtType.GND].TimeLeft);
            Assert.AreEqual(ans.wdt_i2c_time_left, eps.Wdts[(int)WdtType.I2C].TimeLeft);
            Assert.AreEqual(ans.counter_boot, eps.RebootCount);
            Assert.AreEqual(ans.counter_wdt_csp[0], eps.Wdts[(int)WdtType.CSP0].RebootCounter);
            Assert.AreEqual(ans.counter_wdt_csp[1], eps.Wdts[(int)WdtType.CSP1].RebootCounter);
            Assert.AreEqual(ans.counter_wdt_gnd, eps.Wdts[(int)WdtType.GND].RebootCounter);
            Assert.AreEqual(ans.counter_wdt_i2c, eps.Wdts[(int)WdtType.I2C].RebootCounter);
            for (i = 0; i < 3; i++)
            {
                Assert.AreEqual(ans.temp[i], eps.BoostConverters[i].Temperture);
            }
            Assert.AreEqual(ans.temp[3], eps.OnboardBattery.Temperture);
            Assert.AreEqual(ans.temp[4], eps.OnboardBattery.Temperture);
            Assert.AreEqual(ans.temp[5], eps.OnboardBattery.Temperture); // external - need to change
            Assert.AreEqual(ans.bootcause, eps.LastResetCause);
            Assert.AreEqual(ans.battmode, (byte)eps.OnboardBattery.BattState);
            Assert.AreEqual(ans.pptmode, (byte)eps.CurrentConfig.PptMode);
        }
예제 #11
0
        public void SET_PV_AUTOTest()
        {
            EPS eps = new EPS();

            eps.SET_PV_AUTO(EPSConstants.HARDWARE);
            Assert.AreEqual((byte)eps.CurrentConfig.PptMode, EPSConstants.HARDWARE);
            eps.SET_PV_AUTO(EPSConstants.MPPT);
            Assert.AreEqual((byte)eps.CurrentConfig.PptMode, EPSConstants.MPPT);
            eps.SET_PV_AUTO(EPSConstants.FIXEDSWPPT);
            Assert.AreEqual((byte)eps.CurrentConfig.PptMode, EPSConstants.FIXEDSWPPT);
        }
예제 #12
0
        public void RESET_COUNTERSTest()
        {
            EPS eps = new EPS();

            eps.RESET_COUNTERS(0x42);
            Assert.AreEqual(eps.RebootCount, (uint)0);
            Assert.AreEqual(eps.Wdts[(int)WdtType.CSP0].RebootCounter, (uint)0);
            Assert.AreEqual(eps.Wdts[(int)WdtType.GND].RebootCounter, (uint)0);
            Assert.AreEqual(eps.Wdts[(int)WdtType.I2C].RebootCounter, (uint)0);
            Assert.AreEqual(eps.Wdts[(int)WdtType.CSP1].RebootCounter, (uint)0);
        }
예제 #13
0
        public void SET_PV_VOLTTest()
        {
            EPS eps = new EPS();

            eps.SET_PV_VOLT(4000, 4500, 3300);
            Assert.AreEqual(eps.BoostConverters[0].Volt, 4000);
            Assert.AreEqual(eps.BoostConverters[1].Volt, 4500);
            Assert.AreEqual(eps.BoostConverters[2].Volt, 3300);
            eps.SET_PV_VOLT(2000, 4550, 4000);
            Assert.AreEqual(eps.BoostConverters[0].Volt, 2000);
            Assert.AreEqual(eps.BoostConverters[1].Volt, 4550);
            Assert.AreEqual(eps.BoostConverters[2].Volt, 4000);
        }
예제 #14
0
        public void GET_HK_2_WDTTest()
        {
            EPS eps = new EPS();

            EPS.eps_hk_wdt_t ans = eps.GET_HK_2_WDT(3);
            Assert.AreEqual(ans.counter_wdt_csp[0], eps.Wdts[(int)WdtType.CSP0].RebootCounter);
            Assert.AreEqual(ans.counter_wdt_csp[1], eps.Wdts[(int)WdtType.CSP1].RebootCounter);
            Assert.AreEqual(ans.counter_wdt_gnd, eps.Wdts[(int)WdtType.GND].RebootCounter);
            Assert.AreEqual(ans.counter_wdt_i2c, eps.Wdts[(int)WdtType.I2C].RebootCounter);
            Assert.AreEqual(ans.wdt_csp_pings_left[0], eps.Wdts[(int)WdtType.CSP0].TimeLeft);
            Assert.AreEqual(ans.wdt_csp_pings_left[1], eps.Wdts[(int)WdtType.CSP1].TimeLeft);
            Assert.AreEqual(ans.wdt_gnd_time_left, eps.Wdts[(int)WdtType.GND].TimeLeft);
            Assert.AreEqual(ans.wdt_i2c_time_left, eps.Wdts[(int)WdtType.I2C].TimeLeft);
        }
예제 #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            Read();
            double res = 0;

            if (radioButton21.Checked)
            {
                MonteKarloEnum KK = MonteKarloEnum.Usual;
                if (radioButton23.Checked)
                {
                    KK = MonteKarloEnum.Geo;
                }
                МатКлассы.Point p = new МатКлассы.Point(a, b);
                MultiFunc       F = (double[] t) => f(t[0]);
                h_Count       = count;
                n             = count;
                EPS           = Double.NaN;
                res           = MonteKarlo(F, KK, p);
                textBox7.Text = Math.Abs(res - DefIntegral(f, a, b, C, Criterion.StepCount, count, eps, seq)).ToString();
                h_Count       = count;
                n             = count;
                EPS           = Double.NaN;
                //return;
            }
            else
            {
                Criterion K = Criterion.StepCount;
                if (radioButton19.Checked)
                {
                    K = Criterion.Accuracy;
                }
                if (radioButton20.Checked)
                {
                    K = Criterion.SegmentCount;
                }

                if ((int)C < 3)
                {
                    res = DefIntegral(f, a, b, C, K, count, eps, seq);
                }
                else
                {
                    res = DefIntegral(f, a, b, C, K, nn, eps, seq);
                }
            }
            textBox6.Text = res.ToString();
            textBox3.Text = h_Count.ToString();
            textBox4.Text = EPS.ToString();
        }
 public IActionResult Post([FromBody] EPS eps)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest());
         }
         return(Ok(_unitOfWork.EPS.Insert(eps)));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal server error: " + ex.Message));
     }
 }
예제 #17
0
 public override int GetHashCode()
 {
     return(C.GetHashCode() +
            CacheSize.GetHashCode() +
            Coefficient0.GetHashCode() +
            Degree.GetHashCode() +
            EPS.GetHashCode() +
            Gamma.GetHashCode() +
            KernelType.GetHashCode() +
            Nu.GetHashCode() +
            P.GetHashCode() +
            Probability.GetHashCode() +
            Shrinking.GetHashCode() +
            SvmType.GetHashCode() +
            Weights.ToArray().ComputeHashcode());
 }
예제 #18
0
        public void CONFIG_SETTest()
        {
            EPS eps = new EPS();

            EPS.eps_config_t config = new EPS.eps_config_t();
            config.ppt_mode                 = 8;
            config.battheater_mode          = 8;
            config.battheater_low           = 8;
            config.battheater_high          = 8;
            config.battheater_mode          = 8;
            config.output_initial_off_delay = new ushort[8];
            config.output_initial_on_delay  = new ushort[8];
            config.output_normal_value      = new byte[8];
            config.output_safe_value        = new byte[8];
            config.vboost = new ushort[3];
            for (int i = 0; i < 8; i++)
            {
                config.output_initial_off_delay[i] = 8;
                config.output_initial_on_delay[i]  = 8;
                config.output_normal_value[i]      = 8;
                config.output_safe_value[i]        = 8;
            }
            for (int i = 0; i < 3; i++)
            {
                config.vboost[i] = 8;
            }

            eps.CONFIG_SET(config);
            Assert.AreEqual((byte)eps.CurrentConfig.PptMode, config.ppt_mode);
            Assert.AreEqual((byte)eps.CurrentConfig.BattheaterMode, config.battheater_mode);
            Assert.AreEqual(eps.CurrentConfig.BattheaterLow, config.battheater_low);
            Assert.AreEqual(eps.CurrentConfig.BattheaterHigh, config.battheater_high);
            Assert.AreEqual((byte)eps.CurrentConfig.BattheaterMode, config.battheater_mode);

            for (int i = 0; i < 8; i++)
            {
                Assert.AreEqual(config.output_initial_off_delay[i], eps.CurrentConfig.OutputInitialOffDelay[i]);
                Assert.AreEqual(config.output_initial_on_delay[i], eps.CurrentConfig.OutputInitialOnDelay[i]);
                Assert.AreEqual(config.output_normal_value[i], eps.CurrentConfig.OutputNormalValue[i]);
                Assert.AreEqual(config.output_safe_value[i], eps.CurrentConfig.OutputSafeValue[i]);
            }
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(config.vboost[i], eps.CurrentConfig.Vboost[i]);
            }
        }
예제 #19
0
        public void GET_HK_2_OUTTest()
        {
            EPS eps = new EPS();

            EPS.eps_hk_out_t ans = eps.GET_HK_2_OUT(2);
            for (int i = 0; i < 8; i++)
            {
                Assert.AreEqual(ans.output[i], eps.Outputs[i].Status);
                Assert.AreEqual(ans.output_off_delta[i], eps.CurrentConfig.OutputInitialOffDelay[i]);
                Assert.AreEqual(ans.output_on_delta[i], eps.CurrentConfig.OutputInitialOnDelay[i]);
            }
            for (int i = 0; i < 6; i++)
            {
                Assert.AreEqual(ans.latchup[i], ((Channel)eps.Outputs[i]).LatchupNum);
                Assert.AreEqual(ans.curout[i], ((Channel)eps.Outputs[i]).CurrentOut);
            }
        }
예제 #20
0
        public void SET_SINGLE_OUTPUTTest()
        {
            EPS eps = new EPS();

            eps.SET_OUTPUT(0);
            eps.SET_SINGLE_OUTPUT(5, 0, 1);
            Assert.AreEqual(eps.Outputs[5].Status, 0);
            Assert.AreEqual(eps.LastOutputMask, 0);
            eps.SET_SINGLE_OUTPUT(6, 1, 1);
            Assert.AreEqual(eps.Outputs[6].Status, 1);
            Assert.AreEqual(eps.LastOutputMask, 64);
            eps.SET_SINGLE_OUTPUT(2, 1, 1);
            Assert.AreEqual(eps.Outputs[2].Status, 1);
            Assert.AreEqual(eps.LastOutputMask, 68);
            eps.SET_SINGLE_OUTPUT(6, 0, 1);
            Assert.AreEqual(eps.Outputs[6].Status, 0);
            Assert.AreEqual(eps.LastOutputMask, 4);
        }
 public IActionResult Put([FromBody] EPS eps)
 {
     try
     {
         if (ModelState.IsValid && _unitOfWork.EPS.Update(eps))
         {
             return(Ok(new { Message = "La eps se ha actualizado" }));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal server error: " + ex.Message));
     }
 }
예제 #22
0
        public void GET_HK_2_BASICTest()
        {
            EPS eps = new EPS();

            EPS.eps_hk_basic_t ans = eps.GET_HK_2_BASIC(4);
            Assert.AreEqual(ans.counter_boot, eps.RebootCount);
            Assert.AreEqual(ans.bootcause, eps.LastResetCause);
            Assert.AreEqual(ans.pptmode, (byte)eps.CurrentConfig.PptMode);
            Assert.AreEqual(ans.battmode, (byte)eps.OnboardBattery.BattState);
            int i;

            for (i = 0; i < 3; i++)
            {
                Assert.AreEqual(ans.temp[i], eps.BoostConverters[i].Temperture);
            }
            Assert.AreEqual(ans.temp[3], eps.OnboardBattery.Temperture);
            Assert.AreEqual(ans.temp[4], eps.OnboardBattery.Temperture);
            Assert.AreEqual(ans.temp[5], eps.OnboardBattery.Temperture);
        }
예제 #23
0
        /// <summary>
        /// Gets the eps.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception">ParametersDAO.GetEPS</exception>

        public OutEPS GetEPS()
        {
            string connectionString = DataBaseHelper.GetConnectionString("DLG");
            OutEPS response         = new OutEPS();
            var    ora = new OracleServer(connectionString);

            EPS        eps;
            List <EPS> list    = new List <EPS>();
            string     command = string.Empty;

            try
            {
                command = " SELECT  NIT, NOMBRE, CODIGO_MINISTERIO  FROM BBS_WFC_PAR_EPS where nit> 0 ";
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    eps                 = new EPS();
                    eps.epsNIT          = DBNull.Value.Equals(rdr["NIT"]) ? string.Empty : rdr["NIT"].ToString();
                    eps.epsName         = DBNull.Value.Equals(rdr["NOMBRE"]) ? string.Empty : rdr["NOMBRE"].ToString();
                    eps.epsCodeMinistry = DBNull.Value.Equals(rdr["CODIGO_MINISTERIO"]) ? string.Empty : rdr["CODIGO_MINISTERIO"].ToString();
                    list.Add(eps);
                }
                rdr.Close();
                response.lstEPS           = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ParametersDAO.GetEPS", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }
예제 #24
0
        public void GET_HK_2_VITest()
        {
            EPS eps = new EPS();

            EPS.eps_hk_vi_t ans = eps.GET_HK_2_VI(1);
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(ans.vboost[i], eps.BoostConverters[i].Volt);
                Assert.AreEqual(ans.curin[i], eps.BoostConverters[i].CurrentIn);
            }
            Assert.AreEqual(ans.vbatt, eps.OnboardBattery.Vbat);
            ushort systemCurrent = eps.OnboardBattery.CurrentOut;

            Assert.AreEqual(ans.cursys, systemCurrent);
            ushort photoCurrent = 0;

            for (int i = 0; i < 3; i++)
            {
                photoCurrent += eps.BoostConverters[i].CurrentOut;
            }
            Assert.AreEqual(ans.cursun, photoCurrent);
        }
예제 #25
0
        public void CONFIG_CMDTest()
        {
            EPS eps = new EPS();

            eps.CONFIG_CMD(1);
            Assert.AreEqual((byte)eps.CurrentConfig.PptMode, EPSConstants.FIXEDSWPPT);
            Assert.AreEqual((byte)eps.CurrentConfig.BattheaterMode, EPSConstants.AUTO);
            Assert.AreEqual(eps.CurrentConfig.BattheaterHigh, 100); //to change
            Assert.AreEqual(eps.CurrentConfig.BattheaterLow, 0);    //to change
            int i;

            for (i = 0; i < 3; i++)
            {
                Assert.AreEqual(eps.CurrentConfig.Vboost[i], EPSConstants.SOFTWARE_PPT_DEFAULT_V);
            }
            for (i = 0; i < 8; i++)
            {
                Assert.AreEqual(eps.CurrentConfig.OutputInitialOffDelay[i], 1);
                Assert.AreEqual(eps.CurrentConfig.OutputInitialOnDelay[i], 1);
                Assert.AreEqual(eps.CurrentConfig.OutputNormalValue[i], 0); //need to change
                Assert.AreEqual(eps.CurrentConfig.OutputSafeValue[i], 0);   //need to change
            }
        }
예제 #26
0
        public void SET_HEATERTest()
        {
            EPS eps = new EPS();

            Assert.AreEqual(eps.SET_HEATER(0, EPSConstants.BP4_HEATER, EPSConstants.ON), EPSConstants.ON + (eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER].Status << 8));
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.BP4_HEATER].Status, EPSConstants.ON);

            Assert.AreEqual(eps.SET_HEATER(0, EPSConstants.BP4_HEATER, EPSConstants.OFF), EPSConstants.OFF + (eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER].Status << 8));
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.BP4_HEATER].Status, EPSConstants.OFF);

            Assert.AreEqual(eps.SET_HEATER(0, EPSConstants.ONBOARD_HEATER, EPSConstants.ON), eps.BatteryHeaters[EPSConstants.BP4_HEATER].Status + (EPSConstants.ON << 8));
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER].Status, EPSConstants.ON);

            Assert.AreEqual(eps.SET_HEATER(0, EPSConstants.ONBOARD_HEATER, EPSConstants.OFF), eps.BatteryHeaters[EPSConstants.BP4_HEATER].Status + (EPSConstants.OFF << 8));
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER].Status, EPSConstants.OFF);

            Assert.AreEqual(eps.SET_HEATER(0, EPSConstants.BOTH_HEATER, EPSConstants.ON), EPSConstants.ON + (EPSConstants.ON << 8));
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.BP4_HEATER].Status, EPSConstants.ON);
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER].Status, EPSConstants.ON);

            Assert.AreEqual(eps.SET_HEATER(0, EPSConstants.BOTH_HEATER, EPSConstants.OFF), EPSConstants.OFF + (EPSConstants.OFF << 8));
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.BP4_HEATER].Status, EPSConstants.OFF);
            Assert.AreEqual(eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER].Status, EPSConstants.OFF);
        }
예제 #27
0
        public EPSTab(GomEPS gomEPS)
        {
            InitializeComponent();
            this.gomEPS = gomEPS;
            gomEPS.GomEpsInitialize(0, 1);
            eps = gomEPS.eps_table[0];
            Battery          batt       = eps.OnboardBattery;
            BoostConverter   converter1 = eps.BoostConverters[0];
            BoostConverter   converter2 = eps.BoostConverters[1];
            BoostConverter   converter3 = eps.BoostConverters[2];
            Channel          channel1   = (Channel)eps.Outputs[(int)OutputType.T_3_3V1];
            Channel          channel2   = (Channel)eps.Outputs[(int)OutputType.T_3_3V2];
            Channel          channel3   = (Channel)eps.Outputs[(int)OutputType.T_3_3V3];
            Channel          channel4   = (Channel)eps.Outputs[(int)OutputType.T_5V1];
            Channel          channel5   = (Channel)eps.Outputs[(int)OutputType.T_5V2];
            Channel          channel6   = (Channel)eps.Outputs[(int)OutputType.T_5V3];
            Output           qs         = eps.Outputs[(int)OutputType.T_QS];
            Output           qh         = eps.Outputs[(int)OutputType.T_QH];
            EPSConfiguration currConfig = eps.CurrentConfig;
            BatteryHeater    heater     = eps.BatteryHeaters[EPSConstants.ONBOARD_HEATER];
            WDT i2c  = eps.Wdts[(int)WdtType.I2C];
            WDT gnd  = eps.Wdts[(int)WdtType.GND];
            WDT csp0 = eps.Wdts[(int)WdtType.CSP0];
            WDT csp1 = eps.Wdts[(int)WdtType.CSP1];

            //Battery
            batteryGrid.DataContext     = batt;
            battCurrInText.DataContext  = batt;
            battCurrOutText.DataContext = batt;
            //pv
            pv1Grid.DataContext        = converter1;
            pv1CurrInText.DataContext  = converter1;
            pv1CurrOutText.DataContext = converter1;
            pv1VboostText.DataContext  = currConfig;
            pv2Grid.DataContext        = converter2;
            pv2CurrInText.DataContext  = converter2;
            pv2CurrOutText.DataContext = converter2;
            pv2VboostText.DataContext  = currConfig;
            pv3Grid.DataContext        = converter3;
            pv3CurrInText.DataContext  = converter3;
            pv3CurrOutText.DataContext = converter3;
            pv3VboostText.DataContext  = currConfig;
            //channels
            channel1Grid.DataContext   = channel1;
            ch1OnDelText.DataContext   = currConfig;
            ch1OffDelText.DataContext  = currConfig;
            ch1CurrOutText.DataContext = channel1;
            ch1Light.DataContext       = channel1;
            ch1NormalText.DataContext  = currConfig;
            ch1SafeText.DataContext    = currConfig;

            channel2Grid.DataContext   = channel2;
            ch2OnDelText.DataContext   = currConfig;
            ch2OffDelText.DataContext  = currConfig;
            ch2CurrOutText.DataContext = channel2;
            ch2Light.DataContext       = channel2;
            ch2NormalText.DataContext  = currConfig;
            ch2SafeText.DataContext    = currConfig;

            channel3Grid.DataContext   = channel3;
            ch3OnDelText.DataContext   = currConfig;
            ch3OffDelText.DataContext  = currConfig;
            ch3CurrOutText.DataContext = channel3;
            ch3Light.DataContext       = channel3;
            ch3NormalText.DataContext  = currConfig;
            ch3SafeText.DataContext    = currConfig;

            channel4Grid.DataContext   = channel4;
            ch4OnDelText.DataContext   = currConfig;
            ch4OffDelText.DataContext  = currConfig;
            ch4CurrOutText.DataContext = channel4;
            ch4Light.DataContext       = channel4;
            ch4NormalText.DataContext  = currConfig;
            ch4SafeText.DataContext    = currConfig;

            channel5Grid.DataContext   = channel5;
            ch5OnDelText.DataContext   = currConfig;
            ch5OffDelText.DataContext  = currConfig;
            ch5CurrOutText.DataContext = channel5;
            ch5Light.DataContext       = channel5;
            ch5NormalText.DataContext  = currConfig;
            ch5SafeText.DataContext    = currConfig;

            channel6Grid.DataContext   = channel6;
            ch6OnDelText.DataContext   = currConfig;
            ch6OffDelText.DataContext  = currConfig;
            ch6CurrOutText.DataContext = channel6;
            ch6Light.DataContext       = channel6;
            ch6NormalText.DataContext  = currConfig;
            ch6SafeText.DataContext    = currConfig;

            channelQSGrid.DataContext = qs;
            qsOnDelText.DataContext   = currConfig;
            qsOffDelText.DataContext  = currConfig;
            qsLight.DataContext       = qs;
            qsNormalText.DataContext  = currConfig;
            qsSafeText.DataContext    = currConfig;

            channelQHGrid.DataContext = qh;
            qhOnDelText.DataContext   = currConfig;
            qhOffDelText.DataContext  = currConfig;
            qhLight.DataContext       = qh;
            qhNormalText.DataContext  = currConfig;
            qhSafeText.DataContext    = currConfig;

            //current config
            confGrid.DataContext = currConfig;
            //battery heater
            batteryHeaterGrid.DataContext = heater;
            heaterModeText.DataContext    = currConfig;
            heatLowText.DataContext       = currConfig;
            heatHighText.DataContext      = currConfig;

            battHeatBorder.DataContext = heater;
            //WDTs
            wdtI2CGrid.DataContext  = i2c;
            wdtGNDGrid.DataContext  = gnd;
            wdtCSP0Grid.DataContext = csp0;
            wdtCSP1Grid.DataContext = csp1;

            //other
            lastResetText.DataContext = eps;
            numRebootText.DataContext = eps;
            numErrorsText.DataContext = eps;

            /*Task.Factory.StartNew(() => Thread.Sleep(1000))
             * .ContinueWith((t) =>
             * {
             *  eps.BatteryDrop();
             * }, TaskScheduler.FromCurrentSynchronizationContext());
             */
            // Create a timer
            myTimer = new System.Timers.Timer();
            // Tell the timer what to do when it elapses
            myTimer.Elapsed += new ElapsedEventHandler(MyEvent);
            // Set it to go off every five seconds
            myTimer.Interval = 1000;
            // And start it
            myTimer.Enabled = true;

            // Implement a call with the right signature for events going off
        }