Jump to content

How to construct an "if" sentence in user defined inspection


---
 Share

Recommended Posts

Hello,

during a mechanical test, we exported the force using two analog channels with different scaling, for example F_fine: 10V=1000N and F_coarse: 10V=100000N.
I would like to generate a user defined inspection F_combined that gives as an output F_fine when F_coarse<900N and F_coarse when F_coarse>=900N.

For tha I would need a conditional sentence. I saw that "if", "then" and "else" are being recognized, since they appear green, but I am not able to form a correct sentence.

Thank you in advance for the help.

Best Regards,

Luciano Avila Gray

Link to comment
Share on other sites

Hello Luciano,

the syntax is like in python. We have a free elearning on it in the training center. Chapter 3 is dealing with conditional sentences:

https://training.gom.com/course/78355?r=False&ts=637581280563824382

The code is also sensitive to indents. So if you are sure that the text is correct maybe check the indent. You can also post your code here using the <> symbol in the reply form.

Regards,

Nanno

Link to comment
Share on other sites

Hello Nanno,

thank you very much for the fast reply.

I have tried that but I still get an error: "A scalar result is expected..."

The code you can see in the screeshot:

B.actual_value
if A.actual_value>10000 :
    A.actual_value

Am I missing something?

Thank you very much!

Luciano

 

grafik.png.d5497158b1bc3da441b47b0225862682.png

 

Link to comment
Share on other sites

Ok, I got it

 

x=Kf.actual_value
if K.actual_value>19500:
    x=K.actual_value

x

Thank you very much!

Best Regards,

 

Luciano

Link to comment
Share on other sites

 Share

×
×
  • Create New...