iLogic, Trig Functions, Degrees and Radians

iLogic, Trig Functions, Degrees and Radians

TKey_Luttrell
Advocate Advocate
2,564 Views
2 Replies
Message 1 of 3

iLogic, Trig Functions, Degrees and Radians

TKey_Luttrell
Advocate
Advocate

Alright folks, i am just confused at the moment.

I am doing some calculations using trig functions in iLogic, and saving all the values back to parameters just to check that things are working as intended.

 

So i started my calculation with a parameter named Angle, which is set to 65 degrees.

so i have another parameter named TRIG_THETA which is set to radians.

and in iLogic i said

TRIG_THETA = (Angle* Math.PI) / 180

which should convert Angle into its Radian equivalent, and save that value to TRIG_THETA.  This is NOT what it does.  it takes the degree value, converts it to the radian value...the converts it AGAIN, ie 65 degrees becomes 1.17...becomes something very tiny.

So i went back and just said

TRIG_THETA = Angle

and TRIG_THETA displays as the correct radian value, so i continued and extrapolated the rest of my variables out from there...but noticed a few of my tangent functions are calculating as if i put degree values into them instead of radian values, despite the values being in radians.  So i am just confused, and am doing something wrong here.

------------------------------------------------
This is my ilogic  (attached is a screenshot of my parameters, the redmarks denote the lines that are not calculating as i expected them too)

TRIG_THETA = Angle
TRIG_RHO = 180 deg - TRIG_THETA
TRIG_ALPHA = TRIG_RHO / 2
TRIG_BETA = TRIG_RHO - (90 deg)
TRIG_X = Width_Front
TRIG_Y = Stone_Thickness + Substrate_Thickness
TRIG_Z = Substrate_Thickness
TRIG_B = TRIG_Y / Tan(TRIG_ALPHA)
TRIG_A = TRIG_X - TRIG_B - TRIG_Z
TRIG_D = TRIG_Z * Tan(TRIG_BETA)
TRIG_C = TRIG_A + TRIG_D
TRIG_F = Depth
TRIG_G = Wall_B_Thickness
TRIG_E = TRIG_F - TRIG_G - (2 * TRIG_Z)
TRIG_H = (2 * TRIG_Z) + Stone_Thickness
TRIG_K = TRIG_E - TRIG_H
TRIG_J = TRIG_K * Tan(TRIG_BETA)
TRIG_L = TRIG_C + TRIG_J
TRIG_M = TRIG_L + TRIG_D
TRIG_Q = TRIG_F * Tan(TRIG_BETA)
TRIG_N = TRIG_Q / Sin(TRIG_BETA)
TRIG_P = Stone_Thickness / Cos(TRIG_BETA)
TRIG_R = TRIG_Z * Tan(TRIG_THETA)
TRIG_T = TRIG_N - (2* TRIG_P) + TRIG_R

 





0 Likes
Accepted solutions (1)
2,565 Views
2 Replies
Replies (2)
Message 2 of 3

TKey_Luttrell
Advocate
Advocate

I have no idea why, but changing my iLogic BACK to converting from degrees to radians, and then telling my parameters that the radian values were unitless worked.

0 Likes
Message 3 of 3

johnsonshiue
Community Manager
Community Manager
Accepted solution

Hi! I think I kind of know where the problem is. This is about expression unit confusion. You have mixed units expression. When you write equations in Inventor, you want to make sure each term has the same unit. Otherwise, it would confuse the equation parser.

If I were you, I would use variables to convert the parameters to unitless values. Write the equations of unitless terms. Then convert them back to parameters accordingly.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes