Grasshopper

algorithmic modeling for Rhino

Hi All,

I need some help in conditional evaluating hourly values for a condition and give the values and also output true or false. I have 8760 hourly illuminance data for sensors and I want to evaluate the following for each hour the following condition

 If (x >= 14000 and if (x-1) >=6000) = True, else = False.

I tried to use evaluate function but it is not taking and operator.

How can I do this in grasshopper either using either, expressions, operators or using the GHpython script? (I am new to GHpython).

Please see the attached screen shot of the GH diagra and GH file

Any pointer or suggestion would be of great help.

Regards,

Aditya

Views: 1481

Attachments:

Replies to This Discussion

Surely if x is larger than 14000, then x is also always larger than 6000? 

David,

Yes that is true. I am trying to predict the position of blind by measuring and evaluating "x" for every hour( simple up or down). I had my criteria defined incorrectly. It would be a single value against which I will be evaluating i.e x >= 6000. 

and i think i can use the lager than component and dispatch which is easier.

However, if i were to do it via GHpython, how to make list of x read  and apply the condition.

Thanks,

If it's just a single comparison, you can use the Larger Than component, but the expression components will also work:

x > 6000   (this will return true or false)

Or if you want two conditional evaluations:

x < 14000 And x > 6000    (will return a single true/false value)

If you want to return something other than just a boolean, then you need to use the If function:

If(x>14000, "REALLY BIG", If(x>6000, "Regular big", "small"))

The above expression will return "REALLY BIG" if x is larger than 14000, it wll return "Regular big" if x is between 6000 and 14000 and it will return "small" if x is less than 6000.

David- Thanks for the suggestion. I will try using the function expression.

hi Aditya

  For a simple example,Check the attached file

Attachments:

Hi- Thank you for posting a sample python script. I will test something similar for my project. Appreciate your help.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service