Пример #1
0
        private static Module InitializeModule([NotNull] Tooling.SAM.Data data,
                                               PVSystemKey key,
                                               float powerinKw,
                                               float dcAcRatio,
                                               [NotNull] RunningConfig config)
        {
            data.SetString("solar_resource_file", Path.Combine(config.Directories.SamDirectory, "2050_V1_1.csv"));
            // data.SetString( "solar_resource_file", "C:/Users/Pan2/Downloads/weather/tmy_era_47.056_7.585_2005_2014.epw" );
            data.SetNumber("system_capacity", powerinKw);
            data.SetNumber("module_type", 0f);
            data.SetNumber("dc_ac_ratio", dcAcRatio);
            data.SetNumber("inv_eff", 96f);
            data.SetNumber("losses", 14.075660705566406f);
            data.SetNumber("array_type", 0f);
            data.SetNumber("tilt", key.Tilt);
            data.SetNumber("azimuth", key.Azimut);
            data.SetNumber("gcr", 0.40000000596046448f);
            data.SetNumber("adjust:constant", 0f);
            var module = new Module("pvwattsv5");

            if (null == module)
            {
                throw new FlaException("error: could not create 'pvwattsv5' module.");
            }

            return(module);
        }
        public void TestPVSystemKey()
        {
            PVSystemKey pk1 = new PVSystemKey(10, 10, 2050);
            PVSystemKey pk2 = new PVSystemKey(10, 10, 2050);

            Assert.Equal(pk1, pk2);
            Assert.True(pk1 == pk2);
        }
Пример #3
0
 public PVSystemSettings(PVSystemKey key, float acPower, float dcAcRatio, [NotNull] ILogger logger, int idx) : base(logger,
                                                                                                                    Stage.ProfileGeneration,
                                                                                                                    nameof(PVSystemSettings))
 {
     PVSystemKey = key;
     AcPower     = acPower;
     DcAcRatio   = dcAcRatio;
     _idx        = idx;
 }
Пример #4
0
        public void RunPVTest()
        {
            PVSystemKey      key = new PVSystemKey(0, 30, 2050);
            PVSystemSettings pvs = new PVSystemSettings(key, 1, 1, Logger, 1);

            Directory.SetCurrentDirectory(Config.Directories.SamDirectory);
            var pvprofile = pvs.Run(Config);

            Logger.Info("Total Energy: " + pvprofile.EnergySum(), Stage.Testing, "RunPVTest");
        }
 public PVResults(double capacityFactor, double kwhPerKW, [NotNull] List <float> pvProfile,
                  double maxPower, PVSystemKey key)
 {
     //AnnualEnergy = annualEnergy;
     CapacityFactor = capacityFactor;
     KwhPerKW       = kwhPerKW;
     PVProfile      = pvProfile;
     MaxPower       = maxPower;
     Key            = key;
 }
        private PVSystemKey MakeKeyFromPVArea([NotNull] PVSystemArea area)
        {
            PVSystemKey key = new PVSystemKey((int)area.Azimut, (int)area.Tilt, Slice.DstYear);

            return(key);
        }
Пример #7
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);
        }