home › Forums › # Technical Support › Create engine in Netbeans Java › Reply To: Create engine in Netbeans Java
Hi,
Thank You so much. I finally managed to set the engine on my netbeans. The problem was at the “main”code section…seems that when i pasted the code directly to my IDE, some things changed due to HTML coding. But i managed to correct the error.
Concerning the For Loop. I have a few questions. Firstly, what is its function? My supervisor added the following code to my engine and it outputs several values. however i have no clue as to its purpose, because it just gives several outputs for the PD based on the inputs set. Here is the added loop code extract:
public static void main(String[] args) {
Roxanne instance = new Roxanne();
Engine engine = instance.getEngine();
engine.getInputVariable(“TQ”).setInputValue(13.0);
engine.getInputVariable(“WT”).setInputValue(4.9);
for (int j = 0; j < 6; j++) {
double wt = engine.getInputVariable(“WT”).getMinimum() + j * (engine.getInputVariable(“WT”).range() / 20);
for (int i = 0; i < 20; ++i) {
double tq = engine.getInputVariable(“TQ”).getMinimum() + i * (engine.getInputVariable(“TQ”).range() / 20);
engine.getInputVariable(“TQ”).setInputValue(tq);
engine.getInputVariable(“WT”).setInputValue(wt);
engine.process();
double output = engine.getOutputVariable(“PD”).defuzzify();
/* FuzzyLite.logger().info(String.format(
“TQ.input = %s and WT.input=%s-> PD.output = %s”,
Op.str(tq), Op.str(wt), Op.str(pd.defuzzify())));*/
System.out.println(“WT=” + wt + “, TQ” + tq + “->PD=” + output);
}
}
}
Please kindly explain this, especially the FuzzyliteLogger() section and the Op.str section, seeing that our code still run despite us excluding those sections. We used your FOR Loop example to come up with it. There are no errors.
Thank You in advance.