Commit c78ebeda authored by Olivier Lantsoght's avatar Olivier Lantsoght 🏁
Browse files

Merge branch 'Issue253_Doc_Typos' into 'dev'

[MBsysPy][Equil][Doc] Some fix related to #253

Closes #253

See merge request robotran/mbsysc!395
parents e84ad708 4566ed17
......@@ -477,8 +477,7 @@ class MbsEquil(object):
return
def _compute_exchange(self):
"""
Set exchanged variables in the memory of the external library.
"""Set exchanged variables in the memory of the external library.
This function is automatically called when 'MbsEquil::run()' is called.
"""
......@@ -493,10 +492,9 @@ class MbsEquil(object):
") different from the length of the exchange list(" + str(len(self.exchange_list)) + ")")
def _compute_extra_variable(self):
"""
Set extra variables in the memory of the external library.
"""Set extra variables in the memory of the external library.
This function is automatically called when 'MbsEquil::run()' is called
This function is automatically called when 'MbsEquil::run()' is called.
"""
if self.get_options("nxe") == 0 and len(self.addition_list) > 0:
self.mbs_equil_ptr.contents.options.contents.nxe = len(self.addition_list)
......@@ -508,24 +506,25 @@ class MbsEquil(object):
mbs_msg(">>EQUIL>> extra variable: nxe(" + str(self.get_options("nxe")) +
") different from the length of the extra variable list(" + str(len(self.addition_list)) + ")")
def replace_exchange(self, ptr, index, id_exchanged, ptr_name="??"):
"""
Replace an existing exchanged variable with another one.
def replace_exchange(self, ptr, index, id_exchanged, ptr_name=None):
"""Replace an existing exchanged variable with another one.
This function can be called between two 'MbsEquil::run()' as it
does not change the number of equilibrium variables
This function can be called between two 'MbsEquil::run()' as it does not
change the number of equilibrium variables.
Parameters
----------
ptr: ndarray
Array containing the variable to be exchanged
Array containing the variable to be exchanged.
index: int
Index in ptr of the variable to be exchanged
Index in 'ptr' of the variable to be exchanged.
id_exchanged: int
Index in the list of exchanged variable of the variable to be
replaced
replaced.
ptr_name: str, optionnal
Name of the variable to be exchanged
Name of the variable to be exchanged. If set to None the existing
name is kept.
The default is None.
"""
if ptr.ctypes.data == self.mbs.q.ctypes.data:
mbs_msg(">>EQUIL>> variable exchange: Warning generalized coordinates"
......@@ -535,23 +534,27 @@ class MbsEquil(object):
mbs_msg(">>EQUIL>> variable exchange: There is no exchange variable at this index:" + str(id_exchanged))
else:
self.exchange_list[id_exchanged - 1][0] = ptr.ctypes.data + ctypes.sizeof(ctypes.c_double) * index
if ptr_name:
self.exchange_list[id_exchanged - 1][2] = ptr_name
def replace_extra_variable(self, ptr, index, id_extra, ptr_name="??"):
"""
Replace an existing extra variable with another one.
def replace_extra_variable(self, ptr, index, id_extra, ptr_name=None):
"""Replace an existing extra variable with another one.
This function can be called between two 'MbsEquil::run()' as it does not
change the number of equilibrium variables
change the number of equilibrium variables.
Parameters
----------
ptr: ndarray
Array containing the extra variable
Array containing the extra variable to be exchanged.
index: int
Index in ptr of the extra variable
id_exchanged: int
Index in the list of extra variable of the variable to be replaced
Index in 'ptr' of the extra variable to be exchanged.
id_extra: int
Index in the list of extra variable of the variable to be replaced.
ptr_name: str, optionnal
Name of the variable to be exchanged. If set to None the existing
name is kept.
The default is None.
"""
if ptr.ctypes.data == self.mbs.q.ctypes.data:
mbs_msg(">>EQUIL>> extra exchange: Warning generalized coordinates"
......@@ -561,23 +564,25 @@ class MbsEquil(object):
mbs_msg(">>EQUIL>> extra exchange: There is no extra variable at this index:" + str(id_extra))
else:
self.addition_list[id_extra - 1][0] = ptr.ctypes.data + ctypes.sizeof(ctypes.c_double) * index
if ptr_name:
self.addition_list[id_extra - 1][1] = ptr_name
def replace_extra_variable_um(self, user_model, param, id_extra):
"""
Replace an existing extra variable with a user model.
"""Replace an existing extra variable with a user model.
This function can be called between two 'MbsEquil::run()' as it does not
change the number of equilibrium variables
change the number of equilibrium variables.
The name of the extra equilibrium variable is replaceb by 'user_model.param'.
Parameters
----------
user_model: str
Name of the user model to add to the equilibrium variables
Name of the user model containing the parameter to be exchanged.
param: str
Parameter of the user model to add to the equilibrium variables
id_exchanged: int
Index in the list of extra variable of the variable to be replaced
Parameter of the user model to be exchanged.
id_extra: int
Index in the list of extra variable of the variable to be replaced.
"""
if self.mbs.user_model[user_model]._type[param] != 1 and self.mbs.user_model[user_model]._type[param] != 7:
mbs_msg(">>EQUIL>> extra exchange: This function does not handle this"
......@@ -590,20 +595,21 @@ class MbsEquil(object):
self.addition_list[id_extra - 1][1] = user_model + "." + param
def replace_exchange_um(self, user_model, param, id_exchanged):
"""
Replace an existing exchanged variable with a user model.
"""Replace an existing exchanged variable with a user model.
This function can be called between two 'MbsEquil::run()' as it does not
change the number of equilibrium variables.
The name of the exchanged equilibrium variable is replaceb by 'user_model.param'.
Parameters
----------
user_model: str
Name of the user model to be exchanged
Name of the user model containing the parameter to be exchanged.
param: str
Parameter of the user model to be exchanged
Parameter of the user model to be exchanged.
id_exchanged: int
Index in the list of exchanged variable of the variable to be replaced
Index in the list of exchanged variable of the variable to be replaced.
"""
if self.mbs.user_model[user_model]._type[param] != 1 and self.mbs.user_model[user_model]._type[param] != 7:
mbs_msg(">>EQUIL>> variable exchange: This function does not handle "
......
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