Convert Wind Direction Degrees to Compass Directions

Hello is anybody here have a program for DeltaV which we can use to convert the degrees reading from a 4-20mA anemometer to a compass directions (N, NE, S, W etc.)

We recently installed an anemometer to measure wind speed and directions. We are having trouble doing the conversion of wind directions which is 0 - 360 degress to a compass directions which would be easier to understand.

Thank you in advance.

7 Replies

  • Do you need this in the controller or at the workstation in a GEM or a Dynamo?

    Andre Dicaire

  • In reply to Andre Dicaire:

    Hello Andre, thanks for the reply, we are currently running DeltaV Operate. We've assigned the IO to a controller already and have a control module with AI block. Just wanted the program to use to convert the degrees to compass directions. Once, configured we will show it in DV Operate graphics and will probably use as well as an interlock for some valves we have.
  • In reply to Andre Dicaire:

    I think we found something Andre, we'll try this out. It's talking about an array of strings for the compass directions and then the formula or program to convert the degrees to the declared array of compass directions.

    www.campbellsci.ca/.../convert-wind-directions

    If you have a better one then you can let me know as well. We'll use the calc block to do the mentioned program and see. Thank you.
  • In reply to dolatrec:

    As another option, you can the rotation angle parameter for a group of line and an arrowhead in Operate as the "needle" in a compass and show it in the graphics. And have a simpler expression (without conversion using arrays) in the calc block for an interlock.
  • In reply to Ralph Ferrer:

    Thanks for the reply Ralph, this is also ok, we'll see how crowded is the graphics page we will use.
  • In reply to dolatrec:

    The AI block is generating a value from 0 to 360, and you need to divide this into 8 segments to which you would assign a text value of N, NE,E, SE, S, SW,W NW, or add eight more if you want NNE, SNE, NSE, SSE etc. i.e. 45 degree increments or 22.5 degree increments.

    So a CALC block can easily generate a section number, (Round (X Deg/45 ) or use IF Then logic. I like a simple math equation. You would end up with something like 0 to 7 or 0 to 15. Easy enough to test from 0 to 389.9.

    You could then use a Named Set to convert Integer to string in the controller, read the "/wIND_DIR.CVS" STRING.

    Or you pass the degrees to the HMI and do the math there, Use a CASE statement on the resulting integer to define the current wind direction word. You can do as Ralph suggests to animate the rotation of a pointer, and you can place the quadarnt text in a field next to the arrow.

    This is pretty simple math and easy enough to replicate. Passing an Integer value from the controller is probably most efficient, over a float or Text.

    So my starting point would be to convert the degrees to direction index in the controller, and build a dynamo to convert that to string. Use the Degrees value to animate rotation on an arrow if you like.

    Another way to convert to index is use a Characterizing module and set a staircase curve (0,0), (22.5,0),(22.5,1), (45,1), (45,2), (67.5), etc, such that when X is between 22.5 and 45, Y equals 1, etc. Wire that to an Integer Parameter and let DeltaV convert float to Integer. i.e. 1.99 will be 2.

    Expressions with a bunch of IF THEN Else Statements would work, and if you like that. Easy enough to set an integer or even write to a string, or do both. From a Loading perspective, not the best, but in reality, you don't need to update this every second. A block multiplier on a CALC block would be good.

    I'd also add a filter in the AI block so the Degree value isn't swinging around alot. Take the jitter out of the reading

    Whatever floats your boat, or in this case, fills your sails...

    Andre Dicaire

  • In reply to Andre Dicaire:

    Thank you for this Andre, so far we've used the Round formula inside a calc block with a bunch of IF THEN statements and working fine, for the graphics we've also used an arrow with rotate expert animation as what mentioned as well. Thank you for all the suggestions and explanations. We'll just tune the compass graphics and make it nicer next week. As always, Thank you