mardi 5 mai 2015

Calculating Mu (Friction Coefficient) vb.net

I've been working on a vehicle braking distance calculator in vb.net but I've run into a problem where the equation isn't giving the correct answer. The math for getting Mu is to multiply the speed the car is going at in m/s by 2 then divide by 2 multiplied by the final weighted factor of the car multiplied again by gravity which is 9.81. The part of the code causing problems is below.

    Dim i As Double
    Dim o As Double
    Dim z As Double
    Dim v As Double
    Dim sU As Double
    Dim wU As Double
    Dim fU As Double
    Dim G As Double = 9.81
    Dim brakeArray = {2.0, 1.6, 1.3, 1.0, 0.7, 0.4}

    If cboRoad.SelectedIndex = 0 And rdaWno.Checked Then
        sU = 0.75
    ElseIf cboRoad.SelectedIndex = 0 And rdaWyes.Checked Then
        sU = 0.6
    ElseIf cboRoad.SelectedIndex = 1 And rdaWno.Checked Then
        sU = 0.6
    ElseIf cboRoad.SelectedIndex = 1 And rdaWyes.Checked Then
        sU = 0.45
    ElseIf cboRoad.SelectedIndex = 2 And rdaWno.Checked Then
        sU = 0.4
    ElseIf cboRoad.SelectedIndex = 2 And rdaWyes.Checked Then
        sU = 0.26
    End If

(sU is the standard U)

    If cboBrakes.SelectedIndex = 0 Then
        wU = brakeArray(0)
    ElseIf cboBrakes.SelectedIndex = 1 Then
        wU = brakeArray(1)
    ElseIf cboBrakes.SelectedIndex = 2 Then
        wU = brakeArray(2)
    ElseIf cboBrakes.SelectedIndex = 3 Then
        wU = brakeArray(3)
    ElseIf cboBrakes.SelectedIndex = 4 Then
        wU = brakeArray(4)
    ElseIf cboBrakes.SelectedIndex = 5 Then
        wU = brakeArray(5)
    End If

(wU is the weighting factor of the car)

    v = vSpeedMS

    fU = sU * wU
    i = v * 2
    o = 2 * fU * G
    z = i / o

I have tried braking the equation up into smaller pieces but that hasn't helped, along with seraching for an answer on my own but with no luck.

Aucun commentaire:

Enregistrer un commentaire