Sunday, December 5, 2010

Piecewise ODE FTMFW

Believe it or not I am pretty excited about that plot - it is the solution to a piecewise ODE function.
if y <= 10
   yprime = 1
else
   yprime = 2
end
Implication is that I can supply a discontinuous function for my acceleration and braking simulations - for example, an actual bike engine torque curve and gearing.

Of course in college they have you dick around finding closed-form, analytical solutions to differential equations. That's of limited or no value here! Still wish they'd have a course - "MCEN3010 - How to actually use this shit for real world problems."

Might try the torque curve bit later today depending on my mood - which will be predicated on if the Giants beat the Redskins, and how many beers I have.

Well shit, might need some new ODE's already

Did a little test to see if I could get an ODE to solve at all. Simple one worked just fine. One I wrote out for my on-throttle bit? Not so much. I'm not entirely sure why it errors out, but I do have a thought.
  1. It does shoot to infinity at v = 0. Even though the initial condition will always be greater than zero, I have a feeling this may be an issue. May be able to work around it by making a piecewise differential equation and clipping the engine thrust at a value where the tires would break free anyway. Hey, it's a numeric solution, why the fuck not?
  2. The constant power thing isn't as straightforward as one might think. What value do you use? Obviously it isn't going to be peak power - so I have to think up some average over the power band. Interestingly, thinking about a 3200ish lb sportscar with a 0-60 time of 4.7 seconds (like the Nissan 370z), that's only an average power input of about 150hp, of the 330 rated output power. Of course, with 0-60 so dependent on starting line hook, and higher speeds introducing aero drag effects, it's not a good way to come up with an scaling value.
  3. If I'm making a piecewise function out of the accelerating ODE anyway, I suppose I could use an actual torque curve and gearing - picking an appropriate gear based on speed (x dot), then looking up RPM and torque. 
I'll have to think about this crap more tomorrow.  

Saturday, December 4, 2010

Lap sim - you down with O.D.E.?

Yeah you know me! Actually, truth be told, by the time I took Differential Equations & Linear Algebra (APPM2360? I don't remember) I was so burned out on applied math that I retained pretty much nothing. Additionally, that was probably Fall '04 semester so it's been a while.

Before we get into specifics of writing out ODE's, let's think out loud on how the hell I'm even going to get this to work. Invariably the first thing to do is establish some assumptions. Whenever you're doing any sort of simulation or model or whatever, you are not recreating reality. Get that notion out of your head, forever. You are creating your own abstraction of reality with whatever physical laws, rules, and limitations as you see fit. These might be based on lack of necessary data (e.g. tire data), lack of the skill set to make something really fancy (e.g. me when I was in college), or constraints of time and money (e.g. running a simulation on a laptop rather than a cluster, or desk side supercomputer - badass!).

Here's what I'm thinking as far as assumptions:
  • Point model - no kinematics, tire data, load transfer, or anything of the sort.
  • Mass fixed at 1000 lb (at least initially, may evaluate being over minimum weight)
  • Forward thrust available from the engine at a constant power - i.e. inversely proportional to velocity.
  • All cornering done at constant velocity and radius - at max lateral capacity
  • All acceleration and braking done in a straight line
  • No rolling resistance effects
  • Downforce and aerodynamic drag proportional to the square of velocity
  • Mechanical grip (coefficient of friction) values in x- and y- directions held constant. Down the road, it would be interesting to do a sensitivity study and do a number of sim runs, altering the grip level of one corner at a time. Goal - determine which corner has the biggest impact on lap time, and focus steering and balance tuning toward that corner.
As far as how the thing would actually work... first step would be to run through and establish the maximum speed each corner can be taken. Pretty straight forward. The second and much more difficult step essentially comes down to finding the braking point (if there is one) on every straightaway. Haven't entirely figured out the specifics, but roughly:
  1. Pick some arbitrary initial guess for length of braking zone on this particular straight
  2. Use the initial velocity of the on-throttle portion from the previous corner
  3. Run ODE solver over the length of the on-throttle portion to establish a velocity trace
  4. Use the final velocity from on-throttle as the initial velocity of the braking portion
  5. Run ODE solver over the length of the braking portion to establish its velocity trace
  6. Use some sort of goal seek, objective function, or incremental loop to work the braking point backward until the final braking velocity is at or below the next max corner speed. Need to be as close to it as possible really.
For that last step, the incremental 'while' loop backing the braking point up a little bit at a time is probably the 'dumbest' approach in being computationally inefficient, but also the easiest to program.

So we come to the actual governing ODE's themselves...

On acceleration:

On the brakes:
Bam! Easy, assuming I remember anything from sophomore year. There have been many beers consumed between then and now (including a few at lunch today). I'd probably be a halfway intelligent guy if I hadn't drank like hell my last couple years in college!

Anyway. Now comes the hard part... actually making it work in code.

Thursday, December 2, 2010

Getting back to top-level engineering


You may be wondering why I've prominently displayed Lady Gaga here at the top center of the entry. Turns out, if you use the 'Pulse' reader app on your Smartphone (from the folks at Alphonso Labs), the preview icon for new Blogspot entries is whatever the first image is in the article. I wanted my latest preview to be something ridiculous (yes, I am easily amused). By the way, if you don't use Pulse - you should!

Much of the work I've posted up here has been "nuts and bolts" level - CAD and such. Generally this is opposite the design philosophy I preach of starting high-level and working down to specifics (up front engineering). At the same time, the CAD work has been done parametric enough so that I can go in and change my suspension points etc and have the model rebuild more or less painlessly. Anyway, it's to the point where I should back off and do some top-level design work.

I'm gonna go ahead and put on my musical selection for tonight before we get going.


Recommended reading material -this thread at FSAE.com, particularly Geoff's ('Big Bird') lengthy post November 30th, and the section 'Analysis Process.' Some really good takeaway points, namely-
  1. If you start simple with analysis and predictive work up front, you can get some real good design insight before anything is set in stone.
  2. Even college students can cobble together meaningful vehicle simulation programs over a couple days, in Excel, including beer breaks. 
  3. It's critically important to identify the relative importance of various performance attributes. You do not have infinite time or resources in your design cycle, ever. I've seen a number of engineers (mostly in college) get so sucked into minutiae that they completely lose sight of the big picture.

    "But if we do that, we're going to be giving up some handling!"
    "Yeah, and if we don't, the driver won't fit."
I've thought about it, and I might try my hand at putting together a rudimentary lap sim myself. Time investment may only be a couple nights worth of work. If it doesn't pan out from there, no big loss. If it does, I can always add in complexity. The great thing is everything builds on itself. No wasted work.

As an aside, it's amusing to me that for as aroused as FSAE students get for designing around kinematics, body motion is really a few steps up the ladder in model development. More fundamental things like tire cornering stiffness are sometimes overlooked. I wonder if I polled a number of kids the next time I'm at MIS, how many would be familiar with VSAL and how it defines camber rates, while not being totally familiar with tire properties.

We've established that we can simplify and build on vehicle models, but same holds true for track models - maybe even more so. Can probably simplify the hell out of a track model!

I can take some pretty damn big liberties in a track model - the lengths of straights, corner radii, etc. Why? Because I don't care what my exact lap time around Road America is going to be.

For one, you're never going to be able to predict it, within tenths anyway. Track condition, ambient conditions... enough to swing grip, downforce, engine power enough such that the time it spits out won't quite be right. Parameter identification based on previous race results is one thing - future is prediction.

Second, I'm not designing a chassis for Road America. I'm designing a car for Nelson's Ledges, Mid Ohio, and Road America and whatever else. So long as I have track models that are roughly representative of a road course, I think that's good enough for the majority or entirety of up front engineering.

Some interesting work ahead.

Tuesday, November 23, 2010

Revised front rocker & shock arrangement

Using the two bulkhead setup allows for some extra flexibility here, including being able to package a longer damper (75mm stroke in place of 50mm). Intuitively I'm thinking that being able to use more stroke should give me some more flexibility in terms of rates and installation ratios. Not knowing entirely what kind of wheel travel to expect, I'd rather have a little much travel than too little.

Clearly I still have to flesh this out quite a bit, but you get the idea. Additional bonus is that these rockers will be stupid easy to machine, even after I add another mounting point for a F-ARB. Would be nice if I could get the force vectors of the pushrod and damper a little more in line so there isn't as much of a net force (and moment!) on the single shear rocker mount. I'll have to play around with it. At this stage of the design it's more roughing things out in terms of what space they'll have to occupy.

As an aside, you may note that when I put in blind (as opposed to 'through') weight relief pockets, I like to fillet the bottom to mitigate any stress risers. In this case I have R0.060" fillets at the bottom of the pockets on the rockers. At first, this may seem dumb from a DFM perspective - how are you going to get a DIA 0.125" ball endmill down in there without it chattering and running slow as hell?

Luckily, God gave us 'bullnose' endmills - they are clutch for this sort of application. Think of it as a flat endmill with a small radius on the end. A hybrid between a flat and ball endmill. Allows you to pocket things out with a healthy diameter cutter for efficient metal removal while leaving a nice rounded edge at the bottom. Additionally they tend to be slightly more robust. Since the cutting edges don't come to a small sharp point they are less likely to chip off. Believe they also leave a slightly better RMS surface finish. What's not to like?!

They are also known as 'corner radius' end mills. Can find them over at MSC or most places with a good selection.

Friday, November 19, 2010

Kinematic curveball - tire rates

As you probably know, the balance of a car's wheel rates (front-to-rear and on diagonals in particular) play a big part in cornering feel and over/under-steer. Tire spring rate is a component of wheel rate... so any change in how tire rate is distributed has the potential to change the feel of the car.

Before I go any further, I'll share one of the tunes I'm rockin tonight as I get my vehicle dynamics on. Don't worry about the Friday night in... tomorrow night will likely have shenanigans afoot down in Columbus.


Anyway. Obviously tire rate is going to change with air inflation. Good way to make small tweaks. Tire rate also can change with camber - significantly. Typically it goes down the more you lean a tire. This in itself isn't anything earth shattering. It's public domain knowledge, and I remembering even hearing about it at a talk on tire testing & modeling at Colorado State right as I was finishing up undergrad. Never really stopped to think about the implications.

Let's assume we have some tire rate versus camber curve like below. Note: the numbers are totally arbitrary, just to serve as an example.


We'll consider some simple car with equal corner weights and identical installation rates (Ks). Kt denotes the tire rate, Kw the wheel rate.
Now we can give the car some arbitrary ride-camber rate and an arbitrary pitch input.
Fronts are going to gain negative camber, rears are going to move toward positive. Aka, fronts will soften and rears will get stiffer. How significant is a 1.4% change? That's up to you and your driver to decide. You'd be surprised what subtle changes you can notice - even playing with 0.5 - 1.0 psi increments on different corners of the car to play with tire rate.

Can also make up some arbitrary roll-camber rates and input. Let's say in this case, a car with more roll-camber change in the front than the rear (Mustang?).
In this case there's a very slight front/rear change, but a noticeable change in cross. Yeah, and you thought cross weight was only for oval racers. In this case, going up in cross during a left hand turn I believe tightens the car up mid corner - putting extra load on the RF and LR hurts front cornering capacity but helps drive-off.

Of course this is a really simple example with identical, linear tires on all corners. In reality it's a bit more involved. Opens a whole new can of worms in kinematic design - which wasn't exactly fuckin' easy to begin with! One option is to make use of rising rate motion ratios. Presumably if you knew enough about the tires you could use that to offset the change in tire rate and keep a relatively constant wheel rate.

Alternatively it may be beneficial to take advantage of some dynamic change in cross or lateral load transfer distribution - depending on how you want your balance and braking or power-on capacity to change at different parts of the corner. Trick stuff.

Of course none of this probably makes a hell of a lot of difference on FSAE teams that decide to throw heaps and heaps of spring rate in their car, in the misguided notion that it will increasingly make the thing more responsive. Brick the suspension and you don't have to worry much about kinematics, or low speed damper tuning for that matter.

Time to figure out what the hell I was working on back in March

...and we're back - hopefully with some momentum. You may be wondering what I've been up to for the past 8 months. To put it mildly, 2010 hasn't been a great year. For a while I was busy with work - which isn't a bad thing, but didn't lend itself to much spare time. Late summer I had some woman issues... things inexplicably went to shit. The combination of depression and anxiety really killed any productivity at work or home. This went on for a couple months. Finally had to get a grip on things, make some changes, get back to the things I enjoy in life: Sarcasm, working out, racecar vehicle dynamics, martinis, and music. In any event, here I am. Enough of my personal life though...

Tough picking this up after so long! I barely even remember what I was working on. Apparently I got started on some exhaust routing (yes yes I know about cylinder matching, this is more just roughing out where things might go).
Some things to tackle, in no particular order:
  1. Packaging and 'parametrization' of the front suspension with the 2 bulkhead design
  2. ...same for the rear suspension
  3. Some legit high-level suspension engineering. I've worked hard to get things truly parametric such that I can move key points around and have the mechanical bits rebuild successfully. If you've done any amount of solid modeling, you can appreciate that it isn't a trivial undertaking! I'd like to start firming up some ideas of rates and kinematic curves though. Ultimately a big part of that is going to be picking an initial tire selection and building in enough adjustment to work with radial or bias slicks, etc. More on that in the next post.