4 Feeding Origin 2 is software that supports calculation of nutrient requirement of livestock
5 and feed design based on Japanese feeding standard.
6 Copyright (C) 2017, Syuichiro Fukagawa.
8 This program is free software; you can redistribute it and/or modify it under the terms of
9 the GNU General Public License as published by the Free Software Foundation; either version 3
10 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along with this program.
15 If not, see <http://www.gnu.org/licenses/>.
18 Feeding Origin 2は、日本飼養標準に基づいた家畜の養分要求量の計算および飼料設計を支援するソフ
20 Copyright (C) 2017, 深川修一郎.
22 このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって
23 発行されたGNU一般公衆利用許諾書(バージョン3か、それ以降のバージョンのうちどれか)が定める
24 条件の下で再頒布または改変することができます。
25 このプログラムは有用であることを願って頒布されますが、*全くの無保証* です。商業可能性の保証
26 や特定目的への適合性は、言外に示されたものも含め、全く存在しません。詳しくはGNU一般公衆利用
28 あなたはこのプログラムと共に、GNU一般公衆利用許諾書のコピーを一部 受け取っているはずです。
29 もし受け取っていなければ、<http://www.gnu.org/licenses/> をご覧ください。
31 *本日本語訳は、FSFより2007年6月29日に発行されたGNU GPL v3の原文から、八田真行氏が翻訳した
32 ものを基にしています。 < https://mag.osdn.jp/07/09/02/130237 >
40 Classes, SysUtils, FileUtil, TAGraph, TASeries, Forms, Controls, Graphics,
41 Dialogs, ExtCtrls, math, StrUtils, StdCtrls, Grids, ComCtrls, u_feedingcalc2,
42 u_CommonModule, u_Marker, TACustomSeries, u_regWorkData, u_splash;
45 astG = Array[0..72065] of reGROW ;
46 TreGrowOrign = array[0..72577] of reGROW;
56 RegressionCurveOriginAfter: TLineSeries;
57 RegressionCurveOriginBefore: TLineSeries;
65 RegressionCurveJFS: TLineSeries;
71 Origin2BeforeWeaning: TLineSeries;
72 Origin2AfterWeaning: TLineSeries;
73 JapaneseFeedingStandard: TLineSeries;
82 LabeledEdit1: TLabeledEdit;
83 LabeledEdit2: TLabeledEdit;
84 PageControl1: TPageControl;
87 StringGrid1: TStringGrid;
88 StringGrid2: TStringGrid;
92 procedure Button1Click(Sender: TObject);
93 procedure Button2Click(Sender: TObject);
94 procedure Button3Click(Sender: TObject);
95 procedure Button4Click(Sender: TObject);
96 procedure Button5Click(Sender: TObject);
97 procedure CheckBox1Change(Sender: TObject);
98 procedure CheckBox2Change(Sender: TObject);
99 procedure CheckBox3Change(Sender: TObject);
100 procedure CheckBox4Change(Sender: TObject);
101 procedure ComboBox1Change(Sender: TObject);
102 procedure ComboBox2Change(Sender: TObject);
103 procedure ComboBox3Change(Sender: TObject);
104 procedure Check_of_Weight(Sender: TObject);
105 procedure FormShow(Sender: TObject);
106 procedure LabeledEdit1KeyDown(Sender: TObject; var Key: Word;
108 procedure LabeledEdit2KeyDown(Sender: TObject; var Key: Word;
110 procedure GeneralKeyPress(Sender: TObject; var Key: char);
112 { private declarations }
115 gOrign : TreGrowOrign;
117 giRow4Orign : Integer;
119 procedure ReadData();
120 procedure Spread_JFS_Data();
121 procedure Spread_Origin2_Data();
122 procedure DispHeader_1();
123 procedure DispHeader_2();
124 procedure SelectData();
125 procedure Class_JFS();
126 procedure Class_Origin2();
127 procedure GraphOutPut();
128 procedure GraphDraw4JFS();
129 procedure GraphDraw4Origin2(var iKbn : Integer);
130 function NichZotaijuAnbaichi(var dWt : Double) : Double;
136 giSNo, giRow, giOrgSrc : Integer;
142 procedure TForm1.Check_of_Weight(Sender: TObject);
148 TE := Sender as TLabeledEdit ;
149 iEN := StrToInt(RightStr(TE.Name, 1));
150 dWt := StrToFloat(TE.Text);
151 if (dWt < 40) or (dWt > 707) then
153 ShowMessage('体重は40kg以上707kg以下を入力します。');
161 dWrk1 := StrToFloat(LabeledEdit2.Text);
164 ShowMessage('体重(最大)より小さい値を入力してください。');
171 dWrk1 := StrToFloat(LabeledEdit1.Text);
174 ShowMessage('体重(最小)より大きい値を入力してください。');
185 procedure TForm1.FormShow(Sender: TObject);
187 u_splash.fSplash.Show ;
189 if not FileExists('IkuseiData.dat') then
191 ShowMessage('データ・ファイルの「IkuseiData.dat」が見つかりません。'+#$0D+#$0A+'プログラムを終了します。');
195 Application.ProcessMessages;
197 Application.ProcessMessages;
199 Application.ProcessMessages;
200 Spread_Origin2_Data();
201 Application.ProcessMessages;
203 Form1.Cursor:=crDefault;
204 Form1.Panel1.Cursor:=crDefault;
205 Form1.PageControl1.Cursor:=crDefault;
206 Form1.TabSheet3.Cursor:=crDefault;
208 Form1.Panel3.Cursor:=crDefault;
209 Form1.Chart1.Cursor:=crDefault;
211 Form1.Panel1.Enabled:=true;
212 Form1.TabSheet3.Enabled:=true ;
214 Application.ProcessMessages;
219 u_splash.fSplash.Close;
222 procedure TForm1.LabeledEdit1KeyDown(Sender: TObject; var Key: Word;
225 ComEditKeyDown(Form1, Sender, Key, Shift);
228 procedure TForm1.GeneralKeyPress(Sender: TObject; var Key: char);
230 ComEditKeyPress(Form1, Sender, Key);
233 procedure TForm1.LabeledEdit2KeyDown(Sender: TObject; var Key: Word;
236 ComEditKeyDown(Form1, Sender, Key, Shift);
239 procedure TForm1.Button2Click(Sender: TObject);
245 procedure TForm1.Button3Click(Sender: TObject);
247 m, n, i, iK : Integer;
248 X, Yxm, Yxn, Yx_1, YxYx_1, Yx2 : Double;
249 SigmaYxm, SigmaYxn, SigmaYx_1, SigmaYxYx_1, SigmaYx2 : Double;
251 Cx, CxYx, C2x : Double;
252 SigmaCx, SigmaCxYx, SigmaC2x : Double;
254 dMeanY, SgmaYiFi2, SgmaYiMY2, dR2 : Double;
257 if giRow4JFS > 0 then
261 iK := ComboBox2.ItemIndex + 7;
275 Yxm := StrToFloat(StringGrid1.Cells[iK, i]);
277 Yx_1 := StrToFloat(StringGrid1.Cells[iK, i+1]);
279 YxYx_1 := Yxm * Yx_1;
280 SigmaYxYx_1 += YxYx_1;
281 Yx2 := Power(Yxm, 2);
284 c := (n*SigmaYxYx_1-SigmaYxm*SigmaYx_1)/(n*SigmaYx2-Power(SigmaYxm,2));
287 X := StrToFloat(StringGrid1.Cells[1, i]);
288 Yxn := StrToFloat(StringGrid1.Cells[iK, i]);
298 dMeanY := SigmaYxn / n;
300 b := (n*SigmaCxYx-SigmaCx*SigmaYxn)/(n*SigmaC2x-Power(SigmaCx,2));
301 a := (SigmaYxn/n)-b*(SigmaCx/n);
303 sMb := ' - ' + FloatToStrF(abs(b), ffGeneral, 8, 4 ) + ' * '
305 sMb := ' + ' + FloatToStrF(b, ffGeneral, 8, 4 ) + ' * ';
306 Label7.Caption := 'Y= '+FloatToStrF(a, ffGeneral, 8, 4 )+sMb+FloatToStrF(c, ffGeneral, 8, 4 )+' ^ X ';
308 RegressionCurveJFS.Clear;
311 dWt := StrToFloat(StringGrid1.Cells[1, i]);
312 dRg := a + b * Power(c, dWt);
313 RegressionCurveJFS.AddXY(dWt, dRg);
314 Yxn := StrToFloat(StringGrid1.Cells[iK, i]);
315 SgmaYiFi2 += Power((Yxn - dRg), 2);
316 SgmaYiMY2 += Power((Yxn - dMeanY), 2);
318 dR2 := 1.0 - ( SgmaYiFi2 / SgmaYiMY2 );
319 Label7.Caption := Label7.Caption + ' ; R2= ' + FloatToStr(dR2);
323 procedure TForm1.Button4Click(Sender: TObject);
325 NofArticles : Integer;
326 n, i, j, iK : Integer;
327 X, Yxm, Yxn, Yx_1, YxYx_1, Yx2 : Double;
328 SigmaYxm, SigmaYxn, SigmaYx_1, SigmaYxYx_1, SigmaYx2 : Double;
330 Cx, CxYx, C2x : Double;
331 SigmaCx, SigmaCxYx, SigmaC2x : Double;
333 dMeanY, SgmaYiFi2, SgmaYiMY2, dR2 : Double;
336 if giRow4JFS > 0 then
339 iK := ComboBox2.ItemIndex + 7;
356 RegWorkForm.StringGrid3.Cells[ j, i] := '';
361 if Trim(StringGrid2.Cells[5, i]) = '離乳前' then
364 RegWorkForm.StringGrid3.Cells[ 0, NofArticles] := StringGrid2.Cells[ 0, i] ;
365 RegWorkForm.StringGrid3.Cells[ 1, NofArticles] := StringGrid2.Cells[ 1, i] ;
366 RegWorkForm.StringGrid3.Cells[ 2, NofArticles] := StringGrid2.Cells[ 2, i] ;
367 RegWorkForm.StringGrid3.Cells[ 3, NofArticles] := StringGrid2.Cells[ 3, i] ;
368 RegWorkForm.StringGrid3.Cells[ 4, NofArticles] := StringGrid2.Cells[ 4, i] ;
369 RegWorkForm.StringGrid3.Cells[ 5, NofArticles] := StringGrid2.Cells[ 5, i] ;
370 RegWorkForm.StringGrid3.Cells[ 6, NofArticles] := StringGrid2.Cells[ 6, i] ;
371 RegWorkForm.StringGrid3.Cells[ 7, NofArticles] := StringGrid2.Cells[ 7, i] ;
372 RegWorkForm.StringGrid3.Cells[ 8, NofArticles] := StringGrid2.Cells[ 8, i] ;
373 RegWorkForm.StringGrid3.Cells[ 9, NofArticles] := StringGrid2.Cells[ 9, i] ;
374 RegWorkForm.StringGrid3.Cells[10, NofArticles] := StringGrid2.Cells[10, i] ;
375 RegWorkForm.StringGrid3.Cells[11, NofArticles] := StringGrid2.Cells[11, i] ;
376 RegWorkForm.StringGrid3.Cells[12, NofArticles] := StringGrid2.Cells[12, i] ;
377 RegWorkForm.StringGrid3.Cells[13, NofArticles] := StringGrid2.Cells[13, i] ;
378 RegWorkForm.StringGrid3.Cells[14, NofArticles] := StringGrid2.Cells[14, i] ;
379 RegWorkForm.StringGrid3.Cells[15, NofArticles] := StringGrid2.Cells[15, i] ;
380 RegWorkForm.StringGrid3.Cells[16, NofArticles] := StringGrid2.Cells[16, i] ;
381 RegWorkForm.StringGrid3.Cells[17, NofArticles] := StringGrid2.Cells[17, i] ;
384 if NofArticles = 0 then exit;
385 for i:=1 to (NofArticles-1) do
387 Yxm := StrToFloat(RegWorkForm.StringGrid3.Cells[iK, i]);
389 Yx_1 := StrToFloat(RegWorkForm.StringGrid3.Cells[iK, i+1]);
391 YxYx_1 := Yxm * Yx_1;
392 SigmaYxYx_1 += YxYx_1;
393 Yx2 := Power(Yxm, 2);
396 c := (NofArticles*SigmaYxYx_1-SigmaYxm*SigmaYx_1)/(NofArticles*SigmaYx2-Power(SigmaYxm,2));
397 for i:=1 to NofArticles do
399 X := StrToFloat(RegWorkForm.StringGrid3.Cells[1, i]);
400 Yxn := StrToFloat(RegWorkForm.StringGrid3.Cells[iK, i]);
410 dMeanY := SigmaYxn / NofArticles;
412 b := (NofArticles*SigmaCxYx-SigmaCx*SigmaYxn)/(NofArticles*SigmaC2x-Power(SigmaCx,2));
413 a := (SigmaYxn/NofArticles)-b*(SigmaCx/NofArticles);
415 sMb := ' - ' + FloatToStrF(abs(b), ffGeneral, 8, 4 ) + ' * '
417 sMb := ' + ' + FloatToStrF(b, ffGeneral, 8, 4 ) + ' * ';
418 Label8.Caption := 'Y= '+FloatToStrF(a, ffGeneral, 8, 4 )+sMb+FloatToStrF(c, ffGeneral, 8, 4 )+' ^ X ';
419 RegressionCurveOriginBefore.Clear;
420 for i:=1 to NofArticles do
422 dWt := StrToFloat(RegWorkForm.StringGrid3.Cells[1, i]);
423 dRg := a + b * Power(c, dWt);
424 RegressionCurveOriginBefore.AddXY(dWt, dRg);
425 Yxn := StrToFloat(StringGrid1.Cells[iK, i]);
426 SgmaYiFi2 += Power((Yxn - dRg), 2);
427 SgmaYiMY2 += Power((Yxn - dMeanY), 2);
429 dR2 := 1.0 - ( SgmaYiFi2 / SgmaYiMY2 );
430 Label8.Caption := Label8.Caption + ' ; R2= ' + FloatToStr(dR2);
434 procedure TForm1.Button5Click(Sender: TObject);
436 NofArticles : Integer;
437 n, i, j, iK : Integer;
438 X, Yxm, Yxn, Yx_1, YxYx_1, Yx2 : Double;
439 SigmaYxm, SigmaYxn, SigmaYx_1, SigmaYxYx_1, SigmaYx2 : Double;
441 Cx, CxYx, C2x : Double;
442 SigmaCx, SigmaCxYx, SigmaC2x : Double;
444 dMeanY, SgmaYiFi2, SgmaYiMY2, dR2 : Double;
447 if giRow4JFS > 0 then
450 iK := ComboBox2.ItemIndex + 7;
467 RegWorkForm.StringGrid3.Cells[ j, i] := '';
472 if Trim(StringGrid2.Cells[5, i]) = '離乳後' then
475 RegWorkForm.StringGrid3.Cells[ 0, NofArticles] := StringGrid2.Cells[ 0, i] ;
476 RegWorkForm.StringGrid3.Cells[ 1, NofArticles] := StringGrid2.Cells[ 1, i] ;
477 RegWorkForm.StringGrid3.Cells[ 2, NofArticles] := StringGrid2.Cells[ 2, i] ;
478 RegWorkForm.StringGrid3.Cells[ 3, NofArticles] := StringGrid2.Cells[ 3, i] ;
479 RegWorkForm.StringGrid3.Cells[ 4, NofArticles] := StringGrid2.Cells[ 4, i] ;
480 RegWorkForm.StringGrid3.Cells[ 5, NofArticles] := StringGrid2.Cells[ 5, i] ;
481 RegWorkForm.StringGrid3.Cells[ 6, NofArticles] := StringGrid2.Cells[ 6, i] ;
482 RegWorkForm.StringGrid3.Cells[ 7, NofArticles] := StringGrid2.Cells[19, i] ;
483 RegWorkForm.StringGrid3.Cells[ 8, NofArticles] := StringGrid2.Cells[20, i] ;
484 RegWorkForm.StringGrid3.Cells[ 9, NofArticles] := StringGrid2.Cells[21, i] ;
485 RegWorkForm.StringGrid3.Cells[10, NofArticles] := StringGrid2.Cells[22, i] ;
486 RegWorkForm.StringGrid3.Cells[11, NofArticles] := StringGrid2.Cells[23, i] ;
487 RegWorkForm.StringGrid3.Cells[12, NofArticles] := StringGrid2.Cells[24, i] ;
488 RegWorkForm.StringGrid3.Cells[13, NofArticles] := StringGrid2.Cells[25, i] ;
489 RegWorkForm.StringGrid3.Cells[14, NofArticles] := StringGrid2.Cells[26, i] ;
490 RegWorkForm.StringGrid3.Cells[15, NofArticles] := StringGrid2.Cells[27, i] ;
491 RegWorkForm.StringGrid3.Cells[16, NofArticles] := StringGrid2.Cells[28, i] ;
492 RegWorkForm.StringGrid3.Cells[17, NofArticles] := StringGrid2.Cells[29, i] ;
495 for i:=1 to (NofArticles-1) do
497 Yxm := StrToFloat(RegWorkForm.StringGrid3.Cells[iK, i]);
499 Yx_1 := StrToFloat(RegWorkForm.StringGrid3.Cells[iK, i+1]);
501 YxYx_1 := Yxm * Yx_1;
502 SigmaYxYx_1 += YxYx_1;
503 Yx2 := Power(Yxm, 2);
506 c := (NofArticles*SigmaYxYx_1-SigmaYxm*SigmaYx_1)/(NofArticles*SigmaYx2-Power(SigmaYxm,2));
507 for i:=1 to NofArticles do
509 X := StrToFloat(RegWorkForm.StringGrid3.Cells[1, i]);
510 Yxn := StrToFloat(RegWorkForm.StringGrid3.Cells[iK, i]);
520 dMeanY := SigmaYxn / NofArticles;
522 b := (NofArticles*SigmaCxYx-SigmaCx*SigmaYxn)/(NofArticles*SigmaC2x-Power(SigmaCx,2));
523 a := (SigmaYxn/NofArticles)-b*(SigmaCx/NofArticles);
525 sMb := ' - ' + FloatToStrF(abs(b), ffGeneral, 8, 4 ) + ' * '
527 sMb := ' + ' + FloatToStrF(b, ffGeneral, 8, 4 ) + ' * ';
528 Label9.Caption := 'Y= '+FloatToStrF(a, ffGeneral, 8, 4 )+sMb+FloatToStrF(c, ffGeneral, 8, 4 )+' ^ X ';
529 RegressionCurveOriginAfter.Clear;
530 for i:=1 to NofArticles do
532 dWt := StrToFloat(RegWorkForm.StringGrid3.Cells[1, i]);
533 dRg := a + b * Power(c, dWt);
534 RegressionCurveOriginAfter.AddXY(dWt, dRg);
535 Yxn := StrToFloat(StringGrid1.Cells[iK, i]);
536 SgmaYiFi2 += Power((Yxn - dRg), 2);
537 SgmaYiMY2 += Power((Yxn - dMeanY), 2);
539 dR2 := 1.0 - ( SgmaYiFi2 / SgmaYiMY2 );
540 Label9.Caption := Label9.Caption + ' ; R2= ' + FloatToStr(dR2);
544 procedure TForm1.Button1Click(Sender: TObject);
549 procedure TForm1.CheckBox1Change(Sender: TObject);
555 procedure TForm1.CheckBox2Change(Sender: TObject);
561 procedure TForm1.CheckBox3Change(Sender: TObject);
567 procedure TForm1.CheckBox4Change(Sender: TObject);
573 procedure TForm1.ComboBox1Change(Sender: TObject);
579 procedure TForm1.ComboBox2Change(Sender: TObject);
585 procedure TForm1.ComboBox3Change(Sender: TObject);
591 procedure TForm1.Spread_Origin2_Data();
593 i, iSN, iPN : Integer ;
594 dWeight, dGain : Double;
595 sLowest, sSeason : String;
604 dWeight := gstG[i].dWt1;
605 dGain := gstG[i].dInWt1;
606 sLowest := gstG[i].cLVCP;
607 sSeason := gstG[i].cKset;
609 if (dWeight <= 66.00) then
611 StringGrid2.Cells[0, iPN] := IntToStr(iPN);
612 StringGrid2.Cells[1, iPN] := FloatToStr(dWeight);
613 StringGrid2.Cells[2, iPN] := FloatToStr(dGain);
614 StringGrid2.Cells[3, iPN] := sLowest;
615 StringGrid2.Cells[4, iPN] := sSeason;
616 StringGrid2.Cells[5, iPN] := '離乳前';
617 gOrign[iPN].dWt1 := dWeight;
618 gOrign[iPN].dInWt1 := dGain;
619 gOrign[iPN].cLVCP := sLowest;
620 gOrign[iPN].cKset := sSeason;
621 gOrign[iPN].cWean := '離乳前';
623 gOrign[iPN].Nutrient := GrowingCow_A( stG );
624 StringGrid2.Cells[ 6, iPN] := FloatToStr(gOrign[iPN].Nutrient.dFCM);
625 StringGrid2.Cells[ 7, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDMI);
626 StringGrid2.Cells[ 8, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCP);
627 StringGrid2.Cells[ 9, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDCP);
628 StringGrid2.Cells[10, iPN] := FloatToStr(gOrign[iPN].Nutrient.dTDN);
629 StringGrid2.Cells[11, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDE);
630 StringGrid2.Cells[12, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEC);
631 StringGrid2.Cells[13, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEJ);
632 StringGrid2.Cells[14, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCa);
633 StringGrid2.Cells[15, iPN] := FloatToStr(gOrign[iPN].Nutrient.dP);
634 StringGrid2.Cells[16, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVA);
635 StringGrid2.Cells[17, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVD);
637 else if (dWeight > 66.00) and (dWeight < 75.00) then
639 StringGrid2.Cells[0, iPN] := IntToStr(iPN);
640 StringGrid2.Cells[1, iPN] := FloatToStr(dWeight);
641 StringGrid2.Cells[2, iPN] := FloatToStr(dGain);
642 StringGrid2.Cells[3, iPN] := sLowest;
643 StringGrid2.Cells[4, iPN] := sSeason;
644 StringGrid2.Cells[5, iPN] := '離乳前';
645 gOrign[iPN].dWt1 := dWeight;
646 gOrign[iPN].dInWt1 := dGain;
647 gOrign[iPN].cLVCP := sLowest;
648 gOrign[iPN].cKset := sSeason;
649 gOrign[iPN].cWean := '離乳前';
651 gOrign[iPN].Nutrient := GrowingCow_A( stG );
652 StringGrid2.Cells[ 6, iPN] := FloatToStr(gOrign[iPN].Nutrient.dFCM);
653 StringGrid2.Cells[ 7, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDMI);
654 StringGrid2.Cells[ 8, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCP);
655 StringGrid2.Cells[ 9, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDCP);
656 StringGrid2.Cells[10, iPN] := FloatToStr(gOrign[iPN].Nutrient.dTDN);
657 StringGrid2.Cells[11, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDE);
658 StringGrid2.Cells[12, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEC);
659 StringGrid2.Cells[13, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEJ);
660 StringGrid2.Cells[14, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCa);
661 StringGrid2.Cells[15, iPN] := FloatToStr(gOrign[iPN].Nutrient.dP);
662 StringGrid2.Cells[16, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVA);
663 StringGrid2.Cells[17, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVD);
665 StringGrid2.Cells[0, iPN] := IntToStr(iPN);
666 StringGrid2.Cells[1, iPN] := FloatToStr(dWeight);
667 StringGrid2.Cells[2, iPN] := FloatToStr(dGain);
668 StringGrid2.Cells[3, iPN] := sLowest;
669 StringGrid2.Cells[4, iPN] := sSeason;
670 StringGrid2.Cells[5, iPN] := '離乳後';
671 gOrign[iPN].dWt1 := dWeight;
672 gOrign[iPN].dInWt1 := dGain;
673 gOrign[iPN].cLVCP := sLowest;
674 gOrign[iPN].cKset := sSeason;
675 gOrign[iPN].cWean := '離乳後';
677 gOrign[iPN].Nutrient := GrowingCow_A( stG );
678 StringGrid2.Cells[ 6, iPN] := FloatToStr(gOrign[iPN].Nutrient.dFCM);
679 StringGrid2.Cells[ 7, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDMI);
680 StringGrid2.Cells[ 8, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCP);
681 StringGrid2.Cells[ 9, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDCP);
682 StringGrid2.Cells[10, iPN] := FloatToStr(gOrign[iPN].Nutrient.dTDN);
683 StringGrid2.Cells[11, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDE);
684 StringGrid2.Cells[12, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEC);
685 StringGrid2.Cells[13, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEJ);
686 StringGrid2.Cells[14, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCa);
687 StringGrid2.Cells[15, iPN] := FloatToStr(gOrign[iPN].Nutrient.dP);
688 StringGrid2.Cells[16, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVA);
689 StringGrid2.Cells[17, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVD);
693 StringGrid2.Cells[0, iPN] := IntToStr(iPN);
694 StringGrid2.Cells[1, iPN] := FloatToStr(dWeight);
695 StringGrid2.Cells[2, iPN] := FloatToStr(dGain);
696 StringGrid2.Cells[3, iPN] := sLowest;
697 StringGrid2.Cells[4, iPN] := sSeason;
698 StringGrid2.Cells[5, iPN] := '離乳後';
699 gOrign[iPN].dWt1 := dWeight;
700 gOrign[iPN].dInWt1 := dGain;
701 gOrign[iPN].cLVCP := sLowest;
702 gOrign[iPN].cKset := sSeason;
703 gOrign[iPN].cWean := '離乳後';
705 gOrign[iPN].Nutrient := GrowingCow_A( stG );
706 StringGrid2.Cells[ 6, iPN] := FloatToStr(gOrign[iPN].Nutrient.dFCM);
707 StringGrid2.Cells[ 7, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDMI);
708 StringGrid2.Cells[ 8, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCP);
709 StringGrid2.Cells[ 9, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDCP);
710 StringGrid2.Cells[10, iPN] := FloatToStr(gOrign[iPN].Nutrient.dTDN);
711 StringGrid2.Cells[11, iPN] := FloatToStr(gOrign[iPN].Nutrient.dDE);
712 StringGrid2.Cells[12, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEC);
713 StringGrid2.Cells[13, iPN] := FloatToStr(gOrign[iPN].Nutrient.dMEJ);
714 StringGrid2.Cells[14, iPN] := FloatToStr(gOrign[iPN].Nutrient.dCa);
715 StringGrid2.Cells[15, iPN] := FloatToStr(gOrign[iPN].Nutrient.dP);
716 StringGrid2.Cells[16, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVA);
717 StringGrid2.Cells[17, iPN] := FloatToStr(gOrign[iPN].Nutrient.dVD);
723 procedure TForm1.ReadData();
726 u_String, sWrk, sDat : string;
727 iRow, iNo, iP, iL, iT : Integer ;
731 AssignFile(inf,'IkuseiData.dat');
733 if IOResult <> 0 then
735 ShowMessage('ファイルアクセスエラー');
739 while not Eof( inf ) do
741 ReadLn( inf, u_String );
746 iL := Length(u_String);
748 iT := PosEx( ' ', u_String, iP ) ;
749 sWrk := MidStr(u_String, iP , (iT-iP) );
751 sDat := UTF8Encode( sWrk ) ;
753 1 : gstG[iRow].dWt1 := StrToFloat( sDat ) ;
754 2 : gstG[iRow].dInWt1 := StrToFloat( sDat ) ;
755 3 : gstG[iRow].cLVCP := sDat ;
756 4 : gstG[iRow].cKset := sDat ;
757 5 : gstG[iRow].Nutrient.dFCM := StrToFloat( sDat ) ;
758 6 : gstG[iRow].Nutrient.dDMI := StrToFloat( sDat ) ;
759 7 : gstG[iRow].Nutrient.dCP := StrToFloat( sDat ) ;
760 8 : gstG[iRow].Nutrient.dDCP := StrToFloat( sDat ) ;
761 9 : gstG[iRow].Nutrient.dTDN := StrToFloat( sDat ) ;
762 10 : gstG[iRow].Nutrient.dDE := StrToFloat( sDat ) ;
763 11 : gstG[iRow].Nutrient.dMEC := StrToFloat( sDat ) ;
764 12 : gstG[iRow].Nutrient.dMEJ := StrToFloat( sDat ) ;
765 13 : gstG[iRow].Nutrient.dCa := StrToFloat( sDat ) ;
766 14 : gstG[iRow].Nutrient.dP := StrToFloat( sDat ) ;
767 15 : gstG[iRow].Nutrient.dVA := StrToFloat( sDat ) ;
768 16 : gstG[iRow].Nutrient.dVD := StrToFloat( sDat ) ;
773 Application.ProcessMessages;
781 procedure TForm1.Spread_JFS_Data();
793 0 : StringGrid1.Cells[i, iR] := IntToStr(j) ;
794 1 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].dWt1) ;
795 2 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].dInWt1) ;
796 3 : StringGrid1.Cells[i, iR] := gstG[j].cLVCP ;
797 4 : StringGrid1.Cells[i, iR] := gstG[j].cKset ;
798 5 : StringGrid1.Cells[i, iR] := gstG[j].cWean ;
799 6 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dFCM) ;
800 7 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dDMI) ;
801 8 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dCP) ;
802 9 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dDCP) ;
803 10 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dTDN) ;
804 11 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dDE) ;
805 12 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dMEC) ;
806 13 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dMEJ) ;
807 14 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dCa) ;
808 15 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dP) ;
809 16 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dVA) ;
810 17 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dVD) ;
814 Application.ProcessMessages;
818 procedure TForm1.DispHeader_1();
824 StringGrid1.Cols[iNO].Text := 'No.';
830 StringGrid1.Columns[iNo].Title.Caption := '体重' ;
831 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
835 StringGrid1.Columns[iNo].Title.Caption := '日増体重' ;
836 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
840 StringGrid1.Columns[iNo].Title.Caption := 'CPの最低値' ;
841 StringGrid1.Columns[iNo].Alignment := taCenter ;
845 StringGrid1.Columns[iNo].Title.Caption := '季節の考慮';
846 StringGrid1.Columns[iNo].Alignment := taLeftJustify ;
850 StringGrid1.Columns[iNo].Title.Caption := '育成牛の離乳' ;
851 StringGrid1.Columns[iNo].Alignment := taLeftJustify ;
856 StringGrid1.Columns[iNo].Title.Caption := 'FCM' ;
857 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
859 StringGrid1.Columns[iNo].Title.Caption := 'DMI' ;
860 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
862 StringGrid1.Columns[iNo].Title.Caption := 'CP' ;
863 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
865 StringGrid1.Columns[iNo].Title.Caption := 'DCP' ;
866 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
868 StringGrid1.Columns[iNo].Title.Caption := 'TDN' ;
869 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
871 StringGrid1.Columns[iNo].Title.Caption := 'DE' ;
872 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
874 StringGrid1.Columns[iNo].Title.Caption := 'ME(Mcal)' ;
875 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
877 StringGrid1.Columns[iNo].Title.Caption := 'ME(MJ)' ;
878 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
880 StringGrid1.Columns[iNo].Title.Caption := 'Ca' ;
881 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
883 StringGrid1.Columns[iNo].Title.Caption := 'P' ;
884 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
886 StringGrid1.Columns[iNo].Title.Caption := 'VA' ;
887 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
889 StringGrid1.Columns[iNo].Title.Caption := 'VD' ;
890 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
892 StringGrid1.Columns[iNo].Title.Caption := ' ' ;
893 StringGrid1.Columns[iNo].Alignment := taRightJustify ;
894 Application.ProcessMessages;
897 procedure TForm1.DispHeader_2();
903 StringGrid2.Cols[iNO].Text := 'No.';
909 StringGrid2.Columns[iNo].Title.Caption := '体重' ;
910 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
914 StringGrid2.Columns[iNo].Title.Caption := '日増体重' ;
915 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
919 StringGrid2.Columns[iNo].Title.Caption := 'CPの最低値' ;
920 StringGrid2.Columns[iNo].Alignment := taCenter ;
924 StringGrid2.Columns[iNo].Title.Caption := '季節の考慮';
925 StringGrid2.Columns[iNo].Alignment := taLeftJustify ;
929 StringGrid2.Columns[iNo].Title.Caption := '育成牛の離乳' ;
930 StringGrid2.Columns[iNo].Alignment := taLeftJustify ;
935 StringGrid2.Columns[iNo].Title.Caption := 'FCM' ;
936 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
938 StringGrid2.Columns[iNo].Title.Caption := 'DMI' ;
939 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
941 StringGrid2.Columns[iNo].Title.Caption := 'CP' ;
942 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
944 StringGrid2.Columns[iNo].Title.Caption := 'DCP' ;
945 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
947 StringGrid2.Columns[iNo].Title.Caption := 'TDN' ;
948 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
950 StringGrid2.Columns[iNo].Title.Caption := 'DE' ;
951 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
953 StringGrid2.Columns[iNo].Title.Caption := 'ME(Mcal)' ;
954 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
956 StringGrid2.Columns[iNo].Title.Caption := 'ME(MJ)' ;
957 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
959 StringGrid2.Columns[iNo].Title.Caption := 'Ca' ;
960 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
962 StringGrid2.Columns[iNo].Title.Caption := 'P' ;
963 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
965 StringGrid2.Columns[iNo].Title.Caption := 'VA' ;
966 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
968 StringGrid2.Columns[iNo].Title.Caption := 'VD' ;
969 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
971 StringGrid2.Columns[iNo].Title.Caption := ' ' ;
972 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
974 StringGrid2.Columns[iNo].Title.Caption := '<DMI>' ;
975 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
977 StringGrid2.Columns[iNo].Title.Caption := '<CP>' ;
978 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
980 StringGrid2.Columns[iNo].Title.Caption := '<DCP>' ;
981 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
983 StringGrid2.Columns[iNo].Title.Caption := '<TDN>' ;
984 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
986 StringGrid2.Columns[iNo].Title.Caption := '<DE>' ;
987 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
989 StringGrid2.Columns[iNo].Title.Caption := '<ME(Mcal)>' ;
990 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
992 StringGrid2.Columns[iNo].Title.Caption := '<ME(MJ)>' ;
993 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
995 StringGrid2.Columns[iNo].Title.Caption := '<Ca>' ;
996 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
998 StringGrid2.Columns[iNo].Title.Caption := '<P>' ;
999 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
1001 StringGrid2.Columns[iNo].Title.Caption := '<VA>' ;
1002 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
1004 StringGrid2.Columns[iNo].Title.Caption := '<VD>' ;
1005 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
1007 StringGrid2.Columns[iNo].Title.Caption := ' ' ;
1008 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
1010 StringGrid2.Columns[iNo].Title.Caption := ' ' ;
1011 StringGrid2.Columns[iNo].Alignment := taRightJustify ;
1012 Application.ProcessMessages;
1015 procedure TForm1.SelectData();
1021 procedure TForm1.Class_JFS();
1023 dBW, dLW, dZoTj : Double;
1024 sKset, sCP12 : String;
1029 dLW := StrToFloat(LabeledEdit1.Text);
1030 dBW := StrToFloat(LabeledEdit2.Text);
1031 sZotj := ComboBox3.Caption;
1032 if (sZotj <> '標準値') then dZoTj := StrToFloat(sZotj);
1033 sKset := ComboBox1.Caption;
1034 if CheckBox1.Checked then sCP12 := 'ON' else sCP12 := 'OFF';
1037 for j:=1 to giSNo do
1039 if (gstG[j].dWt1 >= dLW) and (gstG[j].dWt1 <= dBW) then
1041 if (sZotj = '標準値') then dZoTj := NichZotaijuAnbaichi(gstG[j].dWt1);
1042 if gstG[j].dInWt1 = dZoTj then
1044 if gstG[j].cKset = sKset then
1047 if gstG[j].dWt1 < 250 then
1050 if gstG[j].cLVCP = sCP12 then bC12Flg := True;
1056 0 : StringGrid1.Cells[i, iR] := IntToStr(j) ;
1057 1 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].dWt1) ;
1058 2 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].dInWt1) ;
1059 3 : StringGrid1.Cells[i, iR] := gstG[j].cLVCP ;
1060 4 : StringGrid1.Cells[i, iR] := gstG[j].cKset ;
1061 5 : StringGrid1.Cells[i, iR] := gstG[j].cWean ;
1062 6 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dFCM) ;
1063 7 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dDMI) ;
1064 8 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dCP) ;
1065 9 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dDCP) ;
1066 10 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dTDN) ;
1067 11 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dDE) ;
1068 12 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dMEC) ;
1069 13 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dMEJ) ;
1070 14 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dCa) ;
1071 15 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dP) ;
1072 16 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dVA) ;
1073 17 : StringGrid1.Cells[i, iR] := FloatToStr(gstG[j].Nutrient.dVD) ;
1077 Application.ProcessMessages;
1083 giRow4JFS := iR - 1 ;
1086 procedure TForm1.Class_Origin2();
1088 dBW, dLW, dZoTj : Double;
1089 sKset, sCP12 : String;
1094 dLW := StrToFloat(LabeledEdit1.Text);
1095 dBW := StrToFloat(LabeledEdit2.Text);
1096 sZotj := ComboBox3.Caption;
1097 if (sZotj <> '標準値') then dZoTj := StrToFloat(sZotj);
1098 sKset := ComboBox1.Caption;
1099 if CheckBox1.Checked then sCP12 := 'ON' else sCP12 := 'OFF';
1102 for j:=1 to giOrgSrc do
1104 if (gOrign[j].dWt1 >= dLW) and (gOrign[j].dWt1 <= dBW) then
1106 if (sZotj = '標準値') then dZoTj := NichZotaijuAnbaichi(gOrign[j].dWt1);
1107 if gOrign[j].dInWt1 = dZoTj then
1109 if gOrign[j].cKset = sKset then
1112 if gOrign[j].dWt1 < 250 then
1115 if gOrign[j].cLVCP = sCP12 then bC12Flg := True;
1118 if gOrign[j].cWean = '離乳前' then
1123 0 : StringGrid2.Cells[i, iR] := IntToStr(j) ;
1124 1 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].dWt1) ;
1125 2 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].dInWt1) ;
1126 3 : StringGrid2.Cells[i, iR] := gOrign[j].cLVCP ;
1127 4 : StringGrid2.Cells[i, iR] := gOrign[j].cKset ;
1128 5 : StringGrid2.Cells[i, iR] := gOrign[j].cWean ;
1129 6 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dFCM) ;
1130 7 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dDMI) ;
1131 8 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dCP) ;
1132 9 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dDCP) ;
1133 10 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dTDN) ;
1134 11 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dDE) ;
1135 12 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dMEC) ;
1136 13 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dMEJ) ;
1137 14 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dCa) ;
1138 15 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dP) ;
1139 16 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dVA) ;
1140 17 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dVD) ;
1149 0 : StringGrid2.Cells[i, iR] := IntToStr(j) ;
1150 1 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].dWt1) ;
1151 2 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].dInWt1) ;
1152 3 : StringGrid2.Cells[i, iR] := gOrign[j].cLVCP ;
1153 4 : StringGrid2.Cells[i, iR] := gOrign[j].cKset ;
1154 5 : StringGrid2.Cells[i, iR] := gOrign[j].cWean ;
1155 6 : StringGrid2.Cells[i, iR] := FloatToStr(gOrign[j].Nutrient.dFCM) ;
1156 7 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dDMI) ;
1157 8 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dCP) ;
1158 9 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dDCP) ;
1159 10 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dTDN) ;
1160 11 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dDE) ;
1161 12 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dMEC) ;
1162 13 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dMEJ) ;
1163 14 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dCa) ;
1164 15 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dP) ;
1165 16 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dVA) ;
1166 17 : StringGrid2.Cells[i+12, iR] := FloatToStr(gOrign[j].Nutrient.dVD) ;
1171 Application.ProcessMessages;
1177 giRow4Orign := iR - 1 ;
1180 procedure TForm1.GraphOutPut();
1183 JapaneseFeedingStandard.Clear;
1184 Origin2BeforeWeaning.Clear;
1185 Origin2AfterWeaning.Clear;
1186 RegressionCurveJFS.Clear;
1187 RegressionCurveOriginBefore.Clear;
1188 RegressionCurveOriginAfter.Clear;
1189 Label7.Caption := '';
1190 Label8.Caption := '';
1191 Label9.Caption := '';
1192 JapaneseFeedingStandard.LinePen.Color:=clRed;
1193 Origin2BeforeWeaning.LinePen.Color:=clGreen;
1194 Origin2AfterWeaning.LinePen.Color:=clBlue;
1195 JapaneseFeedingStandard.Pointer.HorizSize := fMarker.gMrkSze[1];
1196 JapaneseFeedingStandard.Pointer.VertSize := fMarker.gMrkSze[1];
1197 Origin2BeforeWeaning.Pointer.HorizSize := fMarker.gMrkSze[2];
1198 Origin2BeforeWeaning.Pointer.VertSize := fMarker.gMrkSze[2];
1199 Origin2AfterWeaning.Pointer.HorizSize := fMarker.gMrkSze[3];
1200 Origin2AfterWeaning.Pointer.VertSize := fMarker.gMrkSze[3];
1201 if ComboBox2.Text = 'DMI' then
1202 Chart1.AxisList.Axes[0].Title.Caption := 'DMI (kg)'
1203 else if ComboBox2.Text = 'CP' then
1204 Chart1.AxisList.Axes[0].Title.Caption := 'CP (g)'
1205 else if ComboBox2.Text = 'DCP' then
1206 Chart1.AxisList.Axes[0].Title.Caption := 'DCP (g)'
1207 else if ComboBox2.Text = 'TDN' then
1208 Chart1.AxisList.Axes[0].Title.Caption := 'TDN (kg)'
1209 else if ComboBox2.Text = 'DE' then
1210 Chart1.AxisList.Axes[0].Title.Caption := 'DE (Mcal)'
1211 else if ComboBox2.Text = 'ME(Mcal)' then
1212 Chart1.AxisList.Axes[0].Title.Caption := 'ME (Mcal)'
1213 else if ComboBox2.Text = 'ME(MJ)' then
1214 Chart1.AxisList.Axes[0].Title.Caption := 'ME (MJ)'
1215 else if ComboBox2.Text = 'Ca' then
1216 Chart1.AxisList.Axes[0].Title.Caption := 'Ca (g)'
1217 else if ComboBox2.Text = 'P' then
1218 Chart1.AxisList.Axes[0].Title.Caption := 'P (g)'
1219 else if ComboBox2.Text = 'VA' then
1220 Chart1.AxisList.Axes[0].Title.Caption := 'VA (1000IU)'
1221 else if ComboBox2.Text = 'VD' then
1222 Chart1.AxisList.Axes[0].Title.Caption := 'VD (1000IU)';
1223 if CheckBox2.Checked then GraphDraw4JFS();
1225 if CheckBox3.Checked then iKbn := iKbn + 1;
1226 if CheckBox4.Checked then iKbn := iKbn + 10;
1227 if iKbn > 0 then GraphDraw4Origin2( iKbn );
1230 procedure TForm1.GraphDraw4JFS();
1236 if ComboBox2.Text = 'DMI' then
1238 else if ComboBox2.Text = 'CP' then
1240 else if ComboBox2.Text = 'DCP' then
1242 else if ComboBox2.Text = 'TDN' then
1244 else if ComboBox2.Text = 'DE' then
1246 else if ComboBox2.Text = 'ME(Mcal)' then
1248 else if ComboBox2.Text = 'ME(MJ)' then
1250 else if ComboBox2.Text = 'Ca' then
1252 else if ComboBox2.Text = 'P' then
1254 else if ComboBox2.Text = 'VA' then
1256 else if ComboBox2.Text = 'VD' then
1258 for i:=1 to giRow4JFS do
1260 dWt := StrToFloat(StringGrid1.Cells[1,i]);
1261 sWrk := StringGrid1.Cells[iB,i];
1262 if Trim(sWrk) <> '' then
1264 dWrk := StrToFloat(StringGrid1.Cells[iB,i]);
1265 JapaneseFeedingStandard.AddXY(dWt, dWrk);
1270 procedure TForm1.GraphDraw4Origin2(var iKbn : Integer);
1272 i, iA, iB : Integer;
1276 if ComboBox2.Text = 'DMI' then
1281 else if ComboBox2.Text = 'CP' then
1286 else if ComboBox2.Text = 'DCP' then
1291 else if ComboBox2.Text = 'TDN' then
1296 else if ComboBox2.Text = 'DE' then
1301 else if ComboBox2.Text = 'ME(Mcal)' then
1306 else if ComboBox2.Text = 'ME(MJ)' then
1311 else if ComboBox2.Text = 'Ca' then
1316 else if ComboBox2.Text = 'P' then
1321 else if ComboBox2.Text = 'VA' then
1326 else if ComboBox2.Text = 'VD' then
1331 for i:=1 to giRow4Orign do
1333 if (iKbn = 1) or (iKbn = 11) then
1335 dWt := StrToFloat(StringGrid2.Cells[1,i]);
1336 sWrk := StringGrid2.Cells[iB,i];
1337 if Trim(sWrk) <> '' then
1339 dWrk := StrToFloat(StringGrid2.Cells[iB,i]);
1340 Origin2BeforeWeaning.AddXY(dWt, dWrk);
1343 if (iKbn = 10) or (iKbn = 11) then
1345 dWt := StrToFloat(StringGrid2.Cells[1,i]);
1346 sWrk := StringGrid2.Cells[iA,i];
1347 if Trim(sWrk) <> '' then
1349 dWrk := StrToFloat(StringGrid2.Cells[iA,i]);
1350 Origin2AfterWeaning.AddXY(dWt, dWrk);
1356 function TForm1.NichZotaijuAnbaichi(var dWt : Double) : Double;
1358 if( dWt >= 40 ) then NichZotaijuAnbaichi := 0.0 ;
1359 if( dWt >= 43 ) then NichZotaijuAnbaichi := 0.1 ;
1360 if( dWt >= 44 ) then NichZotaijuAnbaichi := 0.2 ;
1361 if( dWt >= 45 ) then NichZotaijuAnbaichi := 0.3 ;
1362 if( dWt >= 46 ) then NichZotaijuAnbaichi := 0.4 ;
1363 if( dWt >= 48 ) then NichZotaijuAnbaichi := 0.5 ;
1364 if( dWt >= 51 ) then NichZotaijuAnbaichi := 0.6 ;
1365 if( dWt >= 55 ) then NichZotaijuAnbaichi := 0.7 ;
1366 if( dWt >= 60 ) then NichZotaijuAnbaichi := 0.8 ;
1367 if( dWt >= 69 ) then NichZotaijuAnbaichi := 0.9 ;
1368 if( dWt >= 73 ) then NichZotaijuAnbaichi := 1.0 ;
1369 if( dWt >= 130 ) then NichZotaijuAnbaichi := 0.9 ;
1370 if( dWt >= 214 ) then NichZotaijuAnbaichi := 0.8 ;
1371 if( dWt >= 282 ) then NichZotaijuAnbaichi := 0.7 ;
1372 if( dWt >= 345 ) then NichZotaijuAnbaichi := 0.6 ;
1373 if( dWt >= 404 ) then NichZotaijuAnbaichi := 0.5 ;
1374 if( dWt >= 462 ) then NichZotaijuAnbaichi := 0.4 ;
1375 if( dWt >= 518 ) then NichZotaijuAnbaichi := 0.3 ;
1376 if( dWt >= 573 ) then NichZotaijuAnbaichi := 0.2 ;
1377 if( dWt >= 627 ) then NichZotaijuAnbaichi := 0.1 ;
1378 if( dWt >= 681 ) then NichZotaijuAnbaichi := 0.0 ;