cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Using simplified equation of value limit

KB_10612849
5-Regular Member

Using simplified equation of value limit

KB_10612849_0-1678450925206.png

hello.

I want to use the simplified equation surrounded by the red line instead of the ( if function) , how i can make it work?

thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Its not clear to me what you actually want and what you mean by "instead of the if-function".

What you has encircled in red is a boolean expression - its either 0 (=false) or 1 (=true). Do you really want your k.c to be 0 or 1 only?

Actually you already use the encircled expression in your calculation, but of course you have to tell Prime what to do if the expression is not in between the two values and this can be done with if statements or using the if-function, if you feel that the if statements take up to much space:

Werner_E_0-1678453881500.png

A tricky way to achieve the same effect is using the min and max functions:

Werner_E_1-1678453969133.png

 

 

View solution in original post

4 REPLIES 4

Its not clear to me what you actually want and what you mean by "instead of the if-function".

What you has encircled in red is a boolean expression - its either 0 (=false) or 1 (=true). Do you really want your k.c to be 0 or 1 only?

Actually you already use the encircled expression in your calculation, but of course you have to tell Prime what to do if the expression is not in between the two values and this can be done with if statements or using the if-function, if you feel that the if statements take up to much space:

Werner_E_0-1678453881500.png

A tricky way to achieve the same effect is using the min and max functions:

Werner_E_1-1678453969133.png

 

 

KB_10612849
5-Regular Member
(To:Werner_E)

I want kc to be equal to the equation but not less than 0.35 and not more than 0.76, but the result gives me zero, how I can make it give the same result as the (if function)?

See my suggestions above.

 

Again, what you encircled is a Boolean expression and so its value is either 0 or 1. You can use Boolean expression in if-functions, if-statements, while-loops, ... But the expression itself will always be either 0 or 1, depending on if its false or true.

 

Here are some other variants

Werner_E_0-1678454649457.png

Werner_E_1-1678454692209.png

And if you need it more than once to limit a variable in between two values, you may consider using a little utility function

Werner_E_2-1678454855001.png

 

 

 

KB_10612849
5-Regular Member
(To:Werner_E)

Very thanks.

Top Tags