Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
System characteristic / transfer function
#1
Hello,

I am working with a PMAC2 control, using the PMAC Executive Suite 3.2 for communications. My objective is to get a transfer function of the controlled (closed loop) system, obtained by frequency sweeps.
The PMAC TuningPro software includes a possibility to sweep, but it is:

1. limited to 225 Hz (servo loop cycle is 9.0346 kHz)
2. limited to integer numbers for the time range
3. not permitting any control of the capturing rate

My questions are related to these problems:

Can I manually change the deposited programs for these kind of motions? Where can I find them? How can I gather data from terminal, plotting them into a file? The LIST GATHER command only plots them in the terminal, where I am unable to save them for further processing.
Reply
#2
On the other hand there is the PMAC Plot tool, where I can gather data at any desired capturing rate and time range, but there I cannot initiate a commanded sweep simultaneously.

I found that program for getting a step response. But then I cannot read the data out at the end, even though they were captured. SIZE returns 34546 at the beginning. Then I capture 10000 values, so SIZE would return 24546. For capturing I set:

I19=1
I20=3
I21=$800028
I22=$80002B
I45=0
DELETE GATHER
DEFINE GATHER 10000
GATHER or CMD "GAT"
...
ENDGATHER or CMD "ENDGAT"

Now the data are captured. But how to get them into a file? I will be able to transform the hex data into counts surely, once I have them I a file, but how to? Copy and paste from the terminal is not working.
Reply
#3
Now I tried it with a step response program. The program looks like:

_____________________________________________________________
; Setup and Definitions
; ################################################
CLOSE
P80=1000; ; step size in counts
M88->X3,18 ; Data gather prep bit
M89->X3,19 ; Data gather on bit
M0 ->X0,24 ; Servo cycle counter (=timer)
M85->X$07F0,24 ; Memory allocation for start time
M86->X$07F1,24 ; Memory allocation for elapsed time
M81->D$0028 ; #1 cmd position register

; Setup Gathering variables
; ###############################################
I19=1 ; gather each servo cycle
I20=3 ; gather two variables
I21=$800028 ; gather cmd position
I22=$80002B ; gather act position
I45=0

; ###############################################
OPEN PLC 2
CLEAR

CMD"DEL GAT"
CMD"DEF GAT 20000"
CMD"GAT" ; Start data gathering
P81=P80*I108*32 ; step time
P86=P85*8388608/I10 ; step time in servo cycles
M81=M81+P81 ; increment the commanded position
M85=M0 ; start of the timer
M86=M0-M85 ; time elapsed so far
While (M86 < P86)
M86=M0-M85
EndWhile
M81=M81-P81 ; now decrement commanded position again
M85=M0 ; Restart timer
M86=M0-M85 ; Time elapsed
While (M86 < P86)
M86=M0-M85
EndWhile
CMD"ENDGATHER"
DISABLE PLC 2 ;
CLOSE
; ###############################################
I5=3;
____________________________________________________________

Now typing LIST GATHER on the shell, there will be just 2 hex numbers.

Using the same settings be online command data gathering, following:

DELETE GATHER
DEFINE GATHER 20000
GATHER
ENDGATHER

LIST GATHER

I will get the values out. Now I can even export them by PMAC PLOT, what I found, by simply pressing on 'upload'. But then I don't have the step response.
Why won't that work for the PLC program? The step response is indeed carried out by the drive (a little click noise), but the data are not captured correctly.
Reply
#4
The aim is actually to define several sweeps in different frequency ranges to obtain transfer functions, which can be concatenated. But then for the higher frequencies one needs to make the sweep time quite short in order to enable a storage of the full response.
Reply
#5
Is that because the PLC program starts anew after execution, before it is cancelled by the DISABLE command and so the buffer would be initialized twice and the data cannot be captured? If so, what can I do against it?
Or is there another reason for my capturing endeavor to fail? What goes wrong?
Reply
#6
When using the CMD"" in a PLC you will need to have a one pass while loop to force the execution otherwise these will not execute until one pass of the PLC:
CMD"GAT"
p99=1
while (p99=1)
p99=0
endwhile
Reply
#7
It works now. I use a program like that, where I only have to change the four sweep parameters:

; Initiate sweep definition
; ####################################################
CLOSE
DELETE GATHER
P70=1 ; start frequency [Hz]
P71=10 ; stop frequency [Hz]
P80=400; ; sweep magnitude [cnt] -> 100 nm
P85=1000; ; sweep time [ms]

; Set addresses
; ####################################################
M88->X3,18 ; Data gather prep bit
M89->X3,19 ; Data gather on bit
M0 ->X0,24 ; Servo cycle counter (=timer)
M85->X$07F0,24 ; Memory allocation for start time
M86->X$07F1,24 ; Memory allocation for elapsed time
M81->D$0028 ; #1 cmd position register

; Setup gathering variables
; ####################################################
I19=1 ; gather each servo cycle
I20=3 ; gather two variables
I21=$800028 ; gather cmd position
I22=$80002B ; gather act position
I45=0
DEFINE GATHER 20000 ; prepare data buffer for gathering

; ####################################################
OPEN PLC 4
CLEAR
CMD"GAT" ; Start data gathering

P99=1 ; one pass while loop
While (P99=1) ; to address gathering delay
P99=0
EndWhile

P75=P85/LN(P71/P70) ; calcutate time constant
P76=360*P70/1000; ; calculate omega 0

P81=P80*I108*32 ; amplitude inkrement (position register)
P86=P85*8388608/I10 ; sweep time in servo cycles
P82=M81 ; current commanded position

M85=M0 ; start of the timer
M86=M0-M85 ; time elapsed so far in servo cycles
P87=M86*I10/8388608 ; time elapsed in ms
P72=P76*exp(P87/P75) ; current omega
M81=P82+P81*sin(P72*P87); update position

While (M86 < P86)
M86=M0-M85 ; time elapsed
P87=M86*I10/8388608 ; time elapsed [ms]
P72=P76*exp(P87/P75) ; current omega
M81=P82+P81*sin(P72*P87) ; update position
EndWhile

DISABLE PLC 4 ;

CLOSE
; ####################################################
I5=3;
Reply
#8
Now I just type:

P70=..... ; start frequency [Hz]
P71=..... ; stop frequency [Hz]
P85=....; ; sweep time [ms]
del gat
def gat 34500
ena plc 4

After capturing I go to PMAC PLOT and press 'upload data' which will take a while and then 'plot data'. So I'll finally have my desired data set.

Thanks, problem solved
BUR
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)