///------------------------------------------------------------------------------------------------- /// <summary> Fetches a data. </summary> /// /// <param name="year"> The year. </param> /// <param name="TheASR"> [in,out] the AnnualSimulationResults </param> ///------------------------------------------------------------------------------------------------- internal void fetchData(int year, ref SimulationResults SimResults) { int datai = 0; int index = year - Sim_StartYear; // changed 7 26 11 _SimulationDB_Start_Year; if ((index >= 0) & (index < SimResults.Length)) { int BaseOutputSize = ParamManager.NumberOfParameters(modelParamtype.mptOutputBase); int ProviderOutputSize = ParamManager.NumberOfParameters(modelParamtype.mptOutputProvider); int BaseInputSize = ParamManager.NumberOfParameters(modelParamtype.mptInputBase); int ProviderInputSize = ParamManager.NumberOfParameters(modelParamtype.mptInputProvider); datai = 0; AnnualSimulationResults TheASR = new AnnualSimulationResults(BaseOutputSize, ProviderOutputSize, BaseInputSize, ProviderInputSize, FIncludeAggregates); try { foreach (ModelParameterClass MP in ParamManager.BaseOutputs()) { TheASR.Outputs.BaseOutput[datai] = MP.Value; TheASR.Outputs.BaseOutputModelParam[datai] = MP.ModelParam; datai++; } } catch (Exception ex) { bool check = true; } datai = 0; foreach (ModelParameterClass MP in ParamManager.BaseInputs()) { TheASR.Inputs.BaseInput[datai] = MP.Value; TheASR.Inputs.BaseInputModelParam[datai] = MP.ModelParam; datai++; } datai = 0; foreach (ModelParameterClass MP in ParamManager.ProviderOutputs()) { // OK this is a bit complicated becuase of Aggregates if ((!TheASR.Outputs.AggregatesIncluded) || (MP.ProviderProperty.AggregateMode == eProviderAggregateMode.agNone)) { TheASR.Outputs.ProviderOutput[datai] = MP.ProviderProperty.getvalues(); } else { for (int i = 0; i < TheASR.Outputs.ProviderOutput[datai].Length; i++) { int tempVal = MP.ProviderProperty[i]; TheASR.Outputs.ProviderOutput[datai].Values[i] = tempVal; } } TheASR.Outputs.ProviderOutputModelParam[datai] = MP.ModelParam; datai++; } datai = 0; foreach (ModelParameterClass MP in ParamManager.ProviderInputs()) { // OK this is a bit complicated becuase of Aggregates if ((!TheASR.Inputs.AggregatesIncluded) || (MP.ProviderProperty.AggregateMode == eProviderAggregateMode.agNone)) { TheASR.Inputs.ProviderInput[datai] = MP.ProviderProperty.getvalues(); } else { TheASR.Inputs.ProviderInput.Values[datai] = MP.ProviderProperty.getvalues(); //for (int i = 0; i < TheASR.Inputs.ProviderInput[datai].Length; i++) //{ // int tempVal = MP.ProviderProperty[i]; // TheASR.Inputs.ProviderInput[datai].Values[i] = tempVal; //} } //TheASR.Inputs.ProviderInput[datai] = MP.ProviderProperty.getvalues(); TheASR.Inputs.ProviderInputModelParam[datai] = MP.ModelParam; datai++; } TheASR.year = year; SimResults[index] = TheASR; } }