hexagon logo

Vector expression in runtime function?

I am trying to simplify some messy equations by using runtime functions. I have a function for projecting the velocity vector of a marker into the plane of a reference unit vector that I calculate and save at some previous point in the simulation.
 
runtime_function create &
runtime_function_name = FUN_projvelocity &
text_of_expression = "(UV(VXYZ(M1) - ([UVNX, UVNY, UVNZ] * VXYZ(M1) * [UVNX, UVNY, UVNZ])))" &
argument_names = "M1", "UVNX", "UVNY", "UVNZ"
 
Unfortunately when I try to import this command I get the following error:
ERROR: The function expression indicated contains at least one error.
ERROR: A value of type vector cannot be used in this context.
ERROR:
ERROR: Function text : "(UV(VXYZ(M1) - ([UVNX[[,]] UVNY, UVNZ] * VXYZ(M1) * [UVNX, UVNY, UVNZ])))"
ERROR: (The element at or immediately after the error is
ERROR: enclosed in double brackets '[[' and ']]'.)
 
Is there any way to make a runtime function support vectors? I've also tried passing [UVNX, UVNY, UVNZ] as a single argument and it still gets mad at me.
 
  • ADAMS is a bit picky on brackets , be it () or () or {} .
    According to the help [] was the right choice for a vector of single components.
     
    I admit being too lazy to understand what you're trying to accomplish, but the other possible issue may be the operators and supported in/output types.
    * is for scalar product, % for cross product.
    +/- can be applied to both scalars and vectors, but trying a (scalar - vector) will eventually fail.
     
    What I see is a vector*vector*vector which seems a bit odd as ADAMS would have to guess which vector to multiply first into a scalar and then multiply that number with the remaining vector. Maybe some additional () around parts of your equation will help ?