# Slope2Deviation

Computes the square of the deviation of the slope of a curve at a certain point in time from a target value. A finite differencing scheme is used to compute the slope.

## Example

In suspension design, it is common to have targets for ride-steer, ride-camber and ride-caster at design, full jounce and full rebound. The design engineer is tasked with meeting these targets.

For those not familiar with suspension terminology: design, jounce and rebound are three different configurations for the suspension. Steer, camber and caster are thee angular measures that are of interest to suspension designers. Ride-steer, ride-camber and ride-caster are the slopes of the steer vs. ride height, camber vs. ride height and caster vs. ride height curves. Ride height is defined as the height of the wheel center above the road.

In the physical test, the front suspension is mounted on two jacks. Design position corresponds to zero displacement in the jacks. As the jacks move up and down due to a sinusoidal input, the suspension moves from design position to jounce, back to design and then rebound...and so on.

In this example, we will compute the square of the deviation of ride-camber at full jounce position (T=2.4 seconds).

```
>>> # Ride Height @ Full Jounce: point 1
>>> x1 = ValueAtTime (label = "Ride Height @ Full Jounce",
measuredValue = "0.001*DZ(30701024,30701025,10701021)",
atTime = 2.30,
delta = 0.1,
)
>>> # Camber @ Full Jounce: point 1
>>> y1 = ValueAtTime (label = "Camber @ @ Full Jounce",
measuredValue = "-ROLL(30701024,30701025)*RTOD",
atTime = 2.30,
delta = 0.1,
)
>>> # Ride Height @ Full Jounce: point 2
>>> x2 = ValueAtTime (label = "Ride Height @ Full Jounce ",
measuredValue = "0.001*DZ(30701024,30701025,10701021)",
atTime = 2.50,
delta = 0.1,
)
>>> # Camber @ Full Jounce: point 2
>>> y2 = ValueAtTime (label = "Camber @ Full Jounce ",
measuredValue = "-ROLL(30701024,30701025)*RTOD",
atTime = 2.50,
delta = 0.1,
)
>>> # Camber @ Full Jounce – y1
>>> sd = Slope2Deviation (label = "(1/2)*(1-RideCamber@FullJounce/5)**2",
points = (y2,x2,y1,x1),
targetValue = +5,
)
```