///------------------------------------------------------------------------------------------------- /// <summary> Grab parameter base data.</summary> /// /// <remarks> Quay, 3/1/2018.</remarks> /// /// <param name="SimResults"> The simulation results.</param> /// <param name="ParmType"> Type of the parameter.</param> /// <param name="index"> Zero-based index of the.</param> /// /// <returns> An int if parmtype and index are correct, else returns int.minvalue .</returns> ///------------------------------------------------------------------------------------------------- public int grabParmBaseData(AnnualSimulationResults SimResults, modelParamtype ParmType, int index) { // check if index is 0 or greater if (index >= 0) { // check if this is a provider parameter if ((ParmType == modelParamtype.mptInputBase) || (ParmType == modelParamtype.mptOutputBase)) { switch (ParmType) { case modelParamtype.mptInputBase: if (index < SimResults.Inputs.BaseInput.Values.Length) { return(SimResults.Inputs.BaseInput.Values[index]); } break; case modelParamtype.mptOutputBase: if (index < SimResults.Outputs.BaseOutput.Values.Length) { return(SimResults.Outputs.BaseOutput.Values[index]); } break; default: { break; } } } } return(int.MinValue); }
///------------------------------------------------------------------------------------------------- /// <summary> Constructor. </summary> /// /// <param name="TheModelParam"> the model parameter to create item from. </param> ///------------------------------------------------------------------------------------------------- public ModelParamItem(ModelParameterClass TheModelParam) { FModelParam = TheModelParam.ModelParam; FModelParamName = eModelParam.Names(TheModelParam.ModelParam); FFieldname = TheModelParam.Fieldname;; FLabel = TheModelParam.Label; if (TheModelParam.isExtended) { FDescrip = TheModelParam.Description; FUnitsShort = TheModelParam.Units; FUnitsLong = TheModelParam.UnitsLong; if (TheModelParam.TopicGroups != null) { if (TheModelParam.TopicGroups.Count > 0) { foreach (ModelParameterGroupClass MPG in TheModelParam.TopicGroups) { FTopics.Add(MPG); } } } } FMax = TheModelParam.HighRange; FMin = TheModelParam.LowRange; FRangeType = TheModelParam.RangeCheckType; FDepends = TheModelParam.DerivedFrom; //int Default = 0; FParamType = TheModelParam.ParamType; if ((TheModelParam.isProviderParam) && (TheModelParam.ProviderProperty != null)) { FProvAgMode = TheModelParam.ProviderProperty.AggregateMode; FProviderPropertyName = TheModelParam.ProviderProperty.GetType().FullName; } }
// protected providerArrayProperty FDefaultValues; /// <summary> Constructor. </summary> /// /// <remarks> For now this constructor is hidden </remarks> /// /// <param name="aModelParam"> a model parameter. </param> /// <param name="aLabel"> a label. </param> /// <param name="aFieldname"> a fieldname. </param> /// <param name="aParamType"> Type of a parameter. </param> /// <param name="aRangeCheckType"> Type of a range check. </param> /// <param name="aLowRange"> a low range. </param> /// <param name="aHighRange"> a high range. </param> /// <param name="specialBaseRangeCheck"> The special base range check. </param> /// <param name="specialProviderRangeCheck"> The special provider range check. </param> /// <param name="Providerproperty"> The providerproperty. </param> /// <param name="DefaultValue"> The default value for simulating a model reset</param> internal ShadowBaseModelParameter(int aModelParam, string aLabel, string aFieldname, modelParamtype aParamType, rangeChecktype aRangeCheckType, int aLowRange, int aHighRange, DcheckBase specialBaseRangeCheck, int DefaultValue) : base() { FModelParam = aModelParam; FLabel = aLabel; FFieldname = aFieldname; Ftype = aParamType; FRangeCheckType = aRangeCheckType; FLowRange = aLowRange; FHighRange = aHighRange; FSpecialBaseCheck = specialBaseRangeCheck; FSpecialProviderCheck = null; FProviderProperty = null; FValue = FDefault = DefaultValue; // FReload = ReloadValuesOnSet; }
///------------------------------------------------------------------------------------------------- /// <summary> Constructor. </summary> /// <param name="AChart"> The chart. </param> /// <param name="ChartTitle"> The chart title. </param> ///------------------------------------------------------------------------------------------------- ///------------------------------------------------------------------------------------------------- /// <summary> Grab parameter provider data.</summary> /// /// <remarks> Quay, 3/1/2018.</remarks> /// /// <param name="SimResults"> The simulation results.</param> /// <param name="ParmType"> Type of the parameter.</param> /// <param name="index"> Zero-based index of the.</param> /// /// <returns> An int[] if parmtype an index are correct, else returns a null</returns> ///------------------------------------------------------------------------------------------------- public int[] grabParmProviderData(AnnualSimulationResults SimResults, modelParamtype ParmType, int index) { // check if index is 0 or greater if (index >= 0) { // check if this is a provider parameter if ((ParmType == modelParamtype.mptInputProvider) || (ParmType == modelParamtype.mptOutputProvider)) { switch (ParmType) { case modelParamtype.mptInputProvider: if (index < SimResults.Inputs.ProviderInput.Length) { { return(SimResults.Inputs.ProviderInput.Values[index].Values); } } break; case modelParamtype.mptOutputProvider: if (index < SimResults.Outputs.ProviderOutput.Length) { { return(SimResults.Outputs.ProviderOutput.Values[index].Values); } } break; default: { break; } } } } return(null); }