Ejemplo n.º 1
0
        private void Notify()
        {
            microgrid.NotifyLoaded();
            var uiInputs = FindObjectsOfType <MicrogridInputFields>();

            for (int i = 0; i < uiInputs.Length; i++)
            {
                uiInputs[i].MicrogridToAllUI();
            }
        }
Ejemplo n.º 2
0
        private void Submit()
        {
            for (int i = 0; i < mgInput.tCount; i++)
            {
                mgInput.p_load[i] *= loadMultiplier;
                mgInput.p_w[i]    *= renewableMultiplier;
                mgInput.p_pv[i]   *= renewableMultiplier;
            }

            mgInput.genCount      = generatorEntries.Sum(x => x.Quantity);
            mgInput.thr_c_a       = new float[mgInput.genCount];
            mgInput.thr_c_b       = new float[mgInput.genCount];
            mgInput.thr_c_c       = new float[mgInput.genCount];
            mgInput.thr_min_dtime = new float[mgInput.genCount];
            mgInput.thr_min_utime = new float[mgInput.genCount];
            mgInput.p_thr_max     = new float[mgInput.genCount];

            int iGen = 0;

            for (int i = 0; i < generatorEntries.Count; i++)
            {
                var g = generatorEntries[i];
                for (int j = 0; j < generatorEntries[i].Quantity; j++)
                {
                    mgInput.thr_c_a[iGen]       = g.generator.a;
                    mgInput.thr_c_b[iGen]       = g.generator.b;
                    mgInput.thr_c_c[iGen]       = g.generator.c;
                    mgInput.thr_min_dtime[iGen] = g.generator.minDTime;
                    mgInput.thr_min_utime[iGen] = g.generator.minUTime;
                    mgInput.p_thr_max[iGen]     = g.generator.ratedPower;
                    iGen++;
                }
            }

            mgInput.p_bat_max = batteryRatedPower;
            mgInput.e_bat_max = batteryRatedEnergy;
            mgInput.canBuy    = canBuy;
            mgInput.canSell   = canSell;

            microgrid.NotifyLoaded();
            var uiInputs = FindObjectsOfType <MicrogridInputFields>();

            for (int i = 0; i < uiInputs.Length; i++)
            {
                uiInputs[i].MicrogridToAllUI();
            }

            loadMultiplier      = 1.0f;
            renewableMultiplier = 1.0f;
            Close();
        }