GreenSim

A mathematical simulator for Greenpower Cars

Terry Barnaby - Rotary Racer - Chipping Sodbury School

Introduction

The Greensim application is a simple web based application written in Python to simulate racing a Greenpower electric car around a track. The idea is to provide a basic test bed so car ideas can be played with together with race tactics. Hopefully the Simulator will be developed and tested against real car behavior to make it better. There is also a simple Car Forces and Motor Temperature  calculator at the following link:
Some information on the Science and Maths of a Greenpower car is at the following link:

Features

Usage

The The Greenpower Car Simulator web page provides a simple interface to the simulator program. At the top of the page is a set of parameters than can be entered. Below these parameters is a "Run Simulation" button. Pressing this runs the simulation with the given parameters and produces the Lap timing results together with graphs or various interesting parameters. Parameters are:
TrackLength The track length in Meters. (Goodwood: 3862.0m, Castle Combe: 2977m)
RaceDuration The race duration in seconds. (4 Hours = 14400, 6 Hours = 21600)
CarWeight The cars weight, without driver in Kg.
CarFrontArea The cars frontal area in Meters squared.
carFrictionCoeff The cars rolling friction coefficient.
carAirDragCoeff The cars aerodynamic coefficient.
battery0Capacity This is the capacity of battery 0 at the 20hour rate.
battery0KValue This is the "K" value for battery 0. (A measure of the battery quality/age)
battery1Capacity This is the capacity of battery 1 at the 20hour rate.
battery1KValue This is the "K" value for battery 1. (A measure of the battery quality/age)
motorGearing The motor gear ratio. (for 17:57 this is 3.353)
motorWheelDiameter The diameter of the driving wheel in Meters.
driveEfficiency The efficiency of the drive chain/gears etc. Motor efficiency is taken into account with motor simulation.
pitStopTime The pitstop time in seconds.
batteryChargeRate The battery charge current used in pitstops.
periods The pitstop periods with number of laps and driver weight in Kg. Battery is changed on each pitStop.
graphZoom Zooms the graphs to see more detail.

Simulation Notes

These notes refer to Greensim Version 1.0.

Car Dynamics

The Car dynamics has been calculated using the following equations:
These equations should give reasonable results, but the carFrictionCoeff and carAirDragCoeff will need to be determined by testing the car or by playing with the figures in the simulator such that it matches a real race for the car.

Motor simulation

The Motor simulator is reasonably accurate and is based on the Power Curve graphs available here. It may not simulate motor power variations due to Battery voltage correctly however.

torque = 13.5 - (motorRpm * 13.5 / 2000.0)
torque = torque * voltage / 24.0;
current = 2.0 + (torque * 128.0 / 13.5)

Battery Discharge

The Battery simulator uses the following algorithms.

t = \frac{H}{\left(\frac{I H}{C}\right)^k}\,

T = H / (I * H / C)^k

T    - Discharge time in hours
H   - Battery discharge rate time (20 hour rate)
I     - Discharge current
C   - Battery capacity at stated discharge rate (75 amp/hour)
k    - battery constant between 1.1 and 1.3 depending on battery type and condition.

For use in calculation a discharge value over a time period:

c = I * T * pow(I / Ir, k - 1)

c    - Amount of charge to take away from total charge
I    - Current
T    - Time period in hours
Ir    - Current for battery amp/hour rating (For 75Amp/hour at 20hour rate = 3.75)
k    - battery constant between 1.1 and 1.3 depending on battery type and condition.

This is taken from info at: http://en.wikipedia.org/wiki/Peukert's_law
There is more info at: http://www.thermoanalytics.com/support/publications/batterymodelsdoc.html
More info at: http://mocha-java.uccs.edu/dossier/RESEARCH/2002evs19a-.pdf

This looks like it is reasonably accurate for the batteries we use based on the battery discharge tests performed. A k value of about 1.11 works for the Yuasa Elite batteries. Battery charging is not well simulated. We need to know more about the battery chargers to get this side of the simulation to be accurate. The simulation charges at 10Amps and assumes 75% efficiency in doing this.
There is basic simulation of Battery "recovery" by setting the charge factor to a low number.

The Battery voltage is calculated using:

Et = Eo - Ri*I + Ki*log(Ct/C)

Where

Simulation Notes

Future Ideas

Basic Design

Information Links