Evaluating solver variables and give total mass of a model as output in Motionview
Hi,
How to express the total mass of the system in the expression? So far I've attempted to use `body1.mass + body2.mass + body3.mass+ ...`, but this gave me error evaluating the solver variables.
Another question is, is there a way to input commands into the GUI so that its possible to check the values of these expressions? I see the HWC commancs, python window, and a Tcl Command window but so far neither of those respond to commands to these expressions.
Thank you,
Linn
Answers
-
Hi Linn,
In the solver variable, make sure that it is set to Linear and the variable names for the bodies are correct. I suggest to use the Expression builder to verify the variable names/values. I am attaching a simple model that has a solver variable evaluating the combined mass.
HWC command is for Hypermesh, HyperView and HyperGraph
You can use the python window and python commands.
you can access the python guide here. https://help.altair.com/hwdesktop/hwx/topics/chapter_heads/mv_python_reference_r.htm?zoom_highlight=python
For example
from hw import mview
sol = mview.getObjectFromPath("MODEL.sv_mass")sol.value.expr
%% This will return 'b_0.mass+b_1.mass+b_2.mass' if you use the model attached to the ticket
sol.value.lin
%% This will return the expression evaluated : 60
Best,
Christopher Fadanelli
1 -
Hi Linn,
Rather than create expressions, the total mass of the system can also be easily viewed using the CG/Inertia Tool
Here, you can add or remove the bodies you want to weigh, measure their COG or measure their inertia properties.
The system mass can also me measured in the simulation output LOG file:
AGGREGATE MASS/C.G. PROPERTIES
-----------------------------------------------------
Total Mass : 6.000E+02 KILOGRAM
CG Before Static : (1.839E+03, -6.012E+00, 8.619E+02)
CG After Static : (1.839E+03, -5.893E+00, 8.737E+02)You can evaluate an expression in the Expression Builder window by checking the Evaluated box:
Hope this helps!
Adam Reid
1 -
Hello Linn
You can use the tcleval function along with the tcl procedure ::GetAggregateCGAndInertia
You can use the expression as follows in the Solver variable expression to get the total mass of the model.
tcleval("::model::GetAggregateCGAndInertia <span style="color: #ba372a;">MODEL</span> mass")<br />
The highlighted argument can be any system with the full varname. then this function will return the aggregate mass just for the system.
E.g.
tcleval("::model::GetAggregateCGAndInertia <span style="color: #ba372a;">MODEL.sys_steering</span> mass")
Regards
Praful
1