各位,我想编写一个探测器#11随着另外一个变量(反射光探测器#10 随着z的变动)的总功率输出情况。下面宏应该怎样修改呢
# Detector number
detector = 11
# Minimum Z position
z_min = 0
# Maximum Z position
z_max = 100
# Z range
z_range = z_max - z_min
# Number of samples
samples = 5
# Z step size
z_step = z_range / ( samples - 1 )
# Z position array
DECLARE z_position, DOUBLE, 1, samples
# Total flux array
DECLARE flux, DOUBLE, 1, samples
# Loop over the different Z positions
FOR z_indx, 0, samples-1, 1
# Calculate new Z position
z_pos = z_indx * z_step + z_min
z_position(z_indx+1) = z_pos
# Update detector Z position
SETNSCPOSITION 1, detector, 3, z_pos
# Clear detectors
clear = NSDD(1, -detector, 1, 1)
# Raytrace
NSTR 1, 0, 0, 0, 0, 1, 0
# Total power
flux(z_indx+1) = NSDD(1, detector, 0, 0)
NEXT
# Plot
PLOT NEW
PLOT TITLEX, "Z Position"
PLOT TITLEY, "Total Flux"
PLOT FORMATX, "%2.1f"
PLOT DATA, z_position, flux, samples, 1, 0, 0
PLOT GO