def test_basu_to_moore_input():

    basu = bicycle.basu_table_one_input()

    lam = pi / 10.
    rr = 0.3

    mooreInput = bicycle.basu_to_moore_input(basu, rr, lam)
    for k, v in mooreInput.items():
        print k, ':', v
# reminder: u1--yaw rate, u2--roll rate, u3--pitch rate, u4--steer rate, u5--rear wheel ang. vel., u6--front wheel ang. vel.

# kane.kindiffeq(kinematical)
(fr, frstar) = kane.kanes_equations(forceList, bodyList)
kdd = kane.kindiffdict()

bp = bi.benchmark_parameters()

mp = bi.benchmark_to_moore(bp)

rr = bp["rR"]
lam = bp["lam"]

basu_input = bi.basu_table_one_input()

mo_in = bi.basu_to_moore_input(basu_input, rr, lam)

# not include the l1, l2, mc and ic because of the rider
# which will be added into instrumented bicycle later.
para_dict = {
    l1: mp["l1"],
    l2: mp["l2"],
    l3: mp["l3"],
    l4: mp["l4"],
    mc: mp["mc"],
    md: mp["md"],
    me: mp["me"],
    mf: mp["mf"],
    rR: mp["rr"],
    rF: mp["rf"],
    g: mp["g"],
pathToData='/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data/'
benchmark = bp.Bicycle('Benchmark', pathToData)
benchmarkPar = bp.io.remove_uncertainties(benchmark.parameters['Benchmark'])

# convert to my parameter set
moorePar = bicycle.benchmark_to_moore(benchmarkPar, oldMassCenter=False)

# set the parameters
whip.parameters = moorePar
whip.constants() # make sure the constants are recalculated with the new parameters

# load the input values specified in table one of Basu-Mandal2007
basuInput = bicycle.basu_table_one_input()

# convert the values to my coordinates and speeds
mooreInput = bicycle.basu_to_moore_input(basuInput, benchmarkPar['rR'],
        benchmarkPar['lam'])

# store them in a state array
x = np.array([mooreInput[x] for x in whip.stateNames])

# calculate the derivatives of the state using my model and compare it to
# BasuMandal2007
xd = whip.f(x, 0.)
y = whip.outputs(x)

# convert the outputs from my model to the Basu-Mandal coordinates
mooreOutput = {k : v for k, v in zip(whip.outputNames, y)}
mooreOutputBasu = bicycle.moore_to_basu(mooreOutput, benchmarkPar['rR'], benchmarkPar['lam'])
basuOutput = bicycle.basu_table_one_output()

# make an rst list table
Example #4
0
fr, frstar = kane.kanes_equations(forces, bodies)

# Validation of non-linear equations

print('Loading numerical input parameters.')

from dtk import bicycle

bp = bicycle.benchmark_parameters()
mp = bicycle.benchmark_to_moore(bp)

# load the input values specified in table one of Basu-Mandal2007
basu_input = bicycle.basu_table_one_input()

# convert the values to my coordinates and speeds
moore_input = bicycle.basu_to_moore_input(basu_input, bp['rR'], bp['lam'])

constant_substitutions = {}
for k, v in mp.items():
    try:
        exec('constant_substitutions[{}] = v'.format(k))
    except NameError:
        pass
dynamic_substitutions = {}
for k, v in moore_input.items():
    try:
        exec('dynamic_substitutions[{}] = v'.format(k))
    except NameError:
        pass

substitutions = {T4: 0.0, T6: 0.0, T7: 0.0}
Example #5
0
fr, frstar = kane.kanes_equations(forces, bodies)

# Validation of non-linear equations

print('Loading numerical input parameters.')

from dtk import bicycle

bp = bicycle.benchmark_parameters()
mp = bicycle.benchmark_to_moore(bp)

# load the input values specified in table one of Basu-Mandal2007
basu_input = bicycle.basu_table_one_input()

# convert the values to my coordinates and speeds
moore_input = bicycle.basu_to_moore_input(basu_input, bp['rR'],
        bp['lam'])

constant_substitutions = {}
for k, v in mp.items():
    try:
        exec('constant_substitutions[{}] = v'.format(k))
    except NameError:
        pass
dynamic_substitutions = {}
for k, v in moore_input.items():
    try:
        exec('dynamic_substitutions[{}] = v'.format(k))
    except NameError:
        pass

substitutions = {T4: 0.0, T6: 0.0, T7: 0.0}
Example #6
0
benchmark = bp.Bicycle('Benchmark', pathToData)
benchmarkPar = bp.io.remove_uncertainties(benchmark.parameters['Benchmark'])

# convert to my parameter set
moorePar = bicycle.benchmark_to_moore(benchmarkPar, oldMassCenter=False)

# set the parameters
whip.parameters = moorePar
whip.constants(
)  # make sure the constants are recalculated with the new parameters

# load the input values specified in table one of Basu-Mandal2007
basuInput = bicycle.basu_table_one_input()

# convert the values to my coordinates and speeds
mooreInput = bicycle.basu_to_moore_input(basuInput, benchmarkPar['rR'],
                                         benchmarkPar['lam'])

# store them in a state array
x = np.array([mooreInput[x] for x in whip.stateNames])

# calculate the derivatives of the state using my model and compare it to
# BasuMandal2007
xd = whip.f(x, 0.)
y = whip.outputs(x)

# convert the outputs from my model to the Basu-Mandal coordinates
mooreOutput = {k: v for k, v in zip(whip.outputNames, y)}
mooreOutputBasu = bicycle.moore_to_basu(mooreOutput, benchmarkPar['rR'],
                                        benchmarkPar['lam'])
basuOutput = bicycle.basu_table_one_output()