# Simulating Solar Sprint with Spice

Simulation programs running on digital computers allow computer designers to predict the operation of new chips, aerospace engineers to predict the characteristics of new airframes, and architects to predict the thermal characteristics of new buildings, all without building anything.

This paper shows how a Junior Solar Sprint car can be modeled using an electronic circuit simulator, Spice, developed by UC Berkeley. It can model the PV panel, the motor, the gear ratio, and friction, so that design tradeoffs can be explored before anything is built. Use of this powerful tool is within reach of the ambitious high school student.

## The Spice Circuit Simulator

The electronics industry relies heavily on the Spice circuit simulator for many aspects of its work. It can model most electronic circuits, with accurate prediction of linear (eg resitors) and nonlinear elements (eg transistors). It also allows specification of arbitrary nonlinear sources.

Many companies have built products based on Spice, integrating it into friendlier frameworks. Various companies have "demo" or "student" versions available for free. These versions generally have complete function, other than a limitation on the size of the circuit that is to be simulated.

This work used one of these, called AIMSpice.

## Simulating the Solar Sprint

In other articles in this series, we showed that both the PV Panel and the motor have equivalent electrical circuits. It is quite easy to expand the circuit to include the mechanical aspects of the Solar Sprint car. The following circuit diagram shows the circuit that has been used.

Moving from left to right, we can recognize the various elements of the circuit. The current source, Ipv, the forward-biased diode Dpv, and the shunt and series resistors Rsh and Rs together represent the PV panel. The value of Ipv is proportional to the incident light radiation. Diode characteristics are chosen to reasonably approximate the I-V characteristic of the panel. Shunt resistance is ignored, and a fairly small value is chosen for the series resistance.

To the right of this is a circuit that represents the motor. Ra represents the series resistance of the motor, and below that is a voltage source, Vb, which represents the back-emf of the motor. This is a controlled voltage source, to be described better later.

In parallel with this voltage source is a controlled current source Ifr which represents the current required to overcome the frictional torque of the motor. This is approximated with a logarithmic I/V that shows relatively constant current as voltage increases, but has zero current with zero applied voltage. To the right of this is the circuit that represents the mechanical system. The current source If represents the drive force on the car at the wheel. The drive force is a function of the gear ratio, the diameter of the drive wheel, and the torque delivered by the motor. The torque is proportional to the current that flows through Vb (total motor current, less frictional current). This controlled current source is hence controlled by the current flowing through the back-emf element. The constant of proportionality is the torque constant of the motor divided by the gear ratio, times the wheel diameter.

It is interesting to note that if it were possible, varying the motor's torque constant has the same effect on overall performance as varying gear ratio. At least one motor, being sold for full-scale solar car racing by New Generation Motors, uses a variable gap design in a permanent magnet motor to achieve this effect.

Current source If drives a capacitor Cm. The value of the capacitor represents the mass of the car (1 Farad for 1 Kg). Together, they form an integrator, so that the voltage across this capacitor represents the velocity of the car (1 volt corresponds to 1 meter per second). The velocity increases with the time integral of the applied force, just as the voltage increases with the integral of the applied current.

We can now describe the function of the back-emf element Vb. The back EMF voltage is related to the velocity node by the same constant as was used to control the applied force current source: the back emf constant (same as torque constant) divided by the gear ratio times the wheel diameter.

The right hand circuit loop is a voltage source Vv driving a 1H inductor, which forms another integrator. Vv is controlled by the velocity node, so the inductor current represents the displacement of the car. (a current source driving a capacitor should work just as well, but for unknown reasons, it resulted in an unstable simuation).

In all, this circuit has most of the elements required to study the effects of various design tradeoffs, such as

• Mass of the car
• Gear ratio
• Wheel size
• PV Panel illumination

Probably the most interesting study will be of the gear ratio and wheel size. We should expect to see the expected result of improved performance with better PV illumination and car mass reduction. We can also investigate the benefit of improving the motor.

Given the ease with which simulation can be modified, we can also investigate the benefit of advanced design techniques such as a continuously variable transmission.

## Measurements

Many of the performance characteristics that we wish to examine are present as voltages or currents in the circuit.

Other characteristics, such as motor efficiency and delivered power, can be calculated with the help of "virtual instrumentation" that we can add to our circuit. Nonlinear controlled voltage sources, implementing interesting functions of circuit currents and voltages, can be added to calculate such characteristics.

## Results

Investigating the effects of design changes is as simple as plugging in different component values and rerunning the simulation. This section shows the results of simulation of a car with the following characteristics:

• Mass = 0.5 kg
• PV panel: Solar Sprint
• Motor: Solar Sprint - Permanent Magnet DC
• Wheel Diameter = 2 cm
• Wind resistance - ignored

The following three graphs show the results of simulating with a fixed gear ratio of 0.2. The wheel turns 0.2 times for each motor revolution. The first graph is of displacement versus time. It shows how the car accelerates rapidly, and then proceeds at a constant velocity. The Solar Sprint finish line is at 20 m from the start, so this car does not reach the finish line before the end of simulation. The second graph shows the velocity of the car and the applied motor voltage. The car can be seen to quickly reach a constant velocity. The voltage has quickly increased to a value on the "constant voltage" portion of the PV panel's I-V curve, considerably to the right of the Maximum Power Point. This is clearly shown by the third graph, which shows power delivered by the PV panel, and mechanical power delivered by the motor. Power delivery increases rapidly to a peak, and then falls off just as quickly. This gear ratio is clearly too low.

Simulation with various gear ratios shows that the best time to the finish line for this particular car is obtained with a gear ratio of around 0.5. The following three graphs show the results of this configuration.

The graph of displacement versus time shows a considerable improvement in time to the finish line, crossing it in about 6.2 seconds. The applied voltage and velocity graphs show a slower acceleration at the beginning because of the higher gear ratio, but continuing increase of velocity to a much higher value than was achieved with the lower gear ratio. The power graph shows a much wider peak in delivered power, indicating that more energy has been delivered to the car.

Considering the curves of PV power and delivered power, it can be seen that the motor achieves appoximately 50 percent efficiency, maximum. Simulation of higher gear ratios shows still slower acceleration, but sustained over a longer time. For a longer race course, a higher gear ratio would work better.

## Optimizing the Design

From the previous power graphs, it can be seen that the delivered power is far short of optimal. Optimal power delivery would have constant power, which is available, delivered over the entire length of the track. Is there anything that might improve the performance of the car?

The obvious improvements are to decrease the car's mass and friction and choose a more efficient motor (lower winding resistance and internal friction).

Beyond these, an examination of the power graphs reveals that best power delivery occurs at a different velocity for each gear ratio. Hence, if we could build a variable ratio transmission, with gear ratio starting out low and increasing (like a car), the PV/motor combination could be kept at the most efficient power delivery point, and car performance would improve considerably.

The following three graphs show the performance of the car when the gear ratio is increased with displacement. The actual function used for this simulation has gear ratio as a constant plus the square root of the displacement times a constant. The effect is to quickly increase the gear ratio initially, more slowly as the race progresses. The first shows that the car crosses the finish line considerably sooner than with the best fixed gear ratio, nearly a full second sooner! The second shows that applied voltage is held closer to the PV panel's Maximum Power Point. It also shows better continuing velocity increase than with the fixed gear ratio. The next graph shows that by altering the gear ratio, the power delivery is considerably improved. The ideal control circuit would alter the gear ratio to keep the PV panel motor combination operating at their most efficient.

## Conclusions

We have shown shown that Spice is a good tool for studying design tradeoffs in a Solar Sprint car, and better understanding its operating principles. Of course, simulation is not the real world, and even more will be learned from building a real car!

## Appendix: The Spice Net List

Following is the Spice netlist used for these simulation. Comment lines begin with a "*". Every other line represents a circuit element. The first field is the name of the circuit element, and the first letter represents the type of element. The next two fields specify the names of the nodes between which the element is connected.

```* This one should fairly closely match the performance of
* the Solar Sprint

*------------------------------------------
* Starting pulse to get things going
Vstart start 0 pulse(0 1 0.0 0.0 0.0 40 80)
Rt start 0 100
*-------------------------------------------

*------------------------------------------
* Motor Constant - measured from Solar Sprint Motor
VKm Km 0 dc 0.0056
RKm Km 0 1000
VRw Rw 0 0.02
Rrw Rw 0 1000
*------------------------------------------

*-- Choose fixed or variable gear ratio ---
* Fixed Gear Ratio
* Number of wheel turns per motor turn
* VGR GR 0 dc 0.5
* Variable Gear Ratio
bgr gr 0 v = 0.15 + sqrt(i(bdisp) * .035)
* Linear
* bgr gr 0 v = .12 + (.25 * i(bdisp) / 20)
RGR GR 0 100
*-----------------------------------------

*-----------------------------------------
* Effective linear motor constant, calculated from
*  gear ratio, wheel radius, and motor constant.
BKel Kel 0 v=v(Km) / (v(GR) * v(Rw))
RKel Kel 0 100
*-----------------------------------------

*-----------------------------------------
* Motor terminal voltage
* Choose the one that we want to use
*-----------------------
* Constant voltage source - 3 volts
*Bt motor_terminal 0 v=v(start) * 3
*-----------------------
* constant power source - 3 watts
*Bt motor_terminal 0 v=v(start)*(3/(abs(i(bback_emf))))
*-----------------------
* Solar Sprint PV panel
Bpv 0 pvint i=v(start) * 1.4
d21 pvint 0 diode1
rspv pvint motor_terminal .001

*------------------------------------------
* Winding resistance of Solar Sprint motor
*Vmotor_measure motor_terminal motor_internal DC 0
Ra motor_terminal back_emf 1.0
*------------------------------------------

*------------------------------------------
* back emf
bback_emf back_emf 0 v=v(kel) * v(velocity)
*------------------------------------------

*------------------------------------------
* Motor Frictional Loss
Bfrict back_emf fm i=(ln((1000000*v(back_emf))+1)/550)
vfm fm 0 DC 0
*------------------------------------------

* Current controlled Current source represents force delivered to
* wheel. 1 A <==> 1 nt (or 1 kg-m/sec**2)

Bforce 0 velocity i=v(kel)*(i(bback_emf))

*------------------------------------------
* Capacitance representing car mass - voltage
* across this represents car velocity.
* 1 F <=> 1 Kg
Cm velocity 0 0.5 ic=0v
*------------------------------------------

*------------------------------------------
* Resistance representing car friction.
*Rfc velocity 0 10
*------------------------------------------

*------------------------------------------
* Following circuit integrates car velocity to
* get displacement.
* Voltage controlled (by voltage representing velocity
* current source driving 1 F capacitor
*
Bdisp 0 4 v=-1 * v(velocity)
Rx 4 5 .00001
Lx 5 0 1 ic=0
*-------------------------------------------

*------- Measurement Circuits --------------
*-------------------------------------------
* controlled source to measure power delivered
bpower power 0 v = v(back_emf) * i(bback_emf)
rpower power 0 100

bpvpower pvpower 0 v = v(motor_terminal) * (i(bback_emf) + i(vfm))
rpvpower pvpower 0 1000

bmotor_eff motor_eff 0 v = v(power) / v(pvpower)
rmotor_eff motor_eff 0 1000
*------ Calculates RPM ---------------------
brpm rpm 0 v = ((v(back_emf) / v(km)) * 30) / 3.14159
rrpm rpm 0 100
*------------------------------------------------

* Diode submodel used in the PV cell
.MODEL diode1 D IS=1e-6 N=9.06

```

To contact me...