Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to write a rule for this relation ? 1

Status
Not open for further replies.

frztrb

Mechanical
Sep 29, 2010
151
IT
Hi All

I have two parameters , one of the type angle 'c' , the other is length 'b', the base amount of b is 25 and for c is 360 degrees , they are related to eachother through a law

I want to write a rule to mention that :

if b > 25 then

c=360+f(b) some function of b

how do I write it in Rule base ?

thank you very much
 
Replies continue below

Recommended for you

to complete it , is this rule correct ?

if (b > 25)
{ a=2*PI+2*PI/25*(b-25)}

since a is angle and b is length , how should I write it ? ? 2*PI or 360 ?
 
but anyway with changing to 360deg also nothing happens , a doesn't change when I change b !!!
 

how do I write it in Rule base ?


/*Rule created by dbezaire 05/02/2014*/


let b (length)
let c (angle)

if b > 25mm
c=360deg+tanh(b/1)

/* the some function of b must return an angle! */



Win XP64
21SP7/22SP5, 3DVIA Composer 2013X, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
 
I wrote this and it did not work again :

/*Rule created by Farzad 2/4/2014*/

let b (length)
let a (angle)
if b > 25mm
a=360deg +360deg/25mm*(b-25mm)

I saw somewhere that I have to use the {} and () does it make any difference ?
I mean writing as :


let b (length)
let a (angle)
if (b > 25mm)
{a=360deg +360deg/25mm*(b-25mm)}

and still , none of them have any affect on a , sorry I change the parameter from 'c' to 'a' ,

 
more clarifying that , in the line a=360deg +360deg/25mm*(b-25mm) , b should be the new amount that I enter , is it correct and does it get the parameter that I am entering for b at the moment ?
 
It should work for you. The {} are used to add multiple lines to the if statement. I dropped an i=3 into the code below to illustrate.

Create a length parameter called b and an angle parameter called a using the F(x) button.

copy paste this code into a rule.

/*Rule created by dbezaire 06/02/2014*/

let i_len (length)
let o_ang (angle)
let i (integer)

/* Inputs */
i_len = b

/* Evaluations */
if b > 25mm
{
o_ang = 360deg + 360deg/25mm * (b-25mm)
i = 3
/* use the bracket to add multi lines to if statement */
}

/* Oututs */
a = o_ang



A should = 432deg

Win XP64
21SP7/22SP5, 3DVIA Composer 2013X, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
 
Actually my function is a sinus , like :


y=r * sin(a/c*x)

and my parameters :

r : Length
c: Real
x : angle ( i tried both radian and degrees , no difference )
y : length
b: length , that is the guide curve of law : x axis

and my rule :

let b (length)
let a (angle)

if b > 1000mm
a=360deg +360deg/1000mm*(b-1000mm)

else if b == 1000mm
a=360deg

else if b < 1000mm
a=360deg + 360deg/1000mm*(b-1000mm)

this works for small amounts of b , there is a compromise between c and b , looks like !! when b is very big , like 1000 mm you can not select c big like 1/60 , you see that the function doesn't have actually a sinusoidal shape !!

my question is :

why ?????????????????????????????????????????
 
 http://files.engineering.com/getfile.aspx?folder=0e17eeeb-6552-4d64-8dcb-681a3271b4f3&file=Untitled.jpg
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top