Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate FDM input files for H-Plane #87

Open
umesh-timalsina opened this issue Aug 20, 2021 · 2 comments
Open

Generate FDM input files for H-Plane #87

umesh-timalsina opened this issue Aug 20, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@umesh-timalsina
Copy link
Contributor

umesh-timalsina commented Aug 20, 2021

It might be necessary to generate input files for FDM execution. This is how swri does it when there's a wing in the design(Showing snippet just for wings)

 for i, x in enumerate(wingComponentNames):
            pi = i + 1
            fdIn.write("\n!   Wing (" + str(pi) + ") is component named: " + wingComponentNames[i] + "\n")
            chord = allProperties["Wing_CHORD"][3][i]
            span = allProperties["Wing_SPAN"][3][i]
            fdIn.write("   wing(" + str(pi) + ")%surface_area   = " + str(float(span) / 2.0 * float(chord)) + " \n")
            dcl_daoa_slope = allProperties["Wing_dCl_dAoA_Slope"][3][i]
            aoa_l0 = allProperties["Wing_AoA_L0"][3][i]
            fdIn.write("   wing(" + str(pi) + ")%a   = " + dcl_daoa_slope + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_L0   = " + str(-float(dcl_daoa_slope) * float(aoa_l0)) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_Lmax   = " + allProperties["Wing_CL_Max"][3][i] + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_Lmin   = -" + allProperties["Wing_CL_Max"][3][i] + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_D0   = " + allProperties["Wing_CD_Min"][3][i] + " \n")
            fdIn.write(
                "   wing(" + str(pi) + ")%k   = " + str(1.0 / (3.14159 * 0.85 * float(span) / float(chord))) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_Dfp   = 1 \n")
            fdIn.write("   wing(" + str(pi) + ")%bias1   = " + allProperties["Wing_Aileron_Bias"][3][i] + " \n")
            fdIn.write("   wing(" + str(pi) + ")%bias2   = " + allProperties["Wing_Flap_Bias"][3][i] + " \n")
            # TAB: 8/17/2021: Separate control channels for each wing 
            fdIn.write("   wing(" + str(pi) + ")%icontrol1 = " + str(num_propellers + (i*2) + 1) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%icontrol2 = " + str(num_propellers + (i*2) + 2) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%tau_a = " + str(0.4) + " \n")
            
            wingName = wingComponentNames[i]
            pointName = wingName + ".PNT0"
            p0 = pointDict[pointName]
            pointName = wingName + ".PNT1"
            p1 = pointDict[pointName]
            pointName = wingName + ".WING_CENTER_PT"
            pc = pointDict[pointName]
            fdIn.write("   wing(" + str(pi) + ")%x   = " + str(pc[0]) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%y   = " + str(pc[1]) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%z   = " + str(pc[2]) + "\n")

            vx = (p0[0] - p1[0])
            vy = (p0[1] - p1[1])
            vz = (p0[2] - p1[2])
            dd = math.sqrt(vx * vx + vy * vy + vz * vz)
            if dd > 0:
                vx = vx / dd
                vy = vy / dd * -1
                vz = vz / dd * -1

            fdIn.write("   wing(" + str(pi) + ")%nx   = " + str(vx) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%ny   = " + str(vy) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%nz   = " + str(vz) + "\n")
@umesh-timalsina umesh-timalsina self-assigned this Aug 20, 2021
@umesh-timalsina umesh-timalsina added the enhancement New feature or request label Aug 20, 2021
@umesh-timalsina
Copy link
Contributor Author

umesh-timalsina commented Aug 20, 2021

 "left_NACA_4421": {
    "CM0": "-0.071",
    "CL_Max_CD0_Min": "104",
    "AILERON_BIAS": "none",
    "AoA_L0": "-3.4",
    "SERVO_WIDTH": "none",
    "CL_Max": "1.37",
    "CD_Min": "0.0133",
    "SPAN": "none",
    "CONTROL_CHANNEL_AILERONS": "none",
    "AoA_CL_Max": "19",
    "SERVO_LENGTH": "none",
    "CONTROL_CHANNEL_FLAPS": "none",
    "dCl_dAoA_Slope": "0.093",
    "LD_Max": "17.7",
    "TUBE_OFFSET": "none",
    "Model": "NACA_4421",
    "CL_LD_Max": "0.44",
    "CD0_Min": "0.0132",
    "FLAP_BIAS": "none",
    "CHORD": "none",
    "OFFSET": "none",
    "DIAMETER": "none",
    "LASTTWO": "21",
    "Classification": "Wing"
  },

This is what is in the database. It looks like #30 needs to be merged before this can be done

@umesh-timalsina
Copy link
Contributor Author

Now that #30 is merged, this PR only depends on #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant