MBsysPy.mbsyspy.mbs_part module

Module to handle Partitioning step on Multibody systems.

Define the class MbsPart based on the MbsPart structure of MBsysC. This class has the functions required to manipulate the coordinate partitionning module.

class MBsysPy.mbsyspy.mbs_part.MbsPart(mbs, user_path=None, symbolic_path=None)

Bases: object

Class of the coordinate partitioning module.

Variables
  • n_qu (int) – Number of independent variable needed.

  • n_qv (int) – Number of dependent variable needed.

  • n_hu (int) – Number of independent constraint.

  • n_hv (int) – Number of redundant constraint

  • q_closed (ndarray) – Array with the generalized coordinate in closed configuration (constraints solved)

  • mbs (MbsData) – Definition of the multibody system associated to this instance.

Examples

>>> mbs_data = MBsysPy.MbsData("../dataR/ExampleProject.mbs")
>>> mbs_data.set_qv(2)
>>> mbs_part = MBsysPy.MbsPart(mbs_data)
>>> mbs_part.set_options(rowperm=1)
>>> mbs_part.run()
Attributes
mbs_filename

Access to self.mbs.mbs_filename (read-only).

mbs_name

Access to self.mbs.mbs_name (read-only).

n_hu

Access to n_hu attribute (read-only).

n_hv

Access to n_hv attribute (read-only).

n_qu

Access to n_qu attribute (read-only).

n_qv

Access to n_qv attribute (read-only).

project_path

Access to self.mbs.project_path (read-only).

q_closed

Access to q_closed attribute, only value in the vector can be written.

Methods

get_options(self, *args)

Get the specified options for Part module.

run(self, **kwargs)

Run a coordinate partitioning.

set_options(self, **kwargs)

Set the specified options for Part module.

set_user_fct_from_file(self, function_name, …)

Load a user function from a file chosen by the user instead of the default one in the userfctR folder.

set_user_fct_from_ptr(self, function_name, …)

Load a user function chosen by the user instead of the default one in the userfctR folder.

__init__(self, mbs, user_path=None, symbolic_path=None)

Create an instance of the MbsPart class for the provided MbsData instance.

Parameters
  • mbs (MbsData) – Instance of MbsData related to the analysis.

  • user_path (str or None, optionnal) – The path to the folder containing the user functions. If not provided (‘None’) the path is retrieved from the MbsData instance ‘mbs’. default is None

  • symbolic_path (str or None, optionnal) – The path to the folder containing the symbolic functions. If not provided (‘None’) the path is retrieved from the MbsData instance ‘mbs’. default is None

Returns

out – A MbsPart instance.

Return type

MBsysPy.MbsPart

get_options(self, *args)

Get the specified options for Part module.

Parameters

args – The different options specifed in the documentation of ‘set_options()’.

Returns

out – A tuple containing the values of all the asked values. If only one option was asked, the value of the option (not in a tuple).

Return type

tuple, int, float, bytes

property mbs_filename

Access to self.mbs.mbs_filename (read-only).

property mbs_name

Access to self.mbs.mbs_name (read-only).

property n_hu

Access to n_hu attribute (read-only).

property n_hv

Access to n_hv attribute (read-only).

property n_qu

Access to n_qu attribute (read-only).

property n_qv

Access to n_qv attribute (read-only).

property project_path

Access to self.mbs.project_path (read-only).

property q_closed

Access to q_closed attribute, only value in the vector can be written.

run(self, **kwargs)

Run a coordinate partitioning.

Options can be setted with the function ‘set_options()’ Options can be retrieved with the function ‘get_options()’

set_options(self, **kwargs)

Set the specified options for Part module.

Parameters
  • rowperm (int) – 1 to allow line permutation, 0 to forbid it. defaut is 0

  • visualize (int) – Currently not working for MBsysPy. In case of loop closure failing, set to 1 to plot the closing procedure iterations. defaut is 1

  • drivers (int) – Unused but 1 stand for yes, 0 for no. defaut is 0

  • verbose (int) – Set to 1 to get messages related to partitioning module. Set to 0 to disable message. defaut is 1

  • clearmbsglobal (int) –

    Unused, but:
    • 1 is for inout

    • 2 is for out

    • 3 is for none

    • 4 is for all

    defaut is 1

  • random_amplitude (float) – Amplitude of the random troubleshoot added to the initial value of generalized coordinates. The randomized values are only used to determine the rank of the Jacobian matrix. default is 1.e-2.

set_user_fct_from_file(self, function_name, user_path, user_file)

Load a user function from a file chosen by the user instead of the default one in the userfctR folder.

The function is then unassigned by the module at the end of the run().

Parameters
  • function_name (str) – name of the user function to replace.

  • user_path (str) – path to the new user function file.

  • user_file (str) – name of the new user function file.

set_user_fct_from_ptr(self, function_name, user_fct_ptr)

Load a user function chosen by the user instead of the default one in the userfctR folder.

The function is then unassigned by the module at the end of the run().

Parameters
  • function_name (str) – name of the user function to replace.

  • user_fct_ptr (ptr) – new user function pointer.