# get_y_template¶

Class method.

do_mpc.estimator.MHE.get_y_template(self)

Obtain output template for set_y_fun().

Use this structure as the return of a user defined parameter function (y_fun) that is called at each MHE step. Pass this function to the MHE by calling set_y_fun().

The structure carries a set of measurements for each time step of the horizon and can be accessed as follows:

y_template['y_meas', k, 'meas_name']
# Slicing is possible, e.g.:
y_template['y_meas', :, 'meas_name']


where k runs from 0 to N_horizon and meas_name refers to the user-defined names in do_mpc.model.Model.

Note

The structure is ordered, sucht that k=0 is the “oldest measurement” and k=N_horizon is the newest measurement.

By default, the following measurement function is choosen:

y_template = self.get_y_template()

def y_fun(t_now):
n_steps = min(self.data._y.shape[0], self.n_horizon)
for k in range(-n_steps,0):
y_template['y_meas',k] = self.data._y[k]
try:
for k in range(self.n_horizon-n_steps):
y_template['y_meas',k] = self.data._y[-n_steps]
except:
None
return y_template


Which simply reads the last results from the MHE.data object.

Returns: y_template struct_symSX