# The addResponses Method

Three responses of type RMS2 are created for defining these
values. The objective to minimize the sum of these three responses (*R*1 + *R*2 + *R*3).

The addResponses method for this model is shown below:

```
def addResponse(self, time):
"""
We minimize the influence of disturbance on the block
R1: Integral(acceleration**2,time)
R2: Integral(velocity**2,time)
R3: Integral(Displacement**2,time)
R4: Constraint (1 - kp**2 - ki**2 - kd**2 < 0)
"""
# Define the desired profile
zero_vector = [0.0 for i in time]
targetValue = zip(time,zero_vector)
# Measure the RMS acceleration deviation from desired
expr = 'ACCZ({I},{J})'.format(I=self.block.cm.id, J=self.rm.id)
self.R1 = RMS2 (
label ='acceleration',
targetValue = targetValue,
measuredValue = expr,
)
# Measure the RMS velocity deviation from desired
expr = 'VZ({I},{J})'.format(I=self.block.cm.id,J=self.rm.id)
self.R2 = RMS2 (
label = 'velocity',
targetValue = targetValue,
measuredValue = expr,
)
# Measure the RMS displacement deviation from desired
expr = 'DZ({I},{J})'.format(I=self.block.cm.id,J=self.rm.id)
self.R3 = RMS2 (
label = 'displacement',
targetValue = targetValue,
measuredValue = expr,
)
# The constraint
self.R4 = ResponseExpression(
label='sum of squares',
function = '1 - kp**2 - kd**2 - ki**2',
symbols = ["kp", "kd", "ki"],
variables = [self.dv_kp, self.dv_kd, self.dv_ki]
)
```