Script to Extract the Mass Matrix of a Mbd System in MotionView/MotionSolve


Overview

Description

Attached are: 1. MotionView model - body_mass_property_example.mdl 2. Python sub routine - reqsub_body_mass_prop.py 3. MotionSolve model and results - body_mass_property_example (xml, log, abf, h3d) ---MotionView model--- The MotionView model has 3 output requests – all referring to the reqsub_body_mass_prop.py Python user sub-routine The usersub param strings are – USER(0), USER(1) and USER(2) for the 3 requests respectively. ---Python script --- The REQSUB python user sub-routine has the following information: def REQSUB(id, time, par, npar, iflag): [cm, mass, ip] = py_body_mass_property("Model",0) result = 8*[0] if par[0]==0: mass1 = mass result = [0,0,mass1,0,0,0,0,0] elif par[0]==1: cm1 = cm result = [0,cm1[0],cm1[1],cm1[2],0,0,0,0] elif par[0]==2: ip1 = ip result = [0,ip1[0],ip1[1],ip1[2],0,ip[3],ip[4],ip[5]] return result • py_body_mass_property is a utility / data access subroutine that returns the mass, cg (or cm) and inertia tensor for a body or an entire model. o The calling syntax in python is: [cm, mass, ip] = py_body_mass_property("Model",0) o The first parameter determines the desired part or the assembly you want the mass / cm / ip to be extracted. The supported arguments are Part, Point_Mass, Flex_Body or Model. In our case, I’ve used Model o The second parameter is to specify the part id. Since I’m querying the mass for the entire model, I’ve kept it to zero (0) • The reqsub function needs to be a size of 8. • Depending on the usersub param string value – 0, 1 or 2, we return the mass of the assembly or the CG (CM) or the inertia tensor of the model. ---MotionSolve model --- When you run the model in MotionSolve, you will notice that the log file has the following entry: Script file [C:/reqsub_body_mass_prop.py] accessed. meaning it was able to read the python usersub script.

Usage

Attached are: 1. MotionView model - body_mass_property_example.mdl 2. Python sub routine - reqsub_body_mass_prop.py 3. MotionSolve model and results - body_mass_property_example (xml, log, abf, h3d) ---MotionView model--- The MotionView model has 3 output requests – all referring to the reqsub_body_mass_prop.py Python user sub-routine The usersub param strings are – USER(0), USER(1) and USER(2) for the 3 requests respectively. ---Python script --- The REQSUB python user sub-routine has the following information: def REQSUB(id, time, par, npar, iflag): [cm, mass, ip] = py_body_mass_property("Model",0) result = 8*[0] if par[0]==0: mass1 = mass result = [0,0,mass1,0,0,0,0,0] elif par[0]==1: cm1 = cm result = [0,cm1[0],cm1[1],cm1[2],0,0,0,0] elif par[0]==2: ip1 = ip result = [0,ip1[0],ip1[1],ip1[2],0,ip[3],ip[4],ip[5]] return result • py_body_mass_property is a utility / data access subroutine that returns the mass, cg (or cm) and inertia tensor for a body or an entire model. o The calling syntax in python is: [cm, mass, ip] = py_body_mass_property("Model",0) o The first parameter determines the desired part or the assembly you want the mass / cm / ip to be extracted. The supported arguments are Part, Point_Mass, Flex_Body or Model. In our case, I’ve used Model o The second parameter is to specify the part id. Since I’m querying the mass for the entire model, I’ve kept it to zero (0) • The reqsub function needs to be a size of 8. • Depending on the usersub param string value – 0, 1 or 2, we return the mass of the assembly or the CG (CM) or the inertia tensor of the model. ---MotionSolve model --- When you run the model in MotionSolve, you will notice that the log file has the following entry: Script file [C:/reqsub_body_mass_prop.py] accessed. meaning it was able to read the python usersub script.

Limitation

No known limitations

Functionality

Solver execution

Subfunctionality

Other