Пример #1
0
        private PVResults ExecuteCalculation([NotNull] Module module, [NotNull] Tooling.SAM.Data data, double powerinKw, PVSystemKey key)
        {
            if (!module.Exec(data))
            {
                var idx = 0;
                while (module.Log(idx, out string msg, out int type, out float time))
                {
                    var stype = "NOTICE";
                    if (type == API.WARNING)
                    {
                        stype = "WARNING";
                    }
                    else if (type == API.ERROR)
                    {
                        stype = "ERROR";
                    }

                    Info("[" + stype + " at time : " + time + "]: " + msg + " for azimut " + key.Azimut + " tilt: " + key.Tilt + " power " +
                         powerinKw);
                    idx++;
                }

                throw new FlaException("something went wrong");
            }

            //data.GetNumber("annual_energy"),
            var r = new PVResults(data.GetNumber("capacity_factor"), data.GetNumber("kwh_per_kw"), data.GetArrayAsList("ac"), powerinKw, key);

            return(r);
        }
Пример #2
0
        public Profile Run([NotNull] RunningConfig config)
        {
            var data   = new Tooling.SAM.Data();
            var module = InitializeModule(data, PVSystemKey, AcPower, DcAcRatio, config);
            var result = ExecuteCalculation(module, data, AcPower, PVSystemKey);

            Info("Processing setting " + _idx);
            Result = result;
            Profile p = result.GetProfile();
            Profile pa;

            if ((p.Values.Count > 500000) & (p.Values.Count < 600000))
            {
                //1 minute resolution, need to reduce.
                pa = p.ReduceTimeResolutionFrom1MinuteTo15Minutes();
            }
            else if (p.Values.Count > 35000 && p.Values.Count < 36000)
            {
                pa = p;
            }
            else
            {
                throw new FlaException("Unknown time resolution");
            }

            return(pa);
        }