OK, I hope I can make this clear. Here goes:
Start with four lines (a simple compass) in the orientations 0, 90, 180, 270, equivalent with N, E, S, W.
Now take your orientation, and check between which lines it lies. Our example, 30 is between 0 and 90. Check on which side of the middle the given orentation is. 30 is closer to 0 than to 90, so the sequence starts with N.
(Note, that should the given lie exactly on this or a following division, add NE and the sequence is finite).
Then, draw a line through the middle of the lines inbetween our given orientation lies. Our example: 45. Now we check whether the given lies closer to 0 or to 45, which is of course 45. Now we write not NE behind our sequence, but E, because the given tends more to E than to N: NE
Now, half the arc in which the given lies, and we get 22.5 - 45. 30 lies closer to 22.5 than 45: NEN
Half again: 22.5 - 33.75: NENE
Half again: 28.125 - 33.75: NENEN
Continue this contruction and you have your sequence. For 30 degrees it will be NENENENENENENE....
EDIT: I think rgoudie and I have the same answer, but mine is more constructive and less math.