using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace vcsSCVFsurge { public partial class Form1 : Form { double g = 9.8; // 重力加速度 */ double pi = Math.PI; // 円周率 */ int N = 10; // 水槽断面検討ケース数 */ string title; // タイトル (入力値)*/ double Hg; // 総落差 (入力値)*/ double Q0; // 最大使用水量 (入力値)*/ double L; // 圧力水路延長 (入力値)*/ double c; // 圧力水路損失水頭係数(入力値)*/ double Cd; // 制水口流量係数 (入力値)*/ double zm; // 最大上昇水位 (規制値:入力値) */ double d0; // 圧力水路内径 (入力値)*/ double xc; // 選定したポート径 */ double yc; // 選定した立坑径 */ double zc; // 選定した立坑径の最高水位 */ double R_DFC2; // 動的安定性より定まる最小水槽径(記憶用) */ double[] DF = new double[20]; // 水槽内径(計算条件格納) */ double[] zmax = new double[20]; // 最大上昇水位(計算結果格納) */ double draw_xmin, draw_xmax, draw_dx; double draw_ymin, draw_ymax, draw_dy; //----------------------------------------------------------------------------*/ public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { pictureBox1.Visible = true; toolStripStatusLabel1.Text = "size and Png file name"; } //----------------------------------------------------------------------------*/ private void toolStripButton1_Click(object sender, EventArgs e) { main_part(); } //----------------------------------------------------------------------------*/ private void main_part() { System.IO.StreamReader sr; string fnameR = ""; //入力ファイル名*/ string fnameI = ""; //データファイル string fnameW_SC = ""; //出力ファイル名*/ string fnameW_VF = ""; //出力ファイル名*/ string fnameZ = ""; string fnameW = ""; string fnameF = ""; string dir = ""; string dat; string[] sbuf; char delim = ','; int iii, jjj, nnn; int[] bboxv = new int[4]; //入出力ファイル指定 openFileDialog1.InitialDirectory = System.IO.Directory.GetCurrentDirectory(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { fnameR = openFileDialog1.FileName; } sr = new System.IO.StreamReader(fnameR, System.Text.Encoding.Default); dat = sr.ReadLine(); sbuf = dat.Split(delim); nnn = int.Parse(sbuf[0]); for (iii = 1; iii <= nnn; iii++) { //データ入力 dat = sr.ReadLine(); sbuf = dat.Split(delim); fnameI = sbuf[0].Trim(); fnameW_SC = sbuf[1].Trim(); fnameW_VF = sbuf[2].Trim(); bboxv[0] = int.Parse(sbuf[3].Trim()); bboxv[1] = int.Parse(sbuf[4].Trim()); bboxv[2] = int.Parse(sbuf[5].Trim()); bboxv[3] = int.Parse(sbuf[6].Trim()); dir = System.IO.Path.GetDirectoryName(fnameR); fnameI = dir + "\\" + fnameI; INP_DAT(fnameI); for (jjj = 0; jjj <= 1; jjj++) { switch (jjj) { case 0: fnameW = dir + "\\" + "gpl_temp_SC.txt"; fnameF = dir + "\\" + fnameW_SC; CAL_SC(dir); PLOT_SC(fnameW, fnameW_SC); break; case 1: fnameW = dir + "\\" + "\\gpl_temp_VF.txt"; fnameF = dir + "\\" + fnameW_VF; CAL_VF(dir); PLOT_VF(fnameW, fnameW_VF); break; } //************************************************************** //gnuplot 起動+epsファイル作成 (fnameW: コマンド記述ファイル名) //************************************************************** GPL(fnameW); System.Threading.Thread.Sleep(1000); //1秒待つ //************************************************************** //eps の BoundingBox 修正 (fnameF: eps画像ファイル名) //************************************************************** fnameZ = fnameF.Replace("_eps_", "_eps_z_"); BBOX(fnameF, fnameZ, bboxv); //************************************************************** //ImageMagick による png 画像作成 (fnameZ: eps画像ファイル名) //************************************************************** IMCVT(fnameZ); //************************************************************** //ImageMagick による 白背景合成 (fnameZ: png画像ファイル名) //************************************************************** fnameZ = fnameZ.Replace("eps", "png"); IMCMP(fnameZ); System.Threading.Thread.Sleep(1000); //1秒待つ //************************************************************** //png 画像画面表示 (fnameZ: png画像ファイル名) //************************************************************** fnameZ = fnameZ.Replace("_png_z_", "_png_zw_"); VIEWPNG(fnameZ); } } sr.Close(); MessageBox.Show("計算完了", "完了通知"); } //-------------------------------------------------------------------------------------------- private void GPL(string fnameR) { //***************************************************** //gnuplot 起動+epsファイル作成 //***************************************************** System.Diagnostics.Process pr; System.IO.StreamWriter sw; string dir = ""; string fname = ""; string dat = ""; dir = System.IO.Path.GetDirectoryName(fnameR); System.IO.Directory.SetCurrentDirectory(dir); fname = System.IO.Path.GetFileName(fnameR); pr = new System.Diagnostics.Process(); pr.StartInfo.FileName = "gnuplot.exe"; pr.StartInfo.RedirectStandardInput = true; pr.StartInfo.RedirectStandardOutput = true; pr.StartInfo.UseShellExecute = false; pr.StartInfo.CreateNoWindow = true; pr.Start(); sw = pr.StandardInput; dat = string.Format("load \"{0:s}\"", fname); sw.WriteLine(dat); sw.Close(); pr.WaitForExit(); pr.Close(); } //-------------------------------------------------------------------------------------------- private void BBOX(string fnameR, string fnameW, int[] bboxv) { System.IO.StreamReader sr; System.IO.StreamWriter sw; string dat; int i; Console.WriteLine("BBOX:fnameR=" + fnameR); Console.WriteLine("BBOX:fnameW=" + fnameW); //データ入力 sr = new System.IO.StreamReader(fnameR, System.Text.Encoding.Default); sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); i = 0; while (!sr.EndOfStream) { i = i + 1; dat = sr.ReadLine(); if (i == 6) dat = string.Format("%%BoundingBox: {0:D} {1:D} {2:D} {3:D}", bboxv[0], bboxv[1], bboxv[2], bboxv[3]); sw.WriteLine(dat); } sr.Close(); sw.Close(); } //-------------------------------------------------------------------------------------------- private void IMCVT(string fnameF) { //***************************************************** //ImageMagick convert で png 画像作成 //***************************************************** string fnameP; System.Diagnostics.Process pr; System.IO.StreamWriter sw; string dat = ""; fnameP = fnameF.Replace("eps", "png"); pr = new System.Diagnostics.Process(); pr.StartInfo.FileName = "cmd.exe"; pr.StartInfo.RedirectStandardInput = true; pr.StartInfo.RedirectStandardOutput = true; pr.StartInfo.UseShellExecute = false; pr.StartInfo.CreateNoWindow = true; pr.Start(); sw = pr.StandardInput; dat = string.Format("convert -density 300 {0:s} {1:s}", fnameF, fnameP); sw.WriteLine(dat); sw.Close(); pr.WaitForExit(); pr.Close(); } //-------------------------------------------------------------------------------------------- private void IMCMP(string fnameZ) { //***************************************************** //ImageMagick convert で 白背景合成画像作成 //***************************************************** string fnameP; string fnameB; System.Diagnostics.Process pr; System.IO.StreamWriter sw; string dat = ""; Image img; int ww; int hh; img = Image.FromFile(fnameZ); ww = img.Width; hh = img.Height; img.Dispose(); fnameP = fnameZ.Replace("_z_", "_zw_"); fnameB = System.IO.Path.GetDirectoryName(fnameP) + "\\base.png"; pr = new System.Diagnostics.Process(); pr.StartInfo.FileName = "cmd.exe"; pr.StartInfo.RedirectStandardInput = true; pr.StartInfo.RedirectStandardOutput = true; pr.StartInfo.UseShellExecute = false; pr.StartInfo.CreateNoWindow = true; pr.Start(); sw = pr.StandardInput; dat = string.Format("convert -size {0:D}x{1:D} xc:\"#FFFFFF\" {2:s}", ww, hh, fnameB); sw.WriteLine(dat); dat = string.Format("convert {0:s} {1:s} -composite {2:s}", fnameB, fnameZ, fnameP); sw.WriteLine(dat); sw.Close(); pr.WaitForExit(); pr.Close(); Console.WriteLine(fnameB + " " + fnameZ + " " + fnameP); } //-------------------------------------------------------------------------------------------- private void VIEWPNG(string fnameZ) { //***************************************************** //png 画像画面表示 (50%縮尺) //***************************************************** Image img; Bitmap bmp; Graphics g; float ratio = 0.5f; int ww; int hh; int w_org; int h_org; img = Image.FromFile(fnameZ); w_org = img.Width; h_org = img.Height; ww = (int)(ratio * w_org); hh = (int)(ratio * h_org); pictureBox1.Size = new Size(ww, hh); bmp = new Bitmap(ww, hh); pictureBox1.Image = bmp; g = Graphics.FromImage(pictureBox1.Image); g.DrawImage(img, 0, 0, ww, hh); g.Dispose(); img.Dispose(); pictureBox1.Left = 0; pictureBox1.Top = toolStrip1.Height; this.ClientSize = new Size(pictureBox1.Width, pictureBox1.Height + toolStrip1.Height + statusStrip1.Height); toolStripStatusLabel1.Text = string.Format("{0:D} x {1:D} : {2:s}", w_org, h_org, fnameZ); } //-------------------------------------------------------------------------------------------- private void INP_DAT(string fnameR) { System.IO.StreamReader sr; string dat; string[] sbuf; char delim = ','; sr = new System.IO.StreamReader(fnameR, System.Text.Encoding.Default); dat = sr.ReadLine(); sbuf = dat.Split(delim); title = sbuf[0].Trim();//タイトル*/ dat = sr.ReadLine(); dat = sr.ReadLine(); sbuf = dat.Split(delim); Hg = double.Parse(sbuf[0]); // 総落差 */ Q0 = double.Parse(sbuf[1]); // 最大使用水量 */ L = double.Parse(sbuf[2]); // 圧力水路延長 */ d0 = double.Parse(sbuf[3]); // 圧力水路内径 */ c = double.Parse(sbuf[4]); // 圧力水路損失水頭係数 */ Cd = double.Parse(sbuf[5]); // 制水口流量係数 */ zm = double.Parse(sbuf[6]); // 最大上昇水位 */ xc = double.Parse(sbuf[7]); // 選定ポート径 */ yc = double.Parse(sbuf[8]); // 選定立坑径 */ sr.Close(); } //-------------------------------------------------------------------------------------------- private void CAL_SC(string dir) { System.IO.StreamWriter sw; string fnameW = ""; string dat; double fwa, v0; double h0; // 遮断前圧力水路損失水頭 h0=c*v0*v0 */ double k0; // 遮断時制水口抵抗 */ double DFC1, DFC2, DFC3; // 水槽内径(限界条件) */ double Fsa; // 水槽断面積 */ double Fpa; // 制水口断面積 */ double d2, d2min, d2max, d2d; // 制水口内径計算範囲指定 */ fnameW = dir + "\\temp_SC.prn"; // 安定条件 */ fwa = 0.25 * pi * d0 * d0; v0 = Q0 / fwa; h0 = c * v0 * v0; Fsa = L * fwa / c / 2.0 / g / (Hg - zm); DFC2 = Math.Sqrt(4.0 * Fsa / pi); R_DFC2 = DFC2; d2min = 0.1; d2max = (double)((int)(DFC2 + 1.0)); d2d = 0.1; sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); dat = "#d2 k0-h0 DFC1 DFC2 DFC3"; sw.WriteLine(dat); d2 = d2min - d2d; do { d2 = d2 + d2d; Fpa = 0.25 * pi * d2 * d2; k0 = 0.5 / g * Q0 * Q0 / Cd / Cd / Fpa / Fpa; if (k0 - h0 < 0) break; Fsa = h0 * L * fwa / c / (h0 + k0) / g / Hg; DFC1 = Math.Sqrt(4.0 * Fsa / pi); Fsa = h0 * L * fwa * fwa * fwa / 2.0 / g / c / c / k0 / Q0 / Q0; DFC3 = Math.Sqrt(4.0 * Fsa / pi); dat = string.Format("{0,6:F3} {1,10:E3} {2,6:F3} {3,6:F3} {4,6:F3}", d2, k0 - h0, DFC1, DFC2, DFC3); sw.WriteLine(dat); } while (d2 < d2max); sw.Close(); draw_xmin = 0.0; draw_xmax = (double)((int)(d2 - d2d)); draw_dx = 0.5; draw_ymin = 0.0; draw_ymax = (double)((int)((DFC2 + 1.0) / 2.0)) * 6.0; draw_dy = 2.0; } //-------------------------------------------------------------------------------------------- private void CAL_VF(string dir) { System.IO.StreamWriter sw; System.IO.StreamReader sr; string fnameW = ""; string fnameR = ""; int i, iflag; string dat; double fwa, v0, md; double Fsa; // 水槽断面積 */ double Fpa; // 制水口内径,断面積 */ double d1, d1min, d1d; // 水槽内径計算範囲指定 */ double d2, d2min, d2d; // 制水口内径計算範囲指定 */ double h0; // 遮断前圧力水路損失水頭 h0=c*v0*v0 */ double k0; // 遮断時制水口抵抗 */ fnameW = dir + "\\temp_VF.prn"; fnameR = fnameW; // Vogt-Forchheimer の式による最高上昇水位 */ fwa = 0.25 * pi * d0 * d0; v0 = Q0 / fwa; h0 = c * v0 * v0; d1min = (double)((int)(R_DFC2 + 1.0)); d1d = 1.0; for (i = 0; i <= N - 1; i++) { DF[i] = d1min + d1d * (double)i; } sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); dat = "#d2 k0-h0"; for (i = 0; i <= N - 1; i++) { dat = dat + " DF=" + DF[i].ToString("0"); } sw.WriteLine(dat); d2min = 0.1; d2d = 0.1; d2 = d2min - d2d; do { d2 = d2 + d2d; Fpa = 0.25 * pi * d2 * d2; k0 = 0.5 / g * Q0 * Q0 / Cd / Cd / Fpa / Fpa; if (k0 - h0 < 0) break; iflag = 1; // log関数の引数を監視するフラグ */ for (i = 0; i <= N - 1; i++) { d1 = DF[i]; Fsa = 0.25 * pi * d1 * d1; md = 2.0 * g * Fsa * (h0 + k0) / L / fwa / v0 / v0; zmax[i] = CAL_ZM(d1, k0, h0, md, ref iflag); } if (iflag == 1) { dat = d2.ToString("0.000"); dat = dat + " " + (k0 - h0).ToString("0.000"); for (i = 0; i <= N - 1; i++) { dat = dat + " " + zmax[i].ToString("0.000"); } sw.WriteLine(dat); } } while (d2 < draw_xmax); sw.Close(); iflag = 1; d1 = yc; d2 = xc; Fsa = 0.25 * pi * d1 * d1; Fpa = 0.25 * pi * d2 * d2; k0 = 0.5 / g * Q0 * Q0 / Cd / Cd / Fpa / Fpa; md = 2.0 * g * Fsa * (h0 + k0) / L / fwa / v0 / v0; zc = CAL_ZM(d1, k0, h0, md,ref iflag); string[] sbuf; char delim = ' '; sr = new System.IO.StreamReader(fnameR, System.Text.Encoding.Default); dat = sr.ReadLine(); while (!sr.EndOfStream) { dat = sr.ReadLine(); sbuf = dat.Split(delim); for (i = 0; i <= N - 1; i++) { zmax[i] = double.Parse(sbuf[i + 2]); } } sr.Close(); draw_ymin = 0.0; draw_ymax = (double)((int)(0.1 * zmax[0]) + 1) * 10.0; draw_dy = 10.0; draw_ymax = 100.0; } //-------------------------------------------------------------------------------------------- private double CAL_ZM(double d1, double k0, double h0, double md,ref int iflag) { double ff, df, z1 = 0.0, z2, z; double eps = 1e-10; // 収束計算0判定 */ if (md * k0 < 1.0) { z1 = -1.0 / md + 0.0001; do { z = z1; if (1.0 + md * z < 0) { iflag = 0; break; } ff = ((1.0 + md * z) - Math.Log(1.0 + md * z)) - ((1.0 + md * h0) - Math.Log(1.0 - md * k0)); df = md * (1.0 - 1.0 / (1.0 + md * z)); z2 = z1 - ff / df; z1 = z2; } while (eps < Math.Abs(ff)); } if (1.0 < md * k0) { z1 = 1.0 / md + 0.0001; do { z = z1; ff = ((md * z - 1.0) + Math.Log(md * z - 1.0)) - (Math.Log(md * k0 - 1.0) - (md * h0 + 1.0)); if (md * z - 1.0 < 0) { iflag = 0; break; } df = md * (1.0 + 1.0 / (md * z - 1.0)); z2 = z1 - ff / df; z1 = z2; } while (eps < Math.Abs(ff)); } return Math.Abs(z1); } //-------------------------------------------------------------------------------------------- private void PLOT_SC(string fnameW, string fnameW_SC) { System.IO.StreamWriter sw; string dat = ""; double xx, yy; //***************************/ //gnuplot制御用ファイル作成*/ //***************************/ sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); dat = "set terminal postscript eps enhanced font \"Helvetica\" 16"; sw.WriteLine(dat); dat = string.Format("set output \"{0:s}\"", fnameW_SC); sw.WriteLine(dat); dat = "set size ratio 1.0"; sw.WriteLine(dat); dat = "set key left top"; if (0 < title.IndexOf("Input")) dat = "set key right top"; sw.WriteLine(dat); dat = "set key width -2"; sw.WriteLine(dat); dat = "set key spacing 1.2"; sw.WriteLine(dat); dat = "set key box"; sw.WriteLine(dat); dat = "set xlabel \"Diameter of the port (m)\""; sw.WriteLine(dat); dat = "set ylabel \"Diameter of the surge tank (m)\""; sw.WriteLine(dat); dat = string.Format("set xrange [{0:F3}:{1:F3}]", draw_xmin, draw_xmax); sw.WriteLine(dat); dat = string.Format("set xtics {0:F3}", draw_dx); sw.WriteLine(dat); dat = string.Format("set format x \"{0:s}\"", "%.1f"); sw.WriteLine(dat); dat = string.Format("set yrange [{0:F3}:{1:F3}]", draw_ymin, draw_ymax); sw.WriteLine(dat); dat = string.Format("set ytics {0:F3}", draw_dy); sw.WriteLine(dat); dat = string.Format("set format y \"{0:s}\"", "%.0f"); sw.WriteLine(dat); dat = "set tmargin 2"; sw.WriteLine(dat); dat = string.Format("set label \" {0:s}\" at graph 0.0,graph 1.03 left", title); sw.WriteLine(dat); dat = "set rmargin 8"; sw.WriteLine(dat); //2本の直線(nohead矢印)による選択点の表示*/ dat = "set style arrow 2 size graph 0.05,20 filled nohead linewidth 1 linetype 1"; sw.WriteLine(dat); dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", draw_xmin, yc, xc, yc); sw.WriteLine(dat); dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", xc, draw_ymin, xc, yc); sw.WriteLine(dat); xx = (xc - draw_xmin) / (draw_xmax - draw_xmin) + 0.02; yy = 0.0; dat = string.Format("set label \" {0:F1}m\" at graph {1:F3},graph {2:F3} left rotate by 90", xc, xx, yy); sw.WriteLine(dat); xx = 0.0; yy = (yc - draw_ymin) / (draw_ymax - draw_ymin) + 0.02; dat = string.Format("set label \" {0:F1}m\" at graph {1:F3},graph {2:F3} left", yc, xx, yy); sw.WriteLine(dat); //動的安定性を満足する水槽径最小値の表示*/ xx = 0.0; yy = (R_DFC2 - draw_ymin) / (draw_ymax - draw_ymin) + 0.02; dat = string.Format("set label \" {0:F3}m (Target {1:s}={2:F1}m)\" at graph {3:F3},graph {4:F3} left", R_DFC2,"Z{/=10 m}", zm, xx, yy); sw.WriteLine(dat); //軸作成*/ dat = "set grid xtics ytics mxtics mytics"; sw.WriteLine(dat); dat = "plot \"temp_SC.prn\" using 1:3 with lines linewidth 3 linetype 4 title \"D{/=10 req} > D{/=10 1}\", \\"; sw.WriteLine(dat); dat = " \"temp_SC.prn\" using 1:4 with lines linewidth 3 linetype 1 title \"D{/=10 req} > D{/=10 2}\", \\"; sw.WriteLine(dat); dat = " \"temp_SC.prn\" using 1:5 with lines linewidth 3 linetype 2 title \"D{/=10 req} < D{/=10 3}\", \\"; sw.WriteLine(dat); dat = " \"-\" with points pointsize 2 pointtype 7 title \"Selected point\""; sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", xc, yc); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); sw.Close(); } //-------------------------------------------------------------------------------------------- private void PLOT_VF(string fnameW, string fnameW_VF) { System.IO.StreamWriter sw; string dat = ""; int i; double xx, yy; //***************************/ //gnuplot制御用ファイル作成*/ //***************************/ sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); dat = "set terminal postscript eps enhanced font \"Helvetica\" 16"; sw.WriteLine(dat); dat = string.Format("set output \"{0:s}\"", fnameW_VF); sw.WriteLine(dat); dat = "set size ratio 1.0"; sw.WriteLine(dat); dat = "set key left top"; if (0 < title.IndexOf("Input")) dat = "set key right top"; sw.WriteLine(dat); dat = "set key width -4"; sw.WriteLine(dat); dat = "set key spacing 1.2"; sw.WriteLine(dat); dat = "set key box"; sw.WriteLine(dat); dat = "set xlabel \"Diameter of the port (m)\""; sw.WriteLine(dat); dat = "set ylabel \"Maximum WL Z{/=10 max} (m) or Difference of pressure |Z'{/=10 rm}| (m)\""; sw.WriteLine(dat); dat = string.Format("set xrange [{0:F3}:{1:F3}]", draw_xmin, draw_xmax); sw.WriteLine(dat); dat = string.Format("set xtics {0:F3}", draw_dx); sw.WriteLine(dat); dat = string.Format("set format x \"{0:s}\"", "%.1f"); sw.WriteLine(dat); dat = string.Format("set yrange [{0:F3}:{1:F3}]", draw_ymin, draw_ymax); sw.WriteLine(dat); dat = string.Format("set ytics {0:F3}", draw_dy); sw.WriteLine(dat); dat = string.Format("set format y \"{0:s}\"", "%.0f"); sw.WriteLine(dat); dat = "set tmargin 2"; sw.WriteLine(dat); dat = string.Format("set label \" {0:s}\" at graph 0.0,graph 1.03 left", title); sw.WriteLine(dat); dat = "set rmargin 8"; sw.WriteLine(dat); //直線(nohead矢印)による水位上昇限界値の表示*/ dat = "set style arrow 2 size graph 0.05,20 filled nohead linewidth 1 linetype 1"; sw.WriteLine(dat); dat = string.Format("set arrow as 2 from {0:f3},{1:F3} to {2:F3},{3:F3}", draw_xmin, zm, draw_xmax, zm); sw.WriteLine(dat); xx = 0.0; yy = (zm - draw_ymin) / (draw_ymax - draw_ymin) + 0.02; dat = string.Format("set label \" Target {0:s}={1:F1}m\" at graph {2:F3},graph {3:F3} left", "Z{/=10 m}", zm, xx, yy); sw.WriteLine(dat); //最高上昇水位内径凡例*/ for (i = 0; i <= N - 1; i++) { dat = string.Format("set label \" D={0:F0}m\" at first {1:F3},first {2:F3} left", DF[i], draw_xmax, zmax[i]); sw.WriteLine(dat); } //軸作成*/ dat = "set grid xtics ytics mxtics mytics"; sw.WriteLine(dat); dat = "plot \\"; sw.WriteLine(dat); for (i = 0; i <= N - 1; i++) { dat = string.Format("\"temp_VF.prn\" using 1:{0:D} with line linewidth 3 linetype 1 notitle, \\", 3 + i); sw.WriteLine(dat); } dat = "\"temp_VF.prn\" using 1:2 with linespoints linewidth 3 pointtype 6 title \"|Z'{/=10 rm}| = k{/=10 0} - h{/=10 0}\", \\"; sw.WriteLine(dat); dat = "\"-\" with points pointsize 2 pointtype 7 title \"Selected point\""; sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", xc, zc); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); sw.Close(); } //-------------------------------------------------------------------------------------------- } }