/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
List <double> NumInputs = new List <double>();
List <LinguisticVariable> InputVars = new List <LinguisticVariable>();
List <LinguisticVariable> OutputVars = new List <LinguisticVariable>();
List <string> Rules = new List <string>();
AForge.Fuzzy.InferenceSystem IS = null;
string VarName = null;
double FailsafeVal = double.NaN;
if (!DA.GetData(0, ref IS))
{
return;
}
if (!DA.GetData(1, ref VarName))
{
return;
}
if (!DA.GetData(2, ref FailsafeVal))
{
return;
}
try
{
double outVal = IS.Evaluate(VarName);
DA.SetData(0, outVal);
DA.SetData(1, false);
}
catch (Exception)
{
DA.SetData(0, FailsafeVal);
DA.SetData(1, true);
}
}