void Start() { guiTranslator = GUITranslator.Instance; //Automatically sets language based on application's language guiTranslator.CheckLanguageAndCode(); //Updates demonstrative text on the scene UIDisplayUpdate(); }
void Awake() { if (Instance == null) { instance = this; } else if (Instance != this) { Destroy(gameObject); } if (!CheckAssets()) { return; } //Get current language. If none is stored, it's set to main language. code = (PlayerPrefs.HasKey("language")) ? PlayerPrefs.GetString("language") : languageManager.MainLanguage.code; CurrentLanguage = languageManager.GetCurrentLanguage(code); }
/// <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); */ }