The addResponses Method
This method adds Response objects to the model. In this example, the objective is to find a design such that the Toe vs. Ride-Height curve matches a desired shape. The desired shape is provided as a goal for the suspension designer to meet.
The Ride-Height is a function of Time. You can match Toe vs. Time to a Toe vs. Time, which is easier. The deviation between the current shape and the desired shape can be computed using an RMS2 response.
Furthermore, you can add a Request to plot the actual and desired results.
def addResponses (self):
"""
For optimization one response is created:
The square of the area between the desired and actual toe curves
"""
# The desired TOE angle
x1=(0.00, 0.16, 0.32, 0.48, 0.64, 0.79875, 0.95875, 1.12125, 1.28, 1.44, 1.6, 1.76,
1.92, 2.08, 2.24, 2.40, 2.56, 2.72125, 2.88375, 3.035, 3.1975, 3.35875, 3.52,
3.68, 3.84, 4.00 )
y1=(0.00, -0.13, -0.26, -0.38, -0.51, -0.64, -0.77, -0.70, -0.58, -0.45, -0.32, -0.19,
-0.06, 0.06, 0.19, 0.32, 0.45, 0.58, 0.70, 0.77, 0.64, 0.51, 0.38, 0.26,
0.13, 0.00)
xy = zip(x1,y1)
# The actual TOE angle
toe = "rtod(ATAN(DX(10401010,10403030)/DY(10401010, 10403030)))"
# The RMS2 metric
self.resp = RMS2 (label = "Area Error",
targetValue = xy,
measuredValue = toe,
scale = 10,
)
# Create some Requests for Plotting
f2s = "AKISPL(TIME, 0, {})".format(self.resp.spline.id)
f3s = "(DZ(10401010)-282.57)"
Request (label="Desired Toe, Ride Height", f2=f2s, f3=f3s)
Return