michaelthompson Posted May 24, 2012 Posted May 24, 2012 We are trying to implement greater flexibility in the specification of our data gathering function. Specifically, we would like to pass to the Power PMAC a list of strings at runtime which describe what we would like to gather. For example, we might want to gather any of the exposed PMAC structure elements such as Motor[1].ActPos, but we might also want to gather global P-variables that have been defined and which get modified by our servo and PLC loops. When we use the PMAC Plot program, we can specify gathering of our global P-variables within the Detailed / User Global list. However, we have not found any way to determine the address of a P-variable if we wish to build the gather table from a script, gpascii session, or GetPMACResponse call. Example: Gather.Addr[1]=Motor[1].ActPos.a // works Gather.Addr[2]=myPVariable.a // fails Gather.Addr[3]=P4123.a // fails Gather.Addr[4]=P[4123].a // fails How does the PMAC Plot program manage to determine the address of the P-variables, and is there a way for us to do the same? We are actually doing our primary data gathering ourselves and had planned on using M-variable indirection, but we run into the same problem there. For example, assume my gathering will always acquire M1001 through M1008. If I want to map M1001 to P4123, there does not appear to be a way to do it. M1001->P4123 // fails M1001->P4123.a // fails In order for us to implement a flexible data gathering function, we need to be able to determine both the address and type of any named variable (whether it exists in the Delta Tau structures or not). It would seem that the following would be worth doing (and should be possible): 1. Allow M-variable mapping to P variables (or any other variables for that matter). 2. Allow syntax for .a on all variables (including P variables). This could also be handled with something like AddressOf(myPVariable), AddressOf(M1234), etc. 3. Allow syntax for .t on all variables (including P variables). This could also be handled with something like TypeOf(myPVariable), TypeOf(M1234), etc. 4. Allow syntax for .i on all indexed variable tables. This could also be handled with something like IndexOf(myPVariable). Note that, rather than write our own gather code, we would prefer to use PMAC's gather capability for all of our data acquisition needs, but it is currently limited to a single gather buffer. We therefore only use it for what we call "Black Box" or "Flight Recorder" mode. In this mode, we capture the last minute or so of data continuously in circular fashion. If an E-STOP or other error event occurs, we stop the black box capture (after waiting for several seconds of post-event data) and can then upload and analyze the data. Note that our normal data acquisition would also be occurring simultaneously in the servo loop in a different buffer (and possibly with a different sampling frequency and data list), but it uses the M-variable mapping to specify what gets gathered (only because we can't set up multiple gathers). It would be really nice if we could have several simultaneous gathers running (so long as the rates are kept low enough that the servo/phase interrupts have time to execute). An example of the simultaneous gather buffers we might use are: 1. Normal position / sensor capture for application use 2. Black box recorder for triggered event capture 3. Low priority logging of environmental conditions, motor power, etc. 4. Diagnostic data gathering using PMAC Plot program The reason these make sense to capture as separate gathers is because they have different data of interest, different durations of interest, and different sampling frequencies. It should be possible to accomplish multiple gather buffers by making all of the gather setup functions arrays: // set up first gather operation Gather[0].Addr[0]=...... // set up second gather operation Gather[1].Addr[0]=.... etc.
Sina.Sattari Posted May 24, 2012 Posted May 24, 2012 Michael, In order for you to gather P-variables, you can use the following syntax: Gather.Addr[x]=Sys.P[n].a where n is the P-variable number. You can replace the n with the name of the parameter which you have defined as Global variable. For Q variables: Gather.Addr[x]=Coord[m].Q[n].a For M variables: Gather.Addr[x]=Mxxx
michaelthompson Posted May 24, 2012 Author Posted May 24, 2012 Sina, Thanks. That also appears to work for our M-variable mapping approach: M1001->Sys.P[8105] Appreciate the fast response. Still interested in the multiple gather buffers if you ever see the opportunity to do that. Thanks again, Mike
michaelthompson Posted May 24, 2012 Author Posted May 24, 2012 where n is the P-variable number. You can replace the n with the name of the parameter which you have defined as Global variable. Sina, Although the index P-variable example I tried worked, the named P-variable example does not appear to work for us. Doing something like: Gather.Addr[1]=Sys.P[myPVariable].a generates an error because it converts Sys.P[myPVariable].a to Sys.P[P8123].a instead of Sys.P[8123].a This gets back to needing the ability to get the index number associated with a given named variable.
Sina.Sattari Posted May 24, 2012 Posted May 24, 2012 Michael, I should be able to get this one into firmware fairly easily. Let me see what I can do. Regards,
Recommended Posts