David Edelman Posted March 28, 2023 Posted March 28, 2023 I have a signal that gives the wind direction in degrees from North (0-360). I want to convert a range of values to a cardinal direction, so I used "toStates" with a custom group to do so $wind_dir = group( capsule(0, 22.5).setProperty('Value', 'N'), capsule(22.5, 67.5).setProperty('Value', 'NE'), capsule(67.5, 112.5).setProperty('Value', 'E'), capsule(112.5, 158.5).setProperty('Value', 'SE'), capsule(158.5, 202.5).setProperty('Value', 'S'), capsule(202.5, 247.5).setProperty('Value', 'SW'), capsule(247.5, 292.5).setProperty('Value', 'W'), capsule(292.5, 337.5).setProperty('Value', 'NW'), capsule(337.5, 360).setProperty('Value', 'N') ) $w0wd.toStates($wind_dir) This formula works, but the Y axis is sorted alphabetically (W, SW, SE, S, etc). Can I force a particular sorting (N, NE, E, etc) or is there a different/better way to implement the above? Thanks, David
Seeq Team James DeMarco Posted March 28, 2023 Seeq Team Posted March 28, 2023 If you modify your wind_dir variable to $wind_dir = group( capsule(0, 22.5).setProperty('Value', 'ENUM{{0|N}}'), capsule(22.5, 67.5).setProperty('Value', 'ENUM{{1|NE}}'), capsule(67.5, 112.5).setProperty('Value', 'ENUM{{2|E}}'), capsule(112.5, 158.5).setProperty('Value', 'ENUM{{3|SE}}'), capsule(158.5, 202.5).setProperty('Value', 'ENUM{{4|S}}'), capsule(202.5, 247.5).setProperty('Value', 'ENUM{{5|SW}}'), capsule(247.5, 292.5).setProperty('Value', 'ENUM{{6|W}}'), capsule(292.5, 337.5).setProperty('Value', 'ENUM{{7|NW}}'), capsule(337.5, 360).setProperty('Value', 'ENUM{{8|N}}') ) You will get an ordered Y axis: This is how Seeq handles enum Signal values from other systems - it has some limitations, but it seems like it should work well for your use case. 2 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now