def METHOD_NAME(model, cstr_params, mpc_params):
    from scipy.linalg import solve_discrete_are
    # linearize dynamics
    from setup_acados_integrator import setup_acados_integrator
    integrator = setup_acados_integrator(
        model, mpc_params.dt, cstr_param=cstr_params, sensitivity_propagation=True
    )
    integrator.set("x", cstr_params.xs)
    integrator.set("u", cstr_params.us)
    integrator.solve()
    A_mat = integrator.get("Sx")
    B_mat = integrator.get("Su")
    Q_mat = mpc_params.dt * mpc_params.Q
    R_mat = mpc_params.dt * mpc_params.R
    P_mat = solve_discrete_are(A_mat, B_mat, Q_mat, R_mat)
    return A_mat, B_mat, P_mat