Beispiel #1
0
        public void GomEpsInitialize_repeat_Test()
        {
            GomEPS gom = new GomEPS();

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsInitialize(add, 1));
            Assert.AreEqual(Constants.E_IS_INITIALIZED, gom.GomEpsInitialize(add, 1));
        }
Beispiel #2
0
        public void GomEpsConfig2CMD_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsConfig2CMD(0, 1));
        }
Beispiel #3
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));
        }
Beispiel #4
0
        public void GomEpsSetPhotovoltaicInputs_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsSetPhotovoltaicInputs(1, 7000, 7200, 7400));
        }
Beispiel #5
0
        public void GomEpsSoftReset_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsSoftReset(1));
        }
Beispiel #6
0
        public void GomEpsConfig2CMD_invalid_input_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Assert.AreEqual(Constants.E_INVALID_INPUT, gom.GomEpsConfig2CMD(0, 6));
        }
Beispiel #7
0
        public void GomEpsSetPhotovoltaicInputs_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsSetPhotovoltaicInputs(0, 7000, 7200, 7400));
        }
Beispiel #8
0
        public void GomEpsSoftReset_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsSoftReset(0));
        }
Beispiel #9
0
        public void GomEpsConfig2Set_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            EPS.eps_config2_t conf = new EPS.eps_config2_t();
            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsConfig2Set(0, conf));
        }
Beispiel #10
0
        public void GomEpsSetPhotovoltaicInputs_invalid_action_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            gom.eps_table[0].CurrentConfig.PptMode = PPTMode.MPPT;
            Assert.AreEqual(Constants.E_INVALID_ACTION, gom.GomEpsSetPhotovoltaicInputs(0, 7000, 7200, 7400));
        }
Beispiel #11
0
        public void GomEpsConfig2Set_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            EPS.eps_config2_t conf = new EPS.eps_config2_t();
            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsConfig2Set(1, conf));
        }
Beispiel #12
0
        public void GomEpsSetPptMode_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte mode = 1;

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsSetPptMode(0, mode));
        }
Beispiel #13
0
        public void GomEpsGetHkData_basic_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <EPS.eps_hk_basic_t> output = new Output <EPS.eps_hk_basic_t>();

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsGetHkData_basic(1, output));
        }
Beispiel #14
0
        public void GomEpsSetPptMode_not_invalid_input_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte mode = 3;

            Assert.AreEqual(Constants.E_INVALID_INPUT, gom.GomEpsSetPptMode(0, mode));
        }
Beispiel #15
0
        public void GomEpsGetHkData_basic_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <EPS.eps_hk_basic_t> output = new Output <EPS.eps_hk_basic_t>();

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsGetHkData_basic(0, output));
        }
Beispiel #16
0
        public void GomEpsSetOutput_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte outputs = 255;

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsSetOutput(1, outputs));
        }
Beispiel #17
0
        public void GomEpsSetOutput_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte outputs = 255;

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsSetOutput(0, outputs));
        }
Beispiel #18
0
        public void GomEpsSetPptMode_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte mode = 1;

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsSetPptMode(1, mode));
        }
Beispiel #19
0
        public void GomEpsPing_eps_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <Byte> output = new Output <Byte>();

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsPing(0, 1, output));
        }
Beispiel #20
0
        public void GomEpsPing_eps_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <Byte> output = new Output <Byte>();

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsPing(1, 1, output));
        }
Beispiel #21
0
        public void GomEpsConfigGet_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <EPS.eps_config_t> conf = new Output <EPS.eps_config_t>();

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsConfigGet(0, conf));
        }
Beispiel #22
0
        public void GomEpsPing_eps_right_ping_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <Byte> output = new Output <Byte>();

            gom.GomEpsPing(0, 1, output);
            Assert.AreEqual(1, output.output);
        }
Beispiel #23
0
        public void GomEpsSetSingleOutput_invalid_value_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte channelId = 5;
            byte val       = 2;

            Assert.AreEqual(Constants.E_INVALID_INPUT, gom.GomEpsSetSingleOutput(0, channelId, val, 1));
        }
Beispiel #24
0
        public void GomEpsSetSingleOutput_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte channelId = 5;
            byte val       = 1;

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsSetSingleOutput(1, channelId, val, 1));
        }
Beispiel #25
0
        public void GomEpsSetSingleOutput_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            byte channelId = 5;
            byte val       = 1;

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsSetSingleOutput(0, channelId, val, 1));
        }
Beispiel #26
0
        public void GomEpsSetHeaterAutoMode_not_an_index_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <ushort> output = new Output <ushort>();
            byte            mode   = 1;

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsSetHeaterAutoMode(1, mode, output));
        }
Beispiel #27
0
        public void GomEpsSetHeaterAutoMode_no_error_Test()
        {
            GomEPS gom = new GomEPS();

            gom.GomEpsInitialize(add, 1);
            Output <ushort> output = new Output <ushort>();
            byte            mode   = 1;

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsSetHeaterAutoMode(0, mode, output));
        }
Beispiel #28
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
        }
Beispiel #29
0
        public void GomEpsInitialize_n_greater_then_1_Test()
        {
            GomEPS gom = new GomEPS();

            Assert.AreEqual(Constants.E_NO_SS_ERR, gom.GomEpsInitialize(add, 2));
        }
Beispiel #30
0
        public void GomEpsInitializeRepeat_incorrect_number_Test()
        {
            GomEPS gom = new GomEPS();

            Assert.AreEqual(Constants.E_INDEX_ERROR, gom.GomEpsInitialize(add, 0));
        }