get_tvp_template¶
Class method.
-
do_mpc.estimator.MHE.
get_tvp_template
(self)¶ Obtain output template for
set_tvp_fun()
.The method returns a structured object with
n_horizon
elements, and a set of time-varying parameters (as defined indo_mpc.model.Model
) for each of these instances. The structure is initialized with all zeros. Use this object to define values of the time-varying parameters.This structure (with numerical values) should be used as the output of the
tvp_fun
function which is set to the class withset_tvp_fun()
. Use the combination ofget_tvp_template()
andset_tvp_fun()
.Example:
# in model definition: alpha = model.set_variable(var_type='_tvp', var_name='alpha') beta = model.set_variable(var_type='_tvp', var_name='beta') ... # in optimizer configuration: tvp_temp_1 = optimizer.get_tvp_template() tvp_temp_1['_tvp', :] = np.array([1,1]) tvp_temp_2 = optimizer.get_tvp_template() tvp_temp_2['_tvp', :] = np.array([0,0]) def tvp_fun(t_now): if t_now<10: return tvp_temp_1 else: tvp_temp_2 optimizer.set_tvp_fun(tvp_fun)
Returns: None Return type: None
This page is auto-generated. Page source is not available on Github.