Command File Examples

 

A few examples of command files are included in this section. Remember that the DADiSP Trial contains a number of command files. See the DEMODIR subdirectory of your main DADiSP application directory; command files have a ".dsp" extension.

 

! vibes.dsp

removewin(-1) @CR

addwin(6) @CR

moveto(w1) @CR

@POP("p1",-1,-1,

"

This command file creates a Worksheet that  

 

analyzes vibration data; it calculates the  

 

spectrum, and identifies the magnitude and  

 

frequency of the 3 major components. 

")

@PAUSE(10)

@UNPOP("p1")

!

Loadseries("Vibration.1.RSensor");label("Vibration.1.RSensor") @CR

wincolor(black,yellow) @CR

!

moveto(w2) @CR

Spectrum(extract(W1-mean(W1),1,1024));sticks @CR

label("Spectral Content");wincolor(blue,yellow) @CR

scales(2) @CR

@CR

zoom @CR

!

! The next command stops the execution of the command file until the

! user presses the OK button. The advantage is that the user has

! control, and can move the message box anywhere in the worksheet.

!

message("Spectrum of Vibration Data","Displays Magnitude vs. Frequency",3) @CR

!

@ESC ! unzooms the window

!

moveto(w3) @CR

Getpeak(W2) @CR

wincolor(black,lcyan) @CR

!

moveto(w4) @CR

W3>0.1 @CR

wincolor(black,lgreen) @CR

!

moveto(w5) @CR

setprecision(4) @CR

Ravel(Delete(W4*xvals(W3),W4==0),delete(W4*W3,W4==0));tableview @CR

label("Frequency Components") @CR

wincolor(white,black) @CR

setcomment("Hz",1,1) @CR

setcomment("Ampl",1,2) @CR

@RETURN

 

A command file can call another command file.

 

! Master.dsp

removewin(-1) @CR

addwin(6) @CR

moveto(w1) @CR

@POP("p1",-1,-1,

"

This command file asks the user a series of  

 

questions to determine the type of analysis  

 

which the user desires.  

 

Note the use of Message boxes and different  

 

command files called from this 'master' file. 

")

@PAUSE(10)

@UNPOP("p1")

message("Two Options for Analysis:","Statistics or Vibration",3) @CR

if(Message("Analysis","Do you want to perform Statistical Analysis?",5),load("stats.dsp")) @CR

@CALL("vibes.dsp",1)

moveto(w1) @CR

@CR

zoom @CR

message("Vibration Analysis","This is the raw data.",3) @CR

@ESC

moveto(w5) @CR

@F10

message("Vibration Analysis","These are the 3 major components.",3) @CR

@ESC

@RETURN

 

Here is the Stats.dsp command file called by the "Master" command file above:

 

! stats.dsp

removewin(-1) @CR

addwin(6) @CR

moveto(w1) @CR

@POP("p1",-1,-1,

"

This command file creates a Worksheet that  

 

performs statistical analysis; it calculates  

 

and compares linear and polynomial regression.  

")

@PAUSE(10)

@UNPOP("p1")

!

Loadseries("TENSILE.1.STRAIN_RATE");label("TENSILE.1.STRAIN_RATE") @CR

wincolor(black,yellow) @CR

!

moveto(w2) @CR

linreg(w1);label("Linear Regression") @CR

!

moveto(w3) @CR

polyfit(w1,3,-1);tablev @CR

wincolor(white,blue) @CR

message("Polynomial Fit","These are the polynomial coefficients.",3) @CR

!

moveto(w4) @CR

polygraph(w3,xvals(w1));wincolor(black,lred);label("Polynomial Regression") @CR

!

moveto(w5) @CR

w1;overplot(w2,lgreen);overplot(w4,red) @CR

wincolor(lgrey);label("Comparison of Regressions") @CR

@F10

message("Comparison","Raw Data with Linear & Polynomial Regression",3) @CR

@ESC

!

moveto(w6) @CR

w3-w1;label("Residuals") @CR

@RETURN