Download
(right-click and "save as")
# @author: hkim
# @version: 1
# @description: test
# @keywords: java, test
# className can be relative to the wrapper's folder or absolute path
# "classes/Wing.java#Wing"
# "C:/<User_DIR>/Application Data/Phoenix Integration/AServer<VERSION>/analyses/wrappers/classes/Wing.java#Wing"
# "file:///C:/<User_DIR>/Application Data/Phoenix Integration/AServer<VERSION>/analyses/wrappers/classes/Wing.java#Wing"
variable: wingInput object input className="./classes/Wing.java#Wing"
variable: wingOutput object output className="./classes/Wing.java#Wing"
variable: wingArea double output
variable: aspectRatio double output
# ------------------------------------------
script: language="java"
void run()
{
double rootChord = wingInput.getDoubleMemberValue("rootChord");
double tipChord = wingInput.getDoubleMemberValue("tipChord");
double halfSpan = wingInput.getDoubleMemberValue("halfSpan");
double wingArea0 = halfSpan*(rootChord + tipChord);
double aspectRatio0 = 4*halfSpan*halfSpan/wingArea0;
// copy values from wingInput to wingOutput. Alternatively use toXML()/fromXML();
// wingOutput.fromXML(wingInput.toXML());
wingOutput.setDoubleMemberValue("rootChord", wingInput.getDoubleMemberValue("rootChord"));
wingOutput.setDoubleMemberValue("tipChord", wingInput.getDoubleMemberValue("tipChord"));
wingOutput.setDoubleMemberValue("halfSpan", wingInput.getDoubleMemberValue("halfSpan"));
wingOutput.setDoubleMemberValue("sweep", wingInput.getDoubleMemberValue("sweep"));
wingOutput.setDoubleMemberValue("airfoil.thickness", wingInput.getDoubleMemberValue("airfoil.thickness"));
wingOutput.setDoubleMemberValue("airfoil.LERadius", wingInput.getDoubleMemberValue("airfoil.LERadius"));
// call methods
double wingArea1 = wingOutput.callMethod("getWingArea");
double aspectRatio1 = wingOutput.callMethod("getAspectRatio");
// compare results
if ( java.lang.Math.abs(wingArea0 - wingArea1) > 1.e-10 )
{
throw new Exception("wing area computation does not match");
}
if ( java.lang.Math.abs(aspectRatio0 - aspectRatio1) > 1.e-10 )
{
throw new Exception("aspectRatio computation does not match");
}
wingArea.setValue(wingArea0);
aspectRatio.setValue(aspectRatio0);
}