Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

Car is an object defined in car_model.py that consumes a self, m, Crr, CdA, max_force, speed_min_ms, speed_max_ms

...

The force_req() function

  • Parameters

    • v: (Numbersfloat) final velocity of the car to accelerate to, (m/s)

    • vwind: (Numbersfloat) velocity of the wind relative to the car, (m/s)

    • v_old: (Numbersfloat) initial velocity of the car, (m/s)

    • theta: (Numbersfloat) angle that must be climbed (radians) personally don’t understand why “climb” matters and not just angle of elevation

    • timestep: (Numbersfloat) Time between measurements, (s)

      • usually calculated dist / ((v + old_v)/2), dist being the distance between two points in elevation profile, e_profile.

  • Returns

    • Fmotor: (Numbersfloat) Force of motors required to accelerate to a certain velocity in a certain time (N)

  • Note

    • If v or v_old greater than maximum speed or less than minimum speed, it is caught in the function and whatever is out of bounds is set to maximum speed or minimum speed

    • Ffric, Fdrag , Fg , Fa, and ultimately Fmotor to be all calculated inside the function, using parameters and constants

The max_velocity() function

  • Parameters

    • v_old: (Numbersfloat) final velocity initial speed of the car to accelerate to, (m/s)

    • vwind: (Numbersfloat) velocity of the wind relative to the car, (m/s)v_old: (Numbers) initial velocity of the car, (m/s)

    • theta: (Numbersfloat) angle that must be climbed (radians) personally don’t understand why “climb” matters and not just angle of elevation

    • timestep: (Numbersfloat) Time between measurements, (s)

      • usually calculated dist / ((v + old_v)/2), dist being the distance between two points in elevation profile, e_profile.

  • Returns

    Fmotor: (Numbers) Force of motors required to accelerate to a certain velocity in

    Returns

    • max_v: (float) Maximum final velocity after a certain time (Nm/s)

  • Note

    • If v or v_old greater than maximum speed or less than minimum speed, it is caught in the function and whatever is out of bounds is set to maximum speed or minimum speedFfric, Fdrag , Fg , Fa, and ultimately Fmotor to be all calculated inside the function, using parameters and constants

  • We believe that this function has an error.

 max_v = v_old - self.force_req(v_old, vwind=vwind, theta=theta) + self.max_force * timestep

We are doing (velocity) - (force) + (impulse) to get final velocity. What are we doing here??

Also, considering that v_old is the initial velocity, and since timestepis usually calculated before the function call to be distance/v_old , it does not account for the gradual change of velocity. Throughout the code, we believe that the usage of velocity is inconsistent.

We propose that we use distance to calculate the maximum velocity.

The energy_used() function

  • Parameters

    • v_profile: (Numbers) final velocity of the car to accelerate to, float list) A list of the same dimensions as the e_profile with each element representing the average velocity (m/s) vwindrequired for the car to move at each point on the e_profile

    • e_profile: (Numbers) velocity of the wind relative to the car, (m/s, )

    • v_olddistance: (Numbers) initial velocity of the car, (m/s) theta: (Numbers) angle that must be climbed (radians) personally don’t understand why “climb” matters and not just angle of elevation

    • timestep: (Numbers) Time between measurements, (s)

      • usually calculated dist / ((v + old_v)/2), dist being the distance between two points in elevation profile, e_profile.

  • Returns

    • Fmotor: (Numbers) Force of motors required to accelerate to a certain velocity in a certain time (N)

  • Note

    • If v or v_old greater than maximum speed or less than minimum speed, it is caught in the function and whatever is out of bounds is set to maximum speed or minimum speed

    • Ffric, Fdrag , Fg , Fa, and ultimately Fmotor to be all calculated inside the function, using parameters and constants

    • In the objective function (shown below) that we are trying to minimize, it basically returns the value of energy_used()function. Thus in Optimizer we are trying to minimize the return value of energy_used()

Code Block
def objective(v_profile):
        energy = car.energy_used(v_profile, elev_profile, distance=dist_step)  #
        return energy / 1000000

Sample code

Code Block