Example #1
0
        public readonly float height; //in meters

        public GISData(GISDataBuilder b)
        {
            tilt      = b.mtilt;
            azimuth   = b.mazimuth;
            latitude  = b.mlatitude;
            longitude = b.mlongitude;
            width     = b.mwidth;
            height    = b.mheight;
        }
Example #2
0
        public readonly float width; //in meters

        #endregion Fields

        #region Constructors

        public GISData(GISDataBuilder b)
        {
            tilt = b.mtilt;
            azimuth = b.mazimuth;
            latitude = b.mlatitude;
            longitude = b.mlongitude;
            width = b.mwidth;
            height = b.mheight;
        }
Example #3
0
        /// <summary>
        /// Demo of the SAM API implemented by J. Ranalli on 8/21/14
        /// </summary>
        static void SAMRewriteTest()
        {
            //===Create the high level inputs===
            //From GIS
            GISData gis = new GISDataBuilder()
                .azimuth(180)
                .tilt(20)
                .latitude(39.53f)
                .longitude(-75.15f)
                .width(1.7f)
                .height(14.5f)
                .build();
            //From User Input
            GUIData gui = new GUIDataBuilder()
                .analysis_years(25)
                .cost_per_watt_dc(0)
                .discount_rate(8)
                .inflation_rate(2.5f)
                .loan_rate(7.5f)
                .loan_term(25)
                .loan_debt(100)
                .srec_price(50f)
                .utility_ann_escal_rate(0.5f)
                .utility_monthly_fixed_cost(0)
                .utility_price_to_compare(0.12f)
                .enable_incentives(true)
                .build();

            //===Run the model for one year===
            Stopwatch s = new Stopwatch(); s.Start();
            PVSystemModel pv = GUITranslator.runModel(gis, gui); // This is the model run command
            s.Stop(); Console.WriteLine("\nRuntime: " + s.ElapsedMilliseconds + "ms \n\n");

            //===Example Uses of the Output For Single Year===
            Console.WriteLine("Nameplate Capacity: " + pv.getNameplateCapacity() + " kWDC");
            Console.WriteLine("Inverter Capacity: " + pv.getInverterACCapacity() + " WAC");
            Console.WriteLine("Total System Cost: $" + pv.getSystemCost());
            Console.WriteLine("Cost Per Watt: $" + pv.getCostPerWatt());

            Console.WriteLine("Year One Power Produced: " + pv.getYearOneOutput() + " kWh");
            Console.WriteLine("Value of energy in Year 1: $" + pv.getAnnualValueOfEnergyProduced()[0]);
            Console.WriteLine("Net Present Value: $" + pv.getNetPresentValue());

            Console.WriteLine("-----");
            float[] yrbyyrvalue = pv.getAnnualValueOfEnergyProduced();
            for (int i = 0; i < yrbyyrvalue.Length; i++)
            {
                //Console.WriteLine(yrbyyrvalue[i]);
            }

            /*
            //===Run the model for multiple years===
            Stopwatch s2 = new Stopwatch(); s.Start();
            int[] years = new int[] { 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 };
            MultiplePVSystemModel pv2 = GUITranslator.multiRunModel(gis, gui, years); // This is the model run command
            s2.Stop(); Console.WriteLine("\nRuntime: " + s.ElapsedMilliseconds + "ms \n\n");

            //===Example Uses of the Output for Multiple Year===
            float[] multival = pv2.getYearOneOutput();
            for (int i = 0; i < multival.Length; i++)
            {
                Console.WriteLine(multival[i]);
            }
            double average = multival.Average();
            double sumOfSquaresOfDifferences = multival.Select(val => (val - average) * (val - average)).Sum();
            double sd = Math.Sqrt(sumOfSquaresOfDifferences / multival.Length);
            Console.WriteLine("Average: "+average+",  STD: " + sd);
             */
        }
Example #4
0
        static void ridiculousRewrite()
        {
            GISData gis = new GISDataBuilder()
                .azimuth(180)
                .tilt(20)
                .latitude(39.53f)
                .longitude(-75.15f)
                .width(1.7f)
                .height(14.5f)
                .build();

            GUIData gui = new GUIDataBuilder()
                .analysis_years(25)
                .cost_per_watt_dc(0)
                .use_cost_per_watt(false)
                .discount_rate(8)
                .inflation_rate(2.5f)
                .loan_rate(7.5f)
                .loan_term(25)
                .loan_debt(100)
                .srec_price(50f)
                .utility_ann_escal_rate(0.5f)
                .utility_monthly_fixed_cost(0)
                .utility_price_to_compare(0.12f)
                .enable_incentives(true)
                .build();

            CompiledOutputData cod = PVSystemFullRun.run(gis,gui);

            //===Example Uses of the Output For Single Year===
            Console.WriteLine("Nameplate Capacity: " + cod.getSizeAndCostSettings().dc_rating + " kWDC");
            Console.WriteLine("Inverter Capacity: " + cod.getSizeAndCostSettings().ac_rating + " WAC");
            Console.WriteLine("Total System Cost: $" + cod.getSizeAndCostSettings().total_cost);
            Console.WriteLine("Cost Per Watt: $" + cod.getSizeAndCostSettings().cost_per_watt_dc);

            Console.WriteLine("Year One Power Produced: " + cod.getPVSAMV1Output().ac_annual + " kWh");
            Console.WriteLine("Value of energy in Year 1: $" + cod.getUtilityRateOutput().energy_value[0]);
            Console.WriteLine("Net Present Value: $" + cod.getCashLoanOutput().npv);
        }