16. ¸ð´ÏÅÍÀÇ ¼º´ÉÀ» ±×·Áº¸±â

¸ð´ÏÅÍ ¸ðµå ´ÙÀ̾î±×·¥À» ±×·Áº¸·Á¸é ¿ì¼± gnuplot ÆÐÅ°Áö(Unix ·ù ¿î¿µÃ¼Á¦ ¿ëÀÇ °ø°³µÈ Ç÷ÎÆà ¾ð¾î)¿Í modeplot À̶ó´Â ½©/gnuplot ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇØ ¸ð´ÏÅÍÀÇ Æ¯¼ºÄ¡¸¦ ¸í·É¾î ¶óÀο¡¼­ ÀÔ·ÂÇؼ­ ±×·Á¾ß ÇÕ´Ï´Ù.

´ÙÀ½Àº modeplot ÇÁ·Î±×·¥ÀÔ´Ï´Ù.

#!/bin/sh
#
# modeplot -- generate X mode plot of available monitor modes
#
# Do `modeplot -?' to see the control options.
#

# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz
# and vertical frequencies in Hz.
TITLE="Viewsonic 21PS"
BANDWIDTH=185
MINHSF=31
MAXHSF=85
MINVSF=50
MAXVSF=160
ASPECT="4/3"
vesa=72.5	# VESA-recommended minimum refresh rate

while [ "$1" != "" ] 
do
	case $1 in
	-t) TITLE="$2"; shift;; 
	-b) BANDWIDTH="$2"; shift;; 
	-h) MINHSF="$2" MAXHSF="$3"; shift; shift;; 
	-v) MINVSF="$2" MAXVSF="$3"; shift; shift;; 
	-a) ASPECT="$2"; shift;; 
	-g) GNUOPTS="$2"; shift;; 
	-?) cat <<EOF
modeplot control switches:

-t "<description>"	name of monitor            defaults to "Viewsonic 21PS"
-b <nn>           	bandwidth in MHz           defaults to 185
-h <min> <max>   	min & max HSF (kHz)        defaults to 31 85
-v <min> <max>   	min & max VSF (Hz)         defaults to 50 160
-a <aspect ratio>	aspect ratio               defaults to 4/3
-g "<options>"   	pass options to gnuplot

The -b, -h and -v options are required, -a, -t, -g optional.  You can
use -g to pass a device type to gnuplot so that (for example) modeplot's
output can be redirected to a printer.  See gnuplot(1) for  details.

The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on
analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de>

This is modeplot $Revision: 1.16 $
EOF
		exit;;
	esac
	shift
done

gnuplot $GNUOPTS <<EOF
set title "$TITLE Mode Plot"

# Magic numbers.  Unfortunately, the plot is quite sensitive to changes in
# these, and they may fail to represent reality on some monitors.  We need
# to fix values to get even an approximation of the mode diagram.  These come
# from looking at lots of values in the ModeDB database.
F1 = 1.30	# multiplier to convert horizontal resolution to frame width
F2 = 1.05	# multiplier to convert vertical resolution to frame height

# Function definitions (multiplication by 1.0 forces real-number arithmetic)
ac = (1.0*$ASPECT)*F1/F2
refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf)
dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr)
resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2)

# Put labels on the axes
set xlabel 'DCF (MHz)'
set ylabel 'RR (Hz)' 6	# Put it right over the Y axis

# Generate diagram
set grid
set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left
set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead
set label "max VSF" at 1, $MAXVSF-1.5
set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead
set label "min VSF" at 1, $MINVSF-1.5
set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead
set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right
set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right
set label "VESA $vesa" at 1, $vesa-1.5
set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1
plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \
  refresh($MINHSF, dcf) notitle with lines 1, \
  refresh($MAXHSF, dcf) notitle with lines 1, \
  resolution(640*480,   dcf) title "640x480  " with points 2, \
  resolution(800*600,   dcf) title "800x600  " with points 3, \
  resolution(1024*768,  dcf) title "1024x768 " with points 4, \
  resolution(1280*1024, dcf) title "1280x1024" with points 5, \
  resolution(1600*1280, dcf) title "1600x1200" with points 6

pause 9999
EOF

ÀÏ´Ü modeplot ¿Í gnuplot ÆÐÅ°Áö¸¦ Á¦´ë·Î ÁغñÇß´Ù¸é ÀÌÁ¦ ´ÙÀ½ ¸ð´ÏÅÍ Æ¯¼ºÄ¡°¡ ÇÊ¿äÇÕ´Ï´Ù.

ÇÃ·Ô ÇÁ·Î±×·¥Àº ´Ü¼øÈ­½ÃŲ Á¶°ÇÇÏ¿¡¼­ ±×¸²À» ±×¸®°Ô µË´Ï´Ù. ÀÌ Á¶°ÇÀÌ Ç×»ó Ÿ´çÇÑ °ÍÀº ¾Æ´Ï¹Ç·Î °á°ú·Î ³ª¿À´Â ´ÙÀ̾î±×·¥Àº ´ë·«ÀûÀÎ ±×¸²ÀÏ »ÓÀÔ´Ï´Ù. Á¶°ÇÀº ´ÙÀ½°ú °°½À´Ï´Ù.

´ë·«ÀûÀÎ °ªÀ¸·Î¼­ F1= 1.30, F2 = 1.05 Á¤µµ·Î Àâ½À´Ï´Ù(ÇÁ·¹ÀÓ Å©±â¸¦ °è»êÇϱ⠺κÐÀ» º¸¼¼¿ä).

ÀÌÁ¦ ƯÁ¤ÇÑ µ¿±â ÁÖÆļö HSF ¸¦ »ý°¢ÇØ º¾½Ã´Ù. ¹æ±Ý ¸»ÇÑ °¡Á¤ÇÏ¿¡¼­ º¸¸é, Ŭ·° ·¹ÀÌÆ® DCF ÀÇ ¸ðµç °ªÀº ÀÌ¹Ì ¸®ÇÁ·¹½¬ ·¹ÀÌÆ® RR À» °áÁ¤Áþ½À´Ï´Ù. Áï, HSF ÀÇ ¸ðµç °ª¿¡ ´ëÇÑ ÇÔ¼ö°ª RR(DCF)°¡ Á¸ÀçÇÏ´Â °ÍÀÔ´Ï´Ù. ÀÌ´Â ´ÙÀ½°ú °°ÀÌ À¯µµµË´Ï´Ù.

¸®ÇÁ·¹½¬ ·¹ÀÌÆ®´Â ÇÁ·¹ÀÓ »çÀÌÁîµéÀÇ °öÀ¸·Î Ŭ·° ·¹ÀÌÆ®¸¦ ³ª´« °ª°ú °°½À´Ï´Ù.

       RR = DCF / (HFL * VFL)            (*)

ÇÑÆí, ¼öÆò ÇÁ·¹ÀÓ ±æÀÌ´Â ¼öÆò µ¿±âÁÖÆļö·Î Ŭ·° ·¹ÀÌÆ®¸¦ ³ª´« °ª°ú °°½À´Ï´Ù.

       HFL = DCF / HSF                   (**)

VFL °¡ HFL ·Î ±Í°áµÉ¼ö ÀÖ´Â °ÍÀº À§ÀÇ µÎ°¡Áö °¡Á¤ ¶§¹®ÀÔ´Ï´Ù.

       VFL = F2 * VR
           = F2 * (HR / AR)
           = (F2/F1) * HFL / AR          (***)

(**) ¿Í (***) ¸¦ (*) ¿¡ ³ÖÀ¸¸é ´ÙÀ½À» ¾ò½À´Ï´Ù.

                      RR = DCF / ((F2/F1) * HFL**2 / AR)
                         = (F1/F2) * AR * DCF * (HSF/DCF)**2
                         = (F1/F2) * AR * HSF**2 / DCF

°íÁ¤µÈ HSF, F1, F2 ,AR ¿¡ ´ëÇؼ­ ´ÙÀ̾î±×·¥¿¡´Â ½Ö°î¼±ÀÌ Çϳª ³ªÅ¸³³´Ï´Ù. ¼öÆò µ¿±âÁÖÆļöÀÇ ÃÖ¼Ò°ª°ú ÃÖ´ë°ª¿¡ ´ëÇØ ÀÌ¿Í°°Àº Ä¿ºê¸¦ ±×¸®¸é µÎ°³ÀÇ °æ°è¼±À» °¡Áö°Ô µÇ°í ±× »çÀÌ°¡ ¹Ù·Î °¡´ÉÇÑ ¿µ¿ªÀÔ´Ï´Ù.

°¡´ÉÇÑ ¿µ¿ªÀ» °¡·ÎÁö¸£´Â Á÷¼±µéÀº ƯÁ¤ÇÑ Çػ󵵸¦ ³ªÅ¸³À´Ï´Ù. ÀÌ°ÍÀº (*) ¿Í µÎ¹ø° °¡Á¤¿¡ ±Ù°ÅÇÕ´Ï´Ù.

                      RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR)

¿øÇÏ´Â ¸ðµç Çػ󵵿¡ ´ëÇØ ÀÌ·± ¶óÀÎÀ» ±×·Áº½À¸·Î½á ´ç½ÅÀº Áï°¢ ±× ¸ð´ÏÅÍ¿¡¼­ °¡´ÉÇÑ ÇØ»óµµ, Ŭ·° ·¹ÀÌÆ®, ¸®ÇÁ·¹½¬·¹ÀÌÆ®°£ÀÇ °ü°è¸¦ ¾Ë¾Æç ¼ö ÀÖ½À´Ï´Ù. ÀÌµé ¶óÀεéÀº ¸ð´ÏÅÍÀÇ Æ¯¼º¿¡ ÀÇÁ¸ÇÏ´Â °ÍÀÌ ¾Æ´Ï¶ó µÎ¹ø° °¡Á¤¿¡¼­ ºñ·ÔµÇ´Â °ÍÀÓ¿¡ ÁÖÀÇÇϽʽÿä.

modeplot ÇÁ·Î±×·¥Àº ÀÌ°ÍÀ» ½±°Ô º¸¿©ÁÝ´Ï´Ù. modeplot -? ÇÏ¸é ±× ¿É¼ÇÀ» ¾Ë ¼ö ÀÖ½À´Ï´Ù. ´ëÇ¥ÀûÀÎ ¿¹´Â ´ÙÀ½°ú °°½À´Ï´Ù.

             modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58

-b ¿É¼ÇÀº ºñµð¿À ´ë¿ªÆøÀ» ÁöÁ¤ÇÕ´Ï´Ù; -v ¿Í -h ´Â °¢°¢ ¼öÆò°ú ¼öÁ÷ µ¿±â ÁÖÆļöÀÇ ¹üÀ§¸¦ ¼³Á¤ÇÕ´Ï´Ù.

modeplotÀÇ Ãâ·ÂÀ» ÀÐÀ» ¶§´Â Ç×»ó ÀÌ°ÍÀÌ ´ë·«ÀûÀÎ ¹¦»ç¿¡ ºÒ°úÇÔ¿¡ À¯³äÇϽʽÿä. ¿¹¸¦ µéÀÚ¸é, µ¿±â ÆÞ½º´Â ÃÖ¼ÒÇÑ ÀÏÁ¤ ÆøÀ» ÇÊ¿ä·Î Çϸç, µû¶ó¼­ ÀÌ¿¡ ºñ·ÔÇÑ HFL °ª¿¡ Á¦¾àÀÌ ÀÖÀ½À» ÀÌ ÇÁ·Î±×·¥Àº ¹«½ÃÇÏ°í ÀÖ½À´Ï´Ù. ¶ÇÇÑ ±×¸²ÀÇ Á¤È®µµ´Â °¡Á¤µéÀÇ Å¸´ç¼º¿¡ Á¿ìµË´Ï´Ù. µû¶ó¼­ Á¾ÇÕ ºÎºÐ¿¡¼­ Á¦½ÃÇÑ °Í°ú °°Àº Á¤¹ÐÇÑ °è»ê(À§¿¡¼­ ºÎ¸° ¸¶¼ú°°Àº °Í)À» ´ë½ÅÇÒ ¼ö´Â ¾ø½À´Ï´Ù. ÇÏÁö¸¸ ÀÌ ÇÁ·Î±×·¥À» ÅëÇØ ¹«¾ùÀÌ °¡´ÉÇÏ°í ¾î¶² ŸÇùÀÌ °¡´ÉÇÑÁö¿¡ ´ëÇØ °¨À» ÀâÀ»¼ö´Â ÀÖÀ» °ÍÀÔ´Ï´Ù.