Commit 69ff33da authored by Olivier Lantsoght's avatar Olivier Lantsoght
Browse files

[MbsModal][NewError] Added for MBsysPy, leaks checked.

parent 17c50eae
...@@ -137,7 +137,7 @@ libmodules.mbs_delete_sensor.restype = None ...@@ -137,7 +137,7 @@ libmodules.mbs_delete_sensor.restype = None
libmodules.mbs_new_part.argtypes = [ctypes.POINTER(MbsData_c)] libmodules.mbs_new_part.argtypes = [ctypes.POINTER(MbsData_c)]
libmodules.mbs_new_part.restype = ctypes.POINTER(MbsPart_c) libmodules.mbs_new_part.restype = ctypes.POINTER(MbsPart_c)
libmodules.mbs_run_part.argtypes =[ctypes.POINTER(MbsPart_c), ctypes.POINTER(MbsData_c)] libmodules.mbs_run_part.argtypes = [ctypes.POINTER(MbsPart_c), ctypes.POINTER(MbsData_c)]
libmodules.mbs_run_part.restype = ctypes.c_int libmodules.mbs_run_part.restype = ctypes.c_int
libmodules.mbs_delete_part.argtypes = [ctypes.POINTER(MbsPart_c)] libmodules.mbs_delete_part.argtypes = [ctypes.POINTER(MbsPart_c)]
...@@ -190,10 +190,6 @@ libmodules.mbs_equil_add_variable.argtypes = [ctypes.POINTER(MbsEquilOptions_c), ...@@ -190,10 +190,6 @@ libmodules.mbs_equil_add_variable.argtypes = [ctypes.POINTER(MbsEquilOptions_c),
libmodules.mbs_equil_add_variable.restypes = None libmodules.mbs_equil_add_variable.restypes = None
libmodules.mbs_new_modal.argtypes = [ctypes.POINTER(MbsData_c)]
libmodules.mbs_new_modal.restype = ctypes.POINTER(MbsModal_c)
libmodules.mbs_new_invdyn.argtypes = [ctypes.POINTER(MbsData_c)] libmodules.mbs_new_invdyn.argtypes = [ctypes.POINTER(MbsData_c)]
libmodules.mbs_new_invdyn.restype = ctypes.POINTER(MbsInvdyn_c) libmodules.mbs_new_invdyn.restype = ctypes.POINTER(MbsInvdyn_c)
...@@ -231,6 +227,7 @@ libmodules.mbs_solvekin_loop.restype = None ...@@ -231,6 +227,7 @@ libmodules.mbs_solvekin_loop.restype = None
libmodules.mbs_solvekin_finish.argtypes = [ctypes.POINTER(MbsSolvekin_c), ctypes.POINTER(MbsData_c)] libmodules.mbs_solvekin_finish.argtypes = [ctypes.POINTER(MbsSolvekin_c), ctypes.POINTER(MbsData_c)]
libmodules.mbs_solvekin_finish.restype = None libmodules.mbs_solvekin_finish.restype = None
libmodules.mbs_new_modal.argtypes = [ctypes.POINTER(MbsData_c)] libmodules.mbs_new_modal.argtypes = [ctypes.POINTER(MbsData_c)]
libmodules.mbs_new_modal.restype = ctypes.POINTER(MbsModal_c) libmodules.mbs_new_modal.restype = ctypes.POINTER(MbsModal_c)
...@@ -238,13 +235,13 @@ libmodules.mbs_delete_modal.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINT ...@@ -238,13 +235,13 @@ libmodules.mbs_delete_modal.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINT
libmodules.mbs_delete_modal.restype = None libmodules.mbs_delete_modal.restype = None
libmodules.mbs_run_modal.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)] libmodules.mbs_run_modal.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)]
libmodules.mbs_run_modal.restype = None libmodules.mbs_run_modal.restype = ctypes.c_int
libmodules.mbs_modal_init.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)] libmodules.mbs_modal_init.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)]
libmodules.mbs_modal_init.restype = None libmodules.mbs_modal_init.restype = ctypes.c_int
libmodules.mbs_modal_loop.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)] libmodules.mbs_modal_loop.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)]
libmodules.mbs_modal_loop.restype = None libmodules.mbs_modal_loop.restype = ctypes.c_int
libmodules.mbs_modal_finish.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)] libmodules.mbs_modal_finish.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINTER(MbsData_c)]
libmodules.mbs_modal_finish.restype = None libmodules.mbs_modal_finish.restype = ctypes.c_int
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Module to handle direct dynamics simulations on Multibody systems. Module to handle modal analysis on Multibody systems.
Summary Summary
------- -------
...@@ -191,9 +191,7 @@ class MbsModal(object): ...@@ -191,9 +191,7 @@ class MbsModal(object):
self.set_options(**kwargs) self.set_options(**kwargs)
libmodules.mbs_run_modal(self.mbs_modal_ptr, self.mbs.mbs_data_ptr) error = libmodules.mbs_run_modal(self.mbs_modal_ptr, self.mbs.mbs_data_ptr)
if self.store_results:
self.load_results()
# Unassign user functions # Unassign user functions
if self.mbs.opt_load_c < 2: if self.mbs.opt_load_c < 2:
...@@ -203,6 +201,35 @@ class MbsModal(object): ...@@ -203,6 +201,35 @@ class MbsModal(object):
if self.mbs.opt_load_c < 1: if self.mbs.opt_load_c < 1:
self.mbs.__unassign_symb_fct__(self.symb_fun_list) self.mbs.__unassign_symb_fct__(self.symb_fun_list)
if error < 0:
mbs_msg("\n--------------------------------------------------------------------------------\n" # There is 80 characters printed
"READ CAREFULLY !!!\n"
"--------------------------------------------------------------------------------\n\n"
"An error occurs during the modal analysis.\n"
"The messages above give deeper informations on what went wrong.\n"
"The messages below gives classic error and error backtrace.\n\n"
"Usual errors are:\n"
" - Some options are not correct;\n"
" - Some mass or Inertia component is missing, leading to a invalid mass\n"
" matrix during the computation;\n"
" - The system is in a singular configuration;\n"
" - An error in user function (joint force, external forces) return wrong\n"
" value. Excessive force can generate infinte acceleration.\n"
"\n"
"If the simulation runs a little you should:\n"
" - In all cases, open the results/animation file and check the motion of the \n"
" system until it fails.\n"
" - In case of loop closure problem, you can alos check the dedicated animation\n"
" under the name 'Failed_loop_closing_procedure_q.res' if the related option\n"
" has been enable.\n"
"\n--------------------------------------------------------------------------------\n"
"\n--------------------------------------------------------------------------------\n")
raise RuntimeError("MbsModal.run() failed, read previous messages.")
if self.store_results:
self.load_results()
return self.results return self.results
def load_results(self): def load_results(self):
......
...@@ -82,6 +82,21 @@ mbs_modal = Robotran.MbsModal(mbs_data) ...@@ -82,6 +82,21 @@ mbs_modal = Robotran.MbsModal(mbs_data)
# Error: joints have change # Error: joints have change
# mbs_data.set_qdriven(2) # mbs_data.set_qdriven(2)
# Error: impossible cut
# mbs_data.dpt[3][4] = 10.
# Error: Mass matrix full of 0.
# Set all mass to 0
# mbs_data.m[1] = 0.0
# mbs_data.m[3] = 0.0
# mbs_data.m[4] = 0.0
# mbs_data.m[5] = 0.0
# Set all inertia to 0
# mbs_data.In[5][1] = 0.0
# mbs_data.In[5][4] = 0.0
# mbs_data.In[5][5] = 0.0
mbs_modal.set_options(save_result=1, save_anim=1, mode_ampl=0.2) mbs_modal.set_options(save_result=1, save_anim=1, mode_ampl=0.2)
mbs_modal.run() mbs_modal.run()
......
...@@ -132,6 +132,21 @@ int main(int argc, char const *argv[]) ...@@ -132,6 +132,21 @@ int main(int argc, char const *argv[])
mbs_modal->options->save_result = 1; mbs_modal->options->save_result = 1;
mbs_modal->options->save_anim = 1; mbs_modal->options->save_anim = 1;
mbs_modal->options->verbose = 1; mbs_modal->options->verbose = 1;
// Error: impossible cut
// mbs_data->dpt[3][4] = 10;
// Error: Mass matrix full of 0.
// Set all mass to 0
// mbs_data->m[1] = 0.0;
// mbs_data->m[3] = 0.0;
// mbs_data->m[4] = 0.0;
// mbs_data->m[5] = 0.0;
// Set all inertia to 0
// mbs_data->In[5][1] = 0.0;
// mbs_data->In[5][4] = 0.0;
// mbs_data->In[5][5] = 0.0;
mbs_run_modal(mbs_modal, mbs_data); mbs_run_modal(mbs_modal, mbs_data);
mbs_delete_modal(mbs_modal, mbs_data); mbs_delete_modal(mbs_modal, mbs_data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment