Permalink
Browse files

Merge branch 'master' of https://github.com/acados/acados

  • Loading branch information...
giaf committed May 28, 2018
2 parents 40d245f + 1c7ae8d commit 664c96cf921437a6a571219c8c91ed7445bba2e5
Showing with 5,924 additions and 472 deletions.
  1. +7 −1 acados/sim/sim_gnsf.c
  2. +21 −16 examples/c/CMakeLists.txt
  3. +17 −11 examples/c/Makefile
  4. +1 −1 examples/c/sim_gnsf_crane.c
  5. +150 −17 examples/c/sim_wt_model_nx3.c
  6. +6 −3 examples/c/sim_wt_model_nx6.c
  7. +67 −67 examples/c/wind_turbine_nmpc.c
  8. +4 −4 examples/c/{wt_model_nx6/nx6p2 → wt_model_nx3}/f_lo_fun_jac_x1k1uz.c
  9. +177 −0 examples/c/wt_model_nx3/get_matrices_fun.c
  10. +1,145 −0 examples/c/wt_model_nx3/impl_ode_fun_jac_x_xdot_u.c
  11. +501 −0 examples/c/wt_model_nx3/phi_fun.c
  12. +869 −0 examples/c/wt_model_nx3/phi_fun_jac_y.c
  13. +1,013 −0 examples/c/wt_model_nx3/phi_jac_y_uhat.c
  14. +50 −1 examples/c/wt_model_nx3/wt_model.h
  15. +11 −2 examples/c/wt_model_nx6/full_turbine_model.m
  16. +21 −12 examples/c/wt_model_nx6/gnsf_full_turbine_model.m
  17. +15 −15 examples/c/wt_model_nx6/nx6p2/full_turbine_model.m
  18. +15 −16 examples/c/wt_model_nx6/nx6p2/gnsf_full_turbine_model.m
  19. +66 −66 examples/c/wt_model_nx6/nx6p2/wt_model.h
  20. +12 −12 examples/c/wt_model_nx6/nx6p2/{expl_ode_fun.c → wt_nx6p2_expl_ode_fun.c}
  21. +789 −0 examples/c/wt_model_nx6/nx6p2/wt_nx6p2_expl_vde_adj.c
  22. +12 −12 examples/c/wt_model_nx6/nx6p2/{expl_vde_for.c → wt_nx6p2_expl_vde_for.c}
  23. +121 −0 examples/c/wt_model_nx6/nx6p2/wt_nx6p2_f_lo_fun_jac_x1k1uz.c
  24. +12 −12 examples/c/wt_model_nx6/nx6p2/{get_matrices_fun.c → wt_nx6p2_get_matrices_fun.c}
  25. +12 −12 examples/c/wt_model_nx6/nx6p2/{impl_ode_fun.c → wt_nx6p2_impl_ode_fun.c}
  26. +12 −12 examples/c/wt_model_nx6/nx6p2/{impl_ode_fun_jac_x_xdot.c → wt_nx6p2_impl_ode_fun_jac_x_xdot.c}
  27. +12 −12 examples/c/wt_model_nx6/nx6p2/{impl_ode_fun_jac_x_xdot_u.c → wt_nx6p2_impl_ode_fun_jac_x_xdot_u.c}
  28. +12 −12 examples/c/wt_model_nx6/nx6p2/{impl_ode_jac_x_xdot_u.c → wt_nx6p2_impl_ode_jac_x_xdot_u.c}
  29. +12 −12 examples/c/wt_model_nx6/nx6p2/{phi_fun.c → wt_nx6p2_phi_fun.c}
  30. +12 −12 examples/c/wt_model_nx6/nx6p2/{phi_fun_jac_y.c → wt_nx6p2_phi_fun_jac_y.c}
  31. +12 −12 examples/c/wt_model_nx6/nx6p2/{phi_jac_y_uhat.c → wt_nx6p2_phi_jac_y_uhat.c}
  32. +1 −1 examples/c/wt_model_nx6/setup.c
  33. +0 −24 examples/c/wt_model_nx6/wt_model.h
  34. +35 −13 test/CMakeLists.txt
  35. +1 −1 test/CPPLINT.cfg
  36. +67 −66 test/ocp_nlp/test_wind_turbine.cpp
  37. +15 −15 test/sim/CMakeLists.txt
  38. +619 −0 test/sim/sim_test.cpp
View
@@ -1083,7 +1083,7 @@ static void *sim_gnsf_cast_workspace(void *config, void *dims_, void *opts_, voi
assign_and_advance_blasfeo_dvec_mem(nK1, &workspace->K1u, &c_ptr);
assign_and_advance_blasfeo_dvec_mem(nZ, &workspace->Zu, &c_ptr);
assign_and_advance_blasfeo_dvec_mem(nx2, &workspace->ALOtimesx02, &c_ptr);
assign_and_advance_blasfeo_dvec_mem(nx2, &workspace->uhat, &c_ptr);
assign_and_advance_blasfeo_dvec_mem(nuhat, &workspace->uhat, &c_ptr);
// blasfeo_dmat_mem align
align_char_to(64, &c_ptr);
@@ -1246,6 +1246,7 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
blasfeo_pack_dvec(nx + nu, &in->S_adj[0], &lambda_old, 0);
blasfeo_pack_dmat(nx, nx + nu, &in->S_forw[0], nx, &S_forw, 0, 0);
// initialize ff_val
for (int ss = 0; ss < num_steps; ss++)
{
@@ -1398,6 +1399,7 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
model->phi_fun_jac_y->evaluate(model->phi_fun_jac_y, phi_type_in, phi_in,
phi_fun_jac_y_type_out, phi_fun_jac_y_out);
out->info->ADtime += acados_toc(&casadi_timer);
// build jacobian J_r_ff
blasfeo_dgemm_nn(n_out, nff, ny, -1.0, &dPHI_dyuhat, ii * n_out, 0, &YYf,
ii * ny, 0, 1.0, &J_r_ff, ii * n_out, 0, &J_r_ff, ii * n_out,
@@ -1540,6 +1542,9 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
acados_tic(&la_timer);
blasfeo_dgetrf_rowpivot(nff, nff, &J_r_ff, 0, 0, &J_r_ff, 0, 0,
ipiv); // factorize J_r_ff
// printf("dPHI_dyuhat = (forward, ss = %d) \n", ss);
// blasfeo_print_exp_dmat(nff, ny+nuhat, &dPHI_dyuhat, 0, 0);
blasfeo_drowpe(nff, ipiv, &J_r_x1u); // permute also rhs
blasfeo_dtrsm_llnu(nff, nx1 + nu, 1.0, &J_r_ff, 0, 0, &J_r_x1u, 0, 0, &J_r_x1u, 0, 0);
blasfeo_dtrsm_lunn(nff, nx1 + nu, 1.0, &J_r_ff, 0, 0, &J_r_x1u, 0, 0, &J_r_x1u, 0, 0);
@@ -1708,6 +1713,7 @@ int sim_gnsf(void *config, sim_in *in, sim_out *out, void *args, void *mem_, voi
// build J_r_ff
blasfeo_dgemm_nn(n_out, nff, ny, -1.0, &dPHI_dyuhat, ii * n_out, 0, &YYf, ii * ny,
0, 1.0, &J_r_ff, ii * n_out, 0, &J_r_ff, ii * n_out, 0);
// build J_r_x1u
blasfeo_dgemm_nn(n_out, nx1, ny, -1.0, &dPHI_dyuhat, ii * n_out, 0, &YYx, ii * ny,
0, 0.0, &J_r_x1u, ii * n_out, 0, &J_r_x1u, ii * n_out,
View
@@ -116,6 +116,12 @@ file(GLOB WT_MODEL_NX3_SRC
wt_model_nx3/impl_ode_fun.c
wt_model_nx3/impl_ode_fun_jac_x_xdot.c
wt_model_nx3/impl_ode_jac_x_xdot_u.c
wt_model_nx3/impl_ode_fun_jac_x_xdot_u.c
wt_model_nx3/phi_fun.c
wt_model_nx3/phi_fun_jac_y.c
wt_model_nx3/phi_jac_y_uhat.c
wt_model_nx3/f_lo_fun_jac_x1k1uz.c
wt_model_nx3/get_matrices_fun.c
)
file(GLOB WT_MODEL_NX6_SRC
@@ -136,17 +142,17 @@ file(GLOB WT_MODEL_NX6_SRC
)
file(GLOB WT_MODEL_NX6P2_SRC
wt_model_nx6/nx6p2/expl_ode_fun.c
wt_model_nx6/nx6p2/expl_vde_for.c
wt_model_nx6/nx6p2/impl_ode_fun.c
wt_model_nx6/nx6p2/impl_ode_fun_jac_x_xdot.c
wt_model_nx6/nx6p2/impl_ode_jac_x_xdot_u.c
wt_model_nx6/nx6p2/impl_ode_fun_jac_x_xdot_u.c
wt_model_nx6/nx6p2/phi_fun.c
wt_model_nx6/nx6p2/phi_fun_jac_y.c
wt_model_nx6/nx6p2/phi_jac_y_uhat.c
wt_model_nx6/nx6p2/f_lo_fun_jac_x1k1uz.c
wt_model_nx6/nx6p2/get_matrices_fun.c
wt_model_nx6/nx6p2/wt_nx6p2_expl_ode_fun.c
wt_model_nx6/nx6p2/wt_nx6p2_expl_vde_for.c
wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_fun.c
wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_fun_jac_x_xdot.c
wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_jac_x_xdot_u.c
wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_fun_jac_x_xdot_u.c
wt_model_nx6/nx6p2/wt_nx6p2_phi_fun.c
wt_model_nx6/nx6p2/wt_nx6p2_phi_fun_jac_y.c
wt_model_nx6/nx6p2/wt_nx6p2_phi_jac_y_uhat.c
wt_model_nx6/nx6p2/wt_nx6p2_f_lo_fun_jac_x1k1uz.c
wt_model_nx6/nx6p2/wt_nx6p2_get_matrices_fun.c
)
file(GLOB GNSF_CRANE_SRC
@@ -174,11 +180,10 @@ add_executable(sim_wt_model_nx6 sim_wt_model_nx6.c ${WT_MODEL_NX6_SRC})
target_link_libraries(sim_wt_model_nx6 acados)
add_test(sim_wt_model_nx6 sim_wt_model_nx6)
if(ACADOS_WITH_C_INTERFACE)
add_executable(sim_gnsf_crane sim_gnsf_crane.c ${GNSF_CRANE_SRC})
target_link_libraries(sim_gnsf_crane acados)
add_test(sim_gnsf_crane sim_gnsf_crane)
endif()
# -------------------- sim_gnsf_crane
add_executable(sim_gnsf_crane sim_gnsf_crane.c ${GNSF_CRANE_SRC})
target_link_libraries(sim_gnsf_crane acados)
add_test(sim_gnsf_crane sim_gnsf_crane)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
View
@@ -169,17 +169,17 @@ run_sim_wt_model_nx6:
WT_NX6P2_OBJS =
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/expl_ode_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/expl_vde_for.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/impl_ode_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/impl_ode_fun_jac_x_xdot.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/impl_ode_fun_jac_x_xdot_u.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/impl_ode_jac_x_xdot_u.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/phi_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/phi_fun_jac_y.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/phi_jac_y_uhat.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/f_lo_fun_jac_x1k1uz.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/get_matrices_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_expl_ode_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_expl_vde_for.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_fun_jac_x_xdot.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_fun_jac_x_xdot_u.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_impl_ode_jac_x_xdot_u.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_phi_fun.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_phi_fun_jac_y.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_phi_jac_y_uhat.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_f_lo_fun_jac_x1k1uz.o
WT_NX6P2_OBJS += wt_model_nx6/nx6p2/wt_nx6p2_get_matrices_fun.o
wind_turbine_nmpc: $(WT_NX6P2_OBJS) wind_turbine_nmpc.o
$(CCC) -o wind_turbine_nmpc.out wind_turbine_nmpc.o $(WT_NX6P2_OBJS) $(LDFLAGS) $(LIBS)
@@ -203,6 +203,12 @@ WT_OBJS += wt_model_nx3/expl_vde_adj.o
WT_OBJS += wt_model_nx3/impl_ode_fun.o
WT_OBJS += wt_model_nx3/impl_ode_fun_jac_x_xdot.o
WT_OBJS += wt_model_nx3/impl_ode_jac_x_xdot_u.o
WT_OBJS += wt_model_nx3/impl_ode_fun_jac_x_xdot_u.o
WT_OBJS += wt_model_nx3/phi_fun.o
WT_OBJS += wt_model_nx3/phi_fun_jac_y.o
WT_OBJS += wt_model_nx3/phi_jac_y_uhat.o
WT_OBJS += wt_model_nx3/f_lo_fun_jac_x1k1uz.o
WT_OBJS += wt_model_nx3/get_matrices_fun.o
sim_wt_model_nx3: $(WT_OBJS) sim_wt_model_nx3.o
$(CCC) -o sim_wt_model_nx3.out sim_wt_model_nx3.o $(WT_OBJS) $(LDFLAGS) $(LIBS)
@@ -189,7 +189,7 @@ int main() {
// set up sim_out
sim_out *out = sim_out_create(config, dims);
int NREP = 10000;
int NREP = 100;
double casadi_times[NREP];
double gnsf_times[NREP];
for (int i = 0; i < NREP; i++) {
Oops, something went wrong.

0 comments on commit 664c96c

Please sign in to comment.