%!PS % CONVERTING MAGIC SINEWAVE SEQUENCES TO THREE PHASE PORT VALUES % ============================================================== % Copyright c 2001 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.5 % Relating a single phase sequence to actual delta friendly three phase sequences % is a nonobvious process. This utility and tutorial gives you needed guidelines. % Example results for a Steplock Delta-28 appear below. % To use, modify the code for the number of pulses per quadrant. Copy typical values % (must not round significantly). Send to Distiller. View PDF file. Read log file. % ========= % This file requires the previous download of gonzo.psl % available from https://www.tinaja.com/pssamp1.shtml % Make sure the following line agrees with your own gonzo.psl location (C:/Users/don/Desktop/gonzo/gonzo.psl) run % use internal gonzo % ========== /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def % guru % activate gonzo utilities 50 50 10 setgrid % create grid 36 21 showgrid % show grid under waveforms % /firstquad returns a 1 or a 0 for an angle input, showing whether the waveform % was high or low. /firstquad { ang1 0 ge ang1 p1s lt and {0} if % before first pulse ang1 p1s ge ang1 p1e lt and {1} if % during first pulse, etc... ang1 p1e ge ang1 p2s lt and {0} if ang1 p2s ge ang1 p2e lt and {1} if ang1 p2e ge ang1 p3s lt and {0} if ang1 p3s ge ang1 p3e lt and {1} if ang1 p3e ge ang1 p4s lt and {0} if ang1 p4s ge ang1 p4e lt and {1} if ang1 p4e ge ang1 p5s lt and {0} if ang1 p5s ge ang1 p5e lt and {1} if ang1 p5e ge ang1 p6s lt and {0} if ang1 p6s ge ang1 p6e lt and {1} if ang1 p6e ge ang1 p7s lt and {0} if ang1 p7s ge ang1 p7e lt and {1} if ang1 p7e ge ang1 90 lt and {0} if } def % /findval finds whether a waveform is -1 0 or +1 over the full 360 degree range % and with 0 120 240 phase adjustments... /findval { phase add /ang exch store ang 360 gt {/ang ang 360 sub store} if % two cycles for advanced phases ang 0 ge ang 90 lt and {/ang1 ang store firstquad 1 mul} if ang 90 ge ang 180 lt and {/ang1 180 ang sub store firstquad 1 mul} if ang 180 ge ang 270 lt and {/ang1 ang 180 sub store firstquad -1 mul} if ang 270 ge ang 360 lt and {/ang1 360 ang sub store firstquad -1 mul} if }def % /plotval plots a magic sinewave sequence... /plotval { /phase exch store 0 0 moveto % remember phase set position 0 0.005 360 {/ang exch store % draw waveform ang 10 div ang findval howhigh mul lineto } for } def % Data for demo -- must be more accurate than increment used. From steplock calculators. /p1s 10.156711127772951 store /p1e 11.268717574719588 store /p2s 18.58728463691665 store /p2e 19.127010307009833 store /p3s 23.779717622989942 store /p3e 26.45918078308344 store /p4s 36.22028237701006 store /p4e 40.87298969299017 store /p5s 49.84328887222705 store /p5e 56.00415695471968 store /p6s 63.99584304528032 store /p6e 71.26871757471959 store /p7s 78.58728463691665 store /p7e 86.45918078308344 store %%%%% demos %%%%% /howhigh 2 store % plot three waveforms gsave 0 8 translate 120 plotval line1 stroke grestore gsave 0 13 translate 240 plotval line1 stroke grestore gsave 0 18 translate 0 plotval line1 stroke grestore gsave /howhigh 2.0 store 1 0.6 0 setrgbcolor % merge three color waveforms 0 3 translate 240 plotval closepath fill grestore gsave /howhigh 2.0 store 0 1 1 setrgbcolor 0 3 translate 120 plotval closepath fill grestore gsave /howhigh 2.0 store 1 0 1 setrgbcolor 0 3 translate 0 plotval closepath fill grestore black /phase 0 store % /finalpat produces final pattern [ x y z ] from [a b c ]. A clockwise current % is assumed as positive. Motor reverses by reversing the entire sequence. % x--(winding a)--y--(winding b)--z--(winding c)--x -- % The allowable delta friendly sequences (all MUST sum to zero) are... % [-1 +1 0] ---> [ 1 0 1 ] % [-1 0 +1] ---> [ 1 0 0 ] % [ 0 -1 +1] ---> [ 1 1 0 ] % [ 0 0 0] ---> [ 0 0 0 ] ( or [ 1 1 1 ] ) % [ 0 +1 -1] ---> [ 0 0 1 ] % [+1 -1 0] ---> [ 0 1 0 ] % [+1 0 -1] ---> [ 0 1 1 ] % while possible, the redundant [1 1 1] is not yet used here. % Under certain circumstances, it might slightly reduce transitions from [0 0 0]. % But leaving ports high can be a bad scene. % /finalpat does the above lookup logic... /finalpat { [ (bad sequence) ] aaa -1 eq bbb 1 eq ccc 0 eq and and {pop [1 0 1]} if aaa -1 eq bbb 0 eq ccc 1 eq and and {pop [1 0 0]} if aaa 0 eq bbb -1 eq ccc 1 eq and and {pop [1 1 0]} if aaa 0 eq bbb 0 eq ccc 0 eq and and {pop [0 0 0]} if aaa 0 eq bbb 1 eq ccc -1 eq and and {pop [0 0 1]} if aaa 1 eq bbb -1 eq ccc 0 eq and and {pop [0 1 0]} if aaa 1 eq bbb 0 eq ccc -1 eq and and {pop [0 1 1]} if } store % /report writes the levels and the phase patterns to the log file. /reportnew { /rawpat mark aaa bbb ccc ] store ([ ) print aaa 10 string cvs print ( ) print bbb 10 string cvs print ( ) print ccc 10 string cvs print ( ] ---> [ ) print finalpat 0 get 10 string cvs print ( ) print finalpat 1 get 10 string cvs print ( ) print finalpat 2 get 10 string cvs print ( ]\n) print /aaahold aaa store /bbbhold bbb store /ccchold ccc store } def /aaahold 999 store % makes sure of an initial change /bbbhold 999 store /ccchold 999 store % /scanforchanges is a crude way of walking through the waveform and noting every % time a needed pattern changes... /scanforchanges { 0 0.1 360 {/curang exch store curang 0 add findval /aaa exch store curang 120 add findval /bbb exch store curang 240 add findval /ccc exch store aaa aaahold ne bbb bbbhold ne or ccc ccchold ne or {reportnew} if } for } def scanforchanges % /verifyspacing checks the delays needed for the first 120 degrees /spacing [ 0 60 p5e sub p1s p1e p2s p2e p3s p3e 60 p3e sub 60 p3s sub 60 p2e sub 60 p2s sub 60 p1e sub 60 p1s sub p5e p6s 60 p1s add p6e p7s 60 p2e add 60 p3s add p7e 180 p7e sub 120 p3s sub 120 p2e sub 120 p2s sub 120 p1e sub 120 p1s sub 60 p5e add 120 ] def /verifyspacing {line1 spacing { 10 div 0 mt 0.5 u } forall 0 0 mt 12 r } def verifyspacing % note mirror symmetry about 30 degrees. %%%%%%%%%%%%%%%%%%%%%%%%%% IMPORTANT ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Note that a delta friendly steplock-28 only requires SEVEN delay values! % An eighth convenience value can be added for defined cycle boundaries. % As the verifyspacing plot shows, these values are read in frontwards sequence % from 0 to 30 degrees, backwards from 30 to 60 degrees, frontwards from 60 to 90 % degrees, and so on. % Further, since there are 21 repeated delay values per quadrant, or 84 delay % values total, use of only EIGHT BIT or SINGLE BYTE values would give % 84 x 256 = 21,504 samples per cycle and MIGHT prove accurate enough for magic % sinewaves with moderately reduced harmonic tolerances. % Thus, as few as 700 bytes of storage might be needed for a hundred amplitudes % of SL28R WITHOUT any interpolation and many fewer bytes with. % Note also that the transient latency would be approximately 4.28 degrees worst % case and half that typically. %%%%%%%%%%%%%%%%%%%%%%% CALCULATING DELAY VALUES %%%%%%%%%%%%%%%%%%%%%%%% % Eight differential delay values can be defined per amplitude for the 0 to 30 % degree interval... % a = (60 - p5e) - 0 % really only half the time between output changes % b = p1s - (60 - p5e) % c = p1e - p1s % d = p2s - p1e % e = p2e - p2s % f = p3s - p2e % g = p3e - p3s % h = 30 - p3e % really only half the time between output changes % The algorithm for the first 30 degrees becomes... % output [000] delay a % output [001] delay b % output [011] delay c % output [000] delay d % output [011] delay e % output [001] delay f % output [011] delay g % output [000] delay h % The delay values repeat WITH DIFFERENT PATTERNS for successive intervals. From % 30 to 60, values go BACKWARDS from h to a. From 60 to 90 values go FRONTWARDS % from a to h. From 90 to 120, values go BACKWARDS from h to a. % Patterns are shown below. Note that no pattern change happens when crossing a % 0 30 60 ... boundary. While delays of 2a and 2h could be used, it would seem % to be a good idea to preserve these phase reference boundaries. Especially zero. % Above 120 degrees, the entire pattern repeats phase shifted by one leg. For instance, % the pattern associated with delay b just past zero is [001]. Just past 120 is [010}. % Just past 240 is [100]. Note that a FIVE element array of [00100] can be used with % selectable offsets of 0, 1, or 2. % Actual delay times relate both to the magic sinewave frequency and amplitude. As % an example, a 60 Hertz waveform repeats every 16.667 milliseconds or 16,667 % microseconds. One degree of such a waveform is 16,667/360 or 46.29722 microseconds. % a through h values can be found by multiplying by the current microseconds per % degree constant. For instance delay c = 46.29722 (p1e - p1s). % Or, in this specific example of 0.53 amplitude steplock 28R 60 Hertz, % delay c = 46.2922 ( 11.2687 - 10.1567 ) = 51.47693 microseconds. % Note that timing accuracies of 1 part in 30,000 or so normally MUST be maintained! showpage % complete plot % logfile should return these abc phase values. Should be valid % for all amplitudes of Delta28R. % Should compare exactly to PDF plot. % (+1) = clockwise phase winding current % (-1) = counterclockwise phase winding current. % (0) = no phase winding current % [ 0 0 0 ] ---> [ 0 0 0 ] from 0 degrees to (60 - p5e) a % [ 0 1 -1 ] ---> [ 0 0 1 ] from (60 - p5e) to p1s b % [ 1 0 -1 ] ---> [ 0 1 1 ] from p1s to p1e c % [ 0 0 0 ] ---> [ 0 0 0 ] from p1e to p2s d % [ 1 0 -1 ] ---> [ 0 1 1 ] from p2s to p2e e % [ 0 1 -1 ] ---> [ 0 0 1 ] from p2e to p3s f % [ 1 0 -1 ] ---> [ 0 1 1 ] from p3s to p3e g % [ 0 0 0 ] ---> [ 0 0 0 ] from p3e to (60 - p3e) h + h crossing 30 % [ 0 1 -1 ] ---> [ 0 0 1 ] from (60 - p3e) to (60 - p3s) g % [ 1 0 -1 ] ---> [ 0 1 1 ] from (60 - p3s) to (60 - p2e) f % [ 0 1 -1 ] ---> [ 0 0 1 ] from (60 - p2e) to (60 - p2s) e % [ 0 0 0 ] ---> [ 0 0 0 ] from (60 - p2s) to (60 - p1e) d % [ 0 1 -1 ] ---> [ 0 0 1 ] from (60 - p1e) to (60 - p1s) c % [ 1 0 -1 ] ---> [ 0 1 1 ] from (60 - p1s ) to p5e b % [ 0 0 0 ] ---> [ 0 0 0 ] from p5e to p6s a + a crossing 60 % [ 1 0 -1 ] ---> [ 0 1 1 ] from p6s to (60 + p1s) b % [ 1 -1 0 ] ---> [ 0 1 0 ] from (60 + p1s) to p6e c, etc... % [ 0 0 0 ] ---> [ 0 0 0 ] from p6e to p7s % [ 1 -1 0 ] ---> [ 0 1 0 ] from p7s to (60 + p2e) % [ 1 0 -1 ] ---> [ 0 1 1 ] from (60 + p2e) to (60 + p3s) % [ 1 -1 0 ] ---> [ 0 1 0 ] from (60 + p3s) to p7e % [ 0 0 0 ] ---> [ 0 0 0 ] from p7e to (180 - p7e) crosses 90 deg % [ 1 0 -1 ] ---> [ 0 1 1 ] from (108 - p7e) to (120 - p3s) % [ 1 -1 0 ] ---> [ 0 1 0 ] from (120 - p3s) to (120 - p2e) % [ 1 0 -1 ] ---> [ 0 1 1 ] from (120 - p2e) to (120 -p2s) % [ 0 0 0 ] ---> [ 0 0 0 ] from (120 - p2s) to (120 - p1e) % [ 1 0 -1 ] ---> [ 0 1 1 ] from (120 - p1e) to (120 - p1s) % [ 1 -1 0 ] ---> [ 0 1 0 ] from (120 - p1s) to (60 + p5e) % [ 0 0 0 ] ---> [ 0 0 0 ] from (60 + p5e) to 120 degrees. % [ 0 0 0 ] ---> [ 0 0 0 ] sequence repeats phase shifted by one % [ 1 -1 0 ] ---> [ 0 1 0 ] note that a five element array can be % [ 0 -1 1 ] ---> [ 1 1 0 ] used, phase shifting 3/5 per triad 120. % [ 0 0 0 ] ---> [ 0 0 0 ] % [ 0 -1 1 ] ---> [ 1 1 0 ] % [ 1 -1 0 ] ---> [ 0 1 0 ] % [ 0 -1 1 ] ---> [ 1 1 0 ] % [ 0 0 0 ] ---> [ 0 0 0 ] % [ 1 -1 0 ] ---> [ 0 1 0 ] % [ 0 -1 1 ] ---> [ 1 1 0 ] % [ 1 -1 0 ] ---> [ 0 1 0 ] % [ 0 0 0 ] ---> [ 0 0 0 ] % [ 1 -1 0 ] ---> [ 0 1 0 ] % [ 0 -1 1 ] ---> [ 1 1 0 ] % [ 0 0 0 ] ---> [ 0 0 0 ] % [ 0 -1 1 ] ---> [ 1 1 0 ] % [ -1 0 1 ] ---> [ 1 0 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