root / UFCompSimulP.pas
Historique | Voir | Annoter | Télécharger (114,951 ko)
1 |
unit UFCompSimulP;
|
---|---|
2 |
|
3 |
interface
|
4 |
|
5 |
uses
|
6 |
Windows, Forms, Classes, Controls, Messages, Dialogs, StdCtrls, ExtCtrls, |
7 |
ComCtrls, Menus, TeeProcs, TeEngine, Series, Chart; |
8 |
|
9 |
type
|
10 |
TFCompSimulP = class(TForm)
|
11 |
PC: TPageControl; |
12 |
TabRej: TTabSheet; |
13 |
CBRej3: TComboBox; |
14 |
CBRej4: TComboBox; |
15 |
TabPerf: TTabSheet; |
16 |
CBPerf4: TComboBox; |
17 |
CBPerf3: TComboBox; |
18 |
CBPerf2: TComboBox; |
19 |
TabAli: TTabSheet; |
20 |
TabAA: TTabSheet; |
21 |
TabNRJ: TTabSheet; |
22 |
CBAli4: TComboBox; |
23 |
CBAA3: TComboBox; |
24 |
CBAA4: TComboBox; |
25 |
CBNRJ3: TComboBox; |
26 |
CBNRJ4: TComboBox; |
27 |
CBPerf1: TComboBox; |
28 |
CBAA1: TComboBox; |
29 |
CBAA5A: TComboBox; |
30 |
CBAA2: TComboBox; |
31 |
CBNRJ1: TComboBox; |
32 |
CBNRJ2: TComboBox; |
33 |
CBNRJ5: TComboBox; |
34 |
GBPerfX: TGroupBox; |
35 |
GBPerfY: TGroupBox; |
36 |
GBAAX: TGroupBox; |
37 |
GBNRJX: TGroupBox; |
38 |
GBAliY: TGroupBox; |
39 |
GBAAY: TGroupBox; |
40 |
GBNRJY: TGroupBox; |
41 |
GBRejY: TGroupBox; |
42 |
GBAAT: TGroupBox; |
43 |
GBRejT: TGroupBox; |
44 |
GBRejX: TGroupBox; |
45 |
GBAliX: TGroupBox; |
46 |
GBAliT: TGroupBox; |
47 |
GBPerfT: TGroupBox; |
48 |
GBNRJT: TGroupBox; |
49 |
Graph: TChart; |
50 |
LBNRJ: TListBox; |
51 |
LBRej: TListBox; |
52 |
LBAA: TListBox; |
53 |
CBAA5B: TComboBox; |
54 |
CBPerf3Global: TComboBox; |
55 |
CBNRJ3Valeurs: TComboBox; |
56 |
TabMin: TTabSheet; |
57 |
GBMinY: TGroupBox; |
58 |
CBMin3: TComboBox; |
59 |
CBMin4: TComboBox; |
60 |
GBMinX: TGroupBox; |
61 |
GBMinT: TGroupBox; |
62 |
CBAli3: TComboBox; |
63 |
LBMin: TListBox; |
64 |
CBMin1: TComboBox; |
65 |
CBMin2: TComboBox; |
66 |
CBMin5B: TComboBox; |
67 |
CBMin5A: TComboBox; |
68 |
PM: TPopupMenu; |
69 |
MI3D: TMenuItem; |
70 |
MIPreview: TMenuItem; |
71 |
MIPrint: TMenuItem; |
72 |
PD: TPrintDialog; |
73 |
CBAli5: TComboBox; |
74 |
CBAli1: TComboBox; |
75 |
procedure FormShow(Sender: TObject);
|
76 |
procedure FormClose(Sender: TObject; var Action: TCloseAction); |
77 |
procedure PCChange(Sender: TObject);
|
78 |
procedure CBRej3Change(Sender: TObject);
|
79 |
procedure CBRej4Change(Sender: TObject);
|
80 |
procedure CBPerf2Change(Sender: TObject);
|
81 |
procedure CBPerf3Change(Sender: TObject);
|
82 |
procedure CBAli4Change(Sender: TObject);
|
83 |
procedure CBAA3Change(Sender: TObject);
|
84 |
procedure CBAA4Change(Sender: TObject);
|
85 |
procedure CBNRJ3Change(Sender: TObject);
|
86 |
procedure CBNRJ4Change(Sender: TObject);
|
87 |
procedure CBPerf1Change(Sender: TObject);
|
88 |
procedure CBPerf4Change(Sender: TObject);
|
89 |
procedure CBAA1Change(Sender: TObject);
|
90 |
procedure CBAA5Change(Sender: TObject);
|
91 |
procedure CBAA2Change(Sender: TObject);
|
92 |
procedure CBNRJ1Change(Sender: TObject);
|
93 |
procedure CBNRJ2Change(Sender: TObject);
|
94 |
procedure CBNRJ5Change(Sender: TObject);
|
95 |
procedure CBMin3Change(Sender: TObject);
|
96 |
procedure CBMin4Change(Sender: TObject);
|
97 |
procedure CBAli3Change(Sender: TObject);
|
98 |
procedure FormCreate(Sender: TObject);
|
99 |
procedure CBMin1Change(Sender: TObject);
|
100 |
procedure CBMin2Change(Sender: TObject);
|
101 |
procedure CBMin5Change(Sender: TObject);
|
102 |
procedure MI3DClick(Sender: TObject);
|
103 |
procedure MIPreviewClick(Sender: TObject);
|
104 |
procedure MIPrintClick(Sender: TObject);
|
105 |
procedure CBAli1Change(Sender: TObject);
|
106 |
procedure CBAli5Change(Sender: TObject);
|
107 |
procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; |
108 |
private
|
109 |
{ D?clarations priv?es }
|
110 |
LinePerf: array[1..5] of TLineSeries; |
111 |
BarPerf: TBarSeries; |
112 |
ListAli, ListMat: TStrings; |
113 |
CompositionComplete: boolean; |
114 |
BarAli: array of TBarSeries; |
115 |
BarMat: TBarSeries; |
116 |
ListAA: TStrings; |
117 |
BarAA: array of TBarSeries; |
118 |
LineAA: array[1..5] of TLineSeries; |
119 |
ListNRJ: TStrings; |
120 |
BarNRJ: array of TBarSeries; |
121 |
LineNRJ: array[1..5] of TLineSeries; |
122 |
ListMin: TStrings; |
123 |
BarMin: array of TBarSeries; |
124 |
LineMin: array[1..5] of TLineSeries; |
125 |
ListRej: TStrings; |
126 |
BarRej: array of TBarSeries; |
127 |
procedure ResetGraph;
|
128 |
procedure InitPerf;
|
129 |
procedure AffGraphPerf;
|
130 |
procedure InitAli;
|
131 |
procedure AffGraphAli;
|
132 |
procedure InitAA;
|
133 |
procedure AffGraphAA;
|
134 |
procedure InitNRJ;
|
135 |
procedure AffGraphNRJ;
|
136 |
procedure InitMin;
|
137 |
procedure AffGraphMin;
|
138 |
procedure InitRej;
|
139 |
procedure AffGraphRej;
|
140 |
public
|
141 |
{ D?clarations publiques }
|
142 |
end;
|
143 |
|
144 |
var
|
145 |
FCompSimulP: TFCompSimulP; |
146 |
|
147 |
implementation
|
148 |
|
149 |
uses
|
150 |
Graphics, Printers, Math, SysUtils, gnugettext, UVariables, UStrings, |
151 |
UFindRec, UUtil, UEchelle, UCalcul, UFSimulP, UFPrevGraph, UFWarning; |
152 |
|
153 |
{$R *.dfm}
|
154 |
|
155 |
{ TFCompSimulP }
|
156 |
|
157 |
procedure TFCompSimulP.FormCreate(Sender: TObject);
|
158 |
begin
|
159 |
if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
160 |
then
|
161 |
Font.Name := 'Arial Unicode MS';
|
162 |
TranslateComponent(Self); |
163 |
Constraints.MinWidth := 544 + (Width - ClientWidth);
|
164 |
Width := 640;
|
165 |
Constraints.MinHeight := 360 + (Height - ClientHeight);
|
166 |
Height := 480;
|
167 |
CBPerf1.ItemIndex := 0;
|
168 |
CBPerf2.ItemIndex := 0;
|
169 |
CBPerf3.ItemIndex := 0;
|
170 |
CBPerf3Global.ItemIndex := 0;
|
171 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Weight gain'), _('g'), _('d')])); |
172 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Body weight'), _('kg')])); |
173 |
CBPerf4.ItemIndex := 0;
|
174 |
CBAli1.ItemIndex := 0;
|
175 |
CBAli3.ItemIndex := 0;
|
176 |
CBAli4.Items.Add(StrKg); |
177 |
CBAli4.Items.Add(Format('%s/%s', [StrKg, StrJ]));
|
178 |
CBAli4.Items.Add('%');
|
179 |
CBAli4.ItemIndex := 0;
|
180 |
CBAli5.ItemIndex := 0;
|
181 |
CBAA1.ItemIndex := 0;
|
182 |
CBAA2.ItemIndex := 0;
|
183 |
CBAA3.ItemIndex := 1;
|
184 |
CBAA4.Items.Add(StrG); |
185 |
CBAA4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
186 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
187 |
CBAA4.Items.Add('%');
|
188 |
CBAA4.ItemIndex := 0;
|
189 |
CBAA5A.ItemIndex := 0;
|
190 |
CBAA5B.ItemIndex := 0;
|
191 |
CBNRJ1.ItemIndex := 0;
|
192 |
CBNRJ2.ItemIndex := 0;
|
193 |
CBNRJ3.ItemIndex := 0;
|
194 |
CBNRJ3Valeurs.ItemIndex := 0;
|
195 |
CBNRJ4.Items.Add(StrMJ); |
196 |
CBNRJ4.Items.Add(Format('%s/%s', [StrMJ, StrJ]));
|
197 |
CBNRJ4.Items.Add(Format('%s/%s %s', [StrMJ, StrKg, StrAlimentUnit]));
|
198 |
CBNRJ4.Items.Add('%');
|
199 |
CBNRJ4.ItemIndex := 0;
|
200 |
CBNRJ5.ItemIndex := 0;
|
201 |
CBMin1.ItemIndex := 0;
|
202 |
CBMin2.ItemIndex := 0;
|
203 |
CBMin3.ItemIndex := 0;
|
204 |
CBMin4.Items.Add(StrG); |
205 |
CBMin4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
206 |
CBMin4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
207 |
CBMin4.Items.Add('%');
|
208 |
CBMin4.ItemIndex := 0;
|
209 |
CBMin5A.ItemIndex := 0;
|
210 |
CBMin5B.ItemIndex := 0;
|
211 |
CBRej3.ItemIndex := 0;
|
212 |
CBRej4.Items.Add(StrG); |
213 |
CBRej4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
214 |
CBRej4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
215 |
CBRej4.Items.Add('%');
|
216 |
CBRej4.ItemIndex := 0;
|
217 |
end;
|
218 |
|
219 |
procedure TFCompSimulP.FormShow(Sender: TObject);
|
220 |
var
|
221 |
k: integer; |
222 |
begin
|
223 |
MIPrint.Enabled := IsComplete or IsEducation;
|
224 |
// Bas de page du graphique
|
225 |
Graph.Foot.Text.Clear; |
226 |
case FSimulP.PC.ActivePageIndex of |
227 |
1: // Comparaison |
228 |
for k := 5 downto 1 do |
229 |
if TabSimulP[k].Ok
|
230 |
then
|
231 |
begin
|
232 |
if FSimulP.RBCompSimul.Checked
|
233 |
then // Simulations simples |
234 |
Graph.Foot.Text.Add(Format(StrSimulComp, [k, FindNomSimulP(TabSimulP[k].Simul)])) |
235 |
else // Un ?l?ment d'une simulation |
236 |
begin
|
237 |
if FSimulP.RBCompProfil.Checked
|
238 |
then // Profil animal |
239 |
Graph.Foot.Text.Add(Format(StrSimulProfil, [k, FindNomSimulP(TabSimulP[k].Simul), FindNomProfilP(TabSimulP[k].Profil)])); |
240 |
if FSimulP.RBCompSeqAli.Checked
|
241 |
then // S?quence alimentaire |
242 |
Graph.Foot.Text.Add(Format(StrSimulSeqAli, [k, FindNomSimulP(TabSimulP[k].Simul), FindNomSeqAliP(TabSimulP[k].SeqAli)])); |
243 |
if FSimulP.RBCompRation.Checked
|
244 |
then // Plan de rationnement |
245 |
Graph.Foot.Text.Add(Format(StrSimulRation, [k, FindNomSimulP(TabSimulP[k].Simul), FindNomRationP(TabSimulP[k].Ration)])); |
246 |
end;
|
247 |
end;
|
248 |
2: // Sensibilit? |
249 |
Graph.Foot.Text.Add(Format(StrSimulSens, [FSimulP.CBVariable.Text, FSimulP.CBSensSimul.Text])); |
250 |
end;
|
251 |
// Aliment
|
252 |
InitAli; |
253 |
// Performances
|
254 |
InitPerf; |
255 |
// Acides amin?s
|
256 |
InitAA; |
257 |
// Energie
|
258 |
InitNRJ; |
259 |
// Min?raux
|
260 |
InitMin; |
261 |
// Rejets
|
262 |
InitRej; |
263 |
// Abscisses par d?faut
|
264 |
CBPerf2.ItemIndex := XCrois; |
265 |
CBAA2.ItemIndex := XCrois; |
266 |
CBNRJ2.ItemIndex := XCrois; |
267 |
// Affichage principal
|
268 |
PC.ActivePageIndex := 0;
|
269 |
PCChange (nil);
|
270 |
end;
|
271 |
|
272 |
procedure TFCompSimulP.FormClose (Sender: TObject; var Action: TCloseAction); |
273 |
var
|
274 |
i, k: integer; |
275 |
begin
|
276 |
// Performances
|
277 |
BarPerf.Free; |
278 |
for k := 1 to 5 do |
279 |
if TabSimulP[k].Ok
|
280 |
then
|
281 |
LinePerf[k].Free; |
282 |
// Aliment
|
283 |
BarMat.Free; |
284 |
for i := 0 to ListAli.Count - 1 do |
285 |
BarAli[i].Free; |
286 |
SetLength(BarAli, 0);
|
287 |
ListMat.Free; |
288 |
ListAli.Free; |
289 |
// Acides amin?s
|
290 |
for k := 1 to 5 do |
291 |
if TabSimulP[k].Ok
|
292 |
then
|
293 |
LineAA[k].Free; |
294 |
for i := 0 to ListAA.Count - 1 do |
295 |
BarAA[i].Free; |
296 |
SetLength(BarAA, 0);
|
297 |
ListAA.Free; |
298 |
// Energie
|
299 |
for k := 1 to 5 do |
300 |
if TabSimulP[k].Ok
|
301 |
then
|
302 |
LineNRJ[k].Free; |
303 |
for i := 0 to ListNRJ.Count - 1 do |
304 |
BarNRJ[i].Free; |
305 |
SetLength(BarNRJ, 0);
|
306 |
ListNRJ.Free; |
307 |
// Min?raux
|
308 |
for k := 1 to 5 do |
309 |
if TabSimulP[k].Ok
|
310 |
then
|
311 |
LineMin[k].Free; |
312 |
for i := 0 to ListMin.Count - 1 do |
313 |
BarMin[i].Free; |
314 |
SetLength(BarMin, 0);
|
315 |
ListMin.Free; |
316 |
// Rejets
|
317 |
for i := 0 to ListRej.Count - 1 do |
318 |
BarRej[i].Free; |
319 |
SetLength(BarRej, 0);
|
320 |
ListRej.Free; |
321 |
end;
|
322 |
|
323 |
procedure TFCompSimulP.PCChange(Sender: TObject);
|
324 |
begin
|
325 |
case PC.ActivePageIndex of |
326 |
0: // Performances |
327 |
AffGraphPerf; |
328 |
1: // Aliment |
329 |
AffGraphAli; |
330 |
2: // Acides amin?s |
331 |
AffGraphAA; |
332 |
3: // Energie |
333 |
AffGraphNRJ; |
334 |
4: // Min?raux |
335 |
AffGraphMin; |
336 |
5: // Rejets |
337 |
AffGraphRej; |
338 |
end;
|
339 |
end;
|
340 |
|
341 |
procedure TFCompSimulP.ResetGraph;
|
342 |
var
|
343 |
i, k: integer; |
344 |
begin
|
345 |
Graph.UndoZoom; |
346 |
Graph.Legend.Visible := TRUE; |
347 |
Graph.Title.Text.Clear; |
348 |
Graph.SubTitle.Text.Clear; |
349 |
Graph.BottomAxis.MinimumOffset := 0;
|
350 |
Graph.BottomAxis.MaximumOffset := 0;
|
351 |
// Performances
|
352 |
for k := 1 to 5 do |
353 |
if TabSimulP[k].Ok
|
354 |
then
|
355 |
LinePerf[k].Active := FALSE; |
356 |
BarPerf.Active := FALSE; |
357 |
// Aliment
|
358 |
for i := 0 to ListAli.Count - 1 do |
359 |
BarAli[i].Active := FALSE; |
360 |
BarMat.Active := FALSE; |
361 |
// Acides amin?s
|
362 |
for i := 0 to ListAA.Count - 1 do |
363 |
BarAA[i].Active := FALSE; |
364 |
for k := 1 to 5 do |
365 |
if TabSimulP[k].Ok
|
366 |
then
|
367 |
LineAA[k].Active := FALSE; |
368 |
// Energie
|
369 |
for i := 0 to ListNRJ.Count - 1 do |
370 |
BarNRJ[i].Active := FALSE; |
371 |
for k := 1 to 5 do |
372 |
if TabSimulP[k].Ok
|
373 |
then
|
374 |
LineNRJ[k].Active := FALSE; |
375 |
// Min?raux
|
376 |
for i := 0 to ListMin.Count - 1 do |
377 |
BarMin[i].Active := FALSE; |
378 |
for k := 1 to 5 do |
379 |
if TabSimulP[k].Ok
|
380 |
then
|
381 |
LineMin[k].Active := FALSE; |
382 |
// Rejets
|
383 |
for i := 0 to ListRej.Count - 1 do |
384 |
BarRej[i].Active := FALSE; |
385 |
end;
|
386 |
|
387 |
procedure TFCompSimulP.MI3DClick(Sender: TObject);
|
388 |
begin
|
389 |
Graph.View3D := not (Graph.View3D);
|
390 |
end;
|
391 |
|
392 |
procedure TFCompSimulP.MIPreviewClick(Sender: TObject);
|
393 |
begin
|
394 |
FPrevGraph := TFPrevGraph.Create(Self); |
395 |
with FPrevGraph do |
396 |
begin
|
397 |
TPPGraph.Panels.Add(Graph); |
398 |
ShowModal; |
399 |
Release; |
400 |
end;
|
401 |
end;
|
402 |
|
403 |
procedure TFCompSimulP.MIPrintClick(Sender: TObject);
|
404 |
begin
|
405 |
if PD.Execute
|
406 |
then
|
407 |
begin
|
408 |
Printer.Orientation := poLandscape; |
409 |
Graph.Print; |
410 |
end;
|
411 |
end;
|
412 |
|
413 |
//////////////////////
|
414 |
// Performances //
|
415 |
//////////////////////
|
416 |
procedure TFCompSimulP.InitPerf;
|
417 |
const
|
418 |
TabColor: array[1..5] of TColor |
419 |
= (clRed, clGreen, clYellow, clBlue, clFuchsia); |
420 |
var
|
421 |
k: integer; |
422 |
begin
|
423 |
// LinePerf : s?ries (lignes) graphiques
|
424 |
for k := 1 to 5 do |
425 |
if TabSimulP[k].Ok
|
426 |
then
|
427 |
begin
|
428 |
LinePerf[k] := TLineSeries.Create (Graph); |
429 |
LinePerf[k].ParentChart := Graph; |
430 |
case FSimulP.PC.ActivePageIndex of |
431 |
1: // Comparaison |
432 |
LinePerf[k].Title := Format('Simulation %d', [k]);
|
433 |
2: // Sensibilit? |
434 |
if FSimulP.CBVariable.ItemIndex = 6 |
435 |
then // Gaspillage |
436 |
if TabSimulP[k].Variation > 0 |
437 |
then
|
438 |
LinePerf[k].Title := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
439 |
else
|
440 |
LinePerf[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
441 |
else
|
442 |
LinePerf[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
443 |
end;
|
444 |
LinePerf[k].SeriesColor := TabColor[k]; |
445 |
LinePerf[k].LinePen.Color := LinePerf[k].SeriesColor; |
446 |
LinePerf[k].LinePen.Width := 2;
|
447 |
Graph.AddSeries (LinePerf[k]); |
448 |
end;
|
449 |
// BarPerf : s?rie (barre) graphique
|
450 |
BarPerf := TBarSeries.Create(Graph); |
451 |
BarPerf.ParentChart := Graph; |
452 |
// BarPerf.Title := ' ';
|
453 |
BarPerf.SeriesColor := clTeal; |
454 |
BarPerf.BarPen.Color := BarPerf.SeriesColor; |
455 |
//BarPerf.Marks.Visible := FALSE;
|
456 |
BarPerf.Marks.ArrowLength := -16;
|
457 |
BarPerf.Marks.Arrow.Visible := FALSE; |
458 |
BarPerf.Marks.Brush.Style := bsClear; |
459 |
BarPerf.Marks.Frame.Visible := FALSE; |
460 |
BarPerf.Marks.Style := smsValue; |
461 |
//BarPerf.AutoMarkPosition := FALSE;
|
462 |
Graph.AddSeries(BarPerf); |
463 |
end;
|
464 |
|
465 |
procedure TFCompSimulP.AffGraphPerf;
|
466 |
var
|
467 |
j, k: integer; |
468 |
cumul: double; |
469 |
|
470 |
// Abscisse
|
471 |
function PerfX: double;
|
472 |
begin
|
473 |
case CBPerf1.ItemIndex of |
474 |
0: // Affichage dynamique |
475 |
case CBPerf2.ItemIndex of |
476 |
0: // Poids vif |
477 |
result := PResSimulP.TabResult[2, j];
|
478 |
1: // Age |
479 |
result := PResSimulP.TabResult[1, j];
|
480 |
2: // Jours |
481 |
result := j; |
482 |
3: // Semaines |
483 |
result := j / 7;
|
484 |
else
|
485 |
result := 0;
|
486 |
end;
|
487 |
else
|
488 |
result := 0;
|
489 |
end;
|
490 |
end;
|
491 |
|
492 |
// Ordonn?e
|
493 |
function PerfY: double;
|
494 |
var
|
495 |
h: integer; |
496 |
v, conso, gain: double; |
497 |
begin
|
498 |
case CBPerf1.ItemIndex of |
499 |
0: // Affichage dynamique |
500 |
case CBPerf3.ItemIndex of |
501 |
0: // Body weight |
502 |
case CBPerf4.ItemIndex of |
503 |
0: // Weight gain (g/d) |
504 |
result := PResSimulP.TabResult[84, j] * 1000; |
505 |
1: // Body weight (kg) |
506 |
result := PResSimulP.TabResult[2, j];
|
507 |
else
|
508 |
result := 0;
|
509 |
end;
|
510 |
1: // Time |
511 |
case CBPerf4.ItemIndex of |
512 |
0: // Age (d) |
513 |
result := PResSimulP.TabResult[1, j];
|
514 |
else
|
515 |
result := 0;
|
516 |
end;
|
517 |
2: // Feed usage |
518 |
case CBPerf4.ItemIndex of |
519 |
0: // Feed usage (kg/d) |
520 |
result := PResSimulP.TabResult[113, j];
|
521 |
1: // Feed usage (kg DM/d) |
522 |
result := PResSimulP.TabResult[106, j] * PResSimulP.TabResult[113, j]; |
523 |
2: // Feed usage (MJ DE/d) |
524 |
result := PResSimulP.TabResult[109, j] * PResSimulP.TabResult[113, j]; |
525 |
3: // Feed usage (MJ ME/d) |
526 |
result := PResSimulP.TabResult[89, j] * PResSimulP.TabResult[113, j]; |
527 |
4: // Feed usage (MJ NE/d) |
528 |
result := PResSimulP.TabResult[90, j] * PResSimulP.TabResult[113, j]; |
529 |
5: // Total feed usage (kg) |
530 |
begin
|
531 |
cumul := cumul + PResSimulP.TabResult[113, j];
|
532 |
result := cumul; |
533 |
end;
|
534 |
6: // Total feed usage (kg DM) |
535 |
begin
|
536 |
cumul := cumul + PResSimulP.TabResult[106, j] * PResSimulP.TabResult[113, j]; |
537 |
result := cumul; |
538 |
end;
|
539 |
7: // Total feed usage (MJ DE) |
540 |
begin
|
541 |
cumul := cumul + PResSimulP.TabResult[109, j] * PResSimulP.TabResult[113, j]; |
542 |
result := cumul; |
543 |
end;
|
544 |
8: // Total feed usage (MJ ME) |
545 |
begin
|
546 |
cumul := cumul + PResSimulP.TabResult[89, j] * PResSimulP.TabResult[113, j]; |
547 |
result := cumul; |
548 |
end;
|
549 |
9: // Total feed usage (MJ NE) |
550 |
begin
|
551 |
cumul := cumul + PResSimulP.TabResult[90, j] * PResSimulP.TabResult[113, j]; |
552 |
result := cumul; |
553 |
end;
|
554 |
else
|
555 |
result := 0;
|
556 |
end;
|
557 |
3: // Feed wastage |
558 |
case CBPerf4.ItemIndex of |
559 |
0: // Feed wastage (%) |
560 |
result := PResSimulP.TabResult[112, j] * 100; |
561 |
1: // Total feed wastage (kg) |
562 |
begin
|
563 |
cumul := cumul + PResSimulP.TabResult[113, j] - PResSimulP.TabResult[11, j]; |
564 |
result := cumul; |
565 |
end;
|
566 |
else
|
567 |
result := 0;
|
568 |
end;
|
569 |
4: // Feed intake |
570 |
case CBPerf4.ItemIndex of |
571 |
0: // Feed intake (kg/d) |
572 |
result := PResSimulP.TabResult[11, j];
|
573 |
1: // Feed intake (kg DM/d) |
574 |
result := PResSimulP.TabResult[106, j] * PResSimulP.TabResult[11, j]; |
575 |
2: // Feed intake (MJ DE/d) |
576 |
result := PResSimulP.TabResult[109, j] * PResSimulP.TabResult[11, j]; |
577 |
3: // Feed intake (MJ ME/d) |
578 |
result := PResSimulP.TabResult[89, j] * PResSimulP.TabResult[11, j]; |
579 |
4: // Feed intake (MJ NE/d) |
580 |
result := PResSimulP.TabResult[90, j] * PResSimulP.TabResult[11, j]; |
581 |
5: // Total feed intake (kg) |
582 |
begin
|
583 |
cumul := cumul + PResSimulP.TabResult[11, j];
|
584 |
result := cumul; |
585 |
end;
|
586 |
6: // Total feed intake (kg DM) |
587 |
begin
|
588 |
cumul := cumul + PResSimulP.TabResult[106, j] * PResSimulP.TabResult[11, j]; |
589 |
result := cumul; |
590 |
end;
|
591 |
7: // Total feed intake (MJ DE) |
592 |
begin
|
593 |
cumul := cumul + PResSimulP.TabResult[109, j] * PResSimulP.TabResult[11, j]; |
594 |
result := cumul; |
595 |
end;
|
596 |
8: // Total feed intake (MJ ME) |
597 |
begin
|
598 |
cumul := cumul + PResSimulP.TabResult[89, j] * PResSimulP.TabResult[11, j]; |
599 |
result := cumul; |
600 |
end;
|
601 |
9: // Total feed intake (MJ NE) |
602 |
begin
|
603 |
cumul := cumul + PResSimulP.TabResult[90, j] * PResSimulP.TabResult[11, j]; |
604 |
result := cumul; |
605 |
end;
|
606 |
else
|
607 |
result := 0;
|
608 |
end;
|
609 |
5: // Feed:Gain |
610 |
if PResSimulP.TabResult[84, j] <> 0 |
611 |
then
|
612 |
case CBPerf4.ItemIndex of |
613 |
0: // Feed:Gain (kg/kg) |
614 |
result := PResSimulP.TabResult[113, j] / PResSimulP.TabResult[84, j]; |
615 |
1: // Feed:Gain (kg DM/kg) |
616 |
result := (PResSimulP.TabResult[106, j] * PResSimulP.TabResult[113, j]) / PResSimulP.TabResult[84, j]; |
617 |
2: // Feed:Gain (MJ DE/kg) |
618 |
result := (PResSimulP.TabResult[109, j] * PResSimulP.TabResult[113, j]) / PResSimulP.TabResult[84, j]; |
619 |
3: // Feed:Gain (MJ ME/kg) |
620 |
result := (PResSimulP.TabResult[89, j] * PResSimulP.TabResult[113, j]) / PResSimulP.TabResult[84, j]; |
621 |
4: // Feed:Gain (MJ NE/kg) |
622 |
result := (PResSimulP.TabResult[90, j] * PResSimulP.TabResult[113, j]) / PResSimulP.TabResult[84, j]; |
623 |
else
|
624 |
result := 0;
|
625 |
end
|
626 |
else
|
627 |
result := 0;
|
628 |
6: // Gain:Feed |
629 |
case CBPerf4.ItemIndex of |
630 |
0: // Gain:Feed (kg/kg) |
631 |
if PResSimulP.TabResult[113, j] <> 0 |
632 |
then
|
633 |
result := PResSimulP.TabResult[84, j] / PResSimulP.TabResult[113, j] |
634 |
else
|
635 |
result := 0;
|
636 |
1: // Gain:Feed (kg/kg DM) |
637 |
if (PResSimulP.TabResult[113, j] <> 0) and (PResSimulP.TabResult[106, j] <> 0) |
638 |
then
|
639 |
result := PResSimulP.TabResult[84, j] / (PResSimulP.TabResult[106, j] * PResSimulP.TabResult[113, j]) |
640 |
else
|
641 |
result := 0;
|
642 |
2: // Gain:Feed (kg/MJ DE) |
643 |
if (PResSimulP.TabResult[113, j] <> 0) and (PResSimulP.TabResult[109, j] <> 0) |
644 |
then
|
645 |
result := PResSimulP.TabResult[84, j] / (PResSimulP.TabResult[109, j] * PResSimulP.TabResult[113, j]) |
646 |
else
|
647 |
result := 0;
|
648 |
3: // Gain:Feed (kg/MJ ME) |
649 |
if (PResSimulP.TabResult[113, j] <> 0) and (PResSimulP.TabResult[89, j] <> 0) |
650 |
then
|
651 |
result := PResSimulP.TabResult[84, j] / (PResSimulP.TabResult[89, j] * PResSimulP.TabResult[113, j]) |
652 |
else
|
653 |
result := 0;
|
654 |
4: // Gain:Feed (kg/MJ NE) |
655 |
if (PResSimulP.TabResult[113, j] <> 0) and (PResSimulP.TabResult[90, j] <> 0) |
656 |
then
|
657 |
result := PResSimulP.TabResult[84, j] / (PResSimulP.TabResult[90, j] * PResSimulP.TabResult[113, j]) |
658 |
else
|
659 |
result := 0;
|
660 |
else
|
661 |
result := 0;
|
662 |
end;
|
663 |
7: // Protein |
664 |
case CBPerf4.ItemIndex of |
665 |
0: // Protein deposition (g/d) |
666 |
result := PResSimulP.TabResult[79, j];
|
667 |
1: // Protein mass (kg) |
668 |
result := PResSimulP.TabResult[49, j];
|
669 |
2: // Protein content (% of BW gain) |
670 |
if PResSimulP.TabResult[84, j] <> 0 |
671 |
then
|
672 |
result := (PResSimulP.TabResult[79, j] / 1000) / PResSimulP.TabResult[84, j] * 100 |
673 |
else
|
674 |
result := 0;
|
675 |
3: // Protein content (% in BW) |
676 |
if PResSimulP.TabResult[2, j] <> 0 |
677 |
then
|
678 |
result := PResSimulP.TabResult[49, j] / PResSimulP.TabResult[2, j] * 100 |
679 |
else
|
680 |
result := 0;
|
681 |
else
|
682 |
result := 0;
|
683 |
end;
|
684 |
8: // Lipid |
685 |
case CBPerf4.ItemIndex of |
686 |
0: // Lipid deposition (g/d) |
687 |
result := PResSimulP.TabResult[80, j];
|
688 |
1: // Lipid mass (kg) |
689 |
result := PResSimulP.TabResult[50, j];
|
690 |
2: // Lipid content (% of BW gain) |
691 |
if PResSimulP.TabResult[84, j] <> 0 |
692 |
then
|
693 |
result := (PResSimulP.TabResult[80, j] / 1000) / PResSimulP.TabResult[84, j] * 100 |
694 |
else
|
695 |
result := 0;
|
696 |
3: // Lipid content (% in BW) |
697 |
if PResSimulP.TabResult[2, j] <> 0 |
698 |
then
|
699 |
result := PResSimulP.TabResult[50, j] / PResSimulP.TabResult[2, j] * 100 |
700 |
else
|
701 |
result := 0;
|
702 |
else
|
703 |
result := 0;
|
704 |
end;
|
705 |
9: // Carcass |
706 |
case CBPerf4.ItemIndex of |
707 |
0: // Dressing percentage |
708 |
result := CalcRC(PResSimulP.TabResult[2, PResSimulP.NbJSim], CalcRCStd(PProfilP.PVFin, PProfilP.Carcasse), PResSimulP.TabResult[2, j]) * 100; |
709 |
1: // Backfat thickness |
710 |
if FatInfo = 0 |
711 |
then // P2 |
712 |
result := CalcP2(PResSimulP.TabResult[50, j])
|
713 |
else // User defined |
714 |
result := CalcUserFat(PResSimulP.TabResult[48, j], PResSimulP.TabResult[49, j], PResSimulP.TabResult[50, j]); |
715 |
2: // Lean meat percentage |
716 |
if LeanInfo = 0 |
717 |
then // TMP |
718 |
result := CalcTMP(PResSimulP.TabResult[48, j], PResSimulP.TabResult[49, j], PResSimulP.TabResult[50, j]) |
719 |
else // User defined |
720 |
result := CalcUserLean(PResSimulP.TabResult[48, j], PResSimulP.TabResult[49, j], PResSimulP.TabResult[50, j]); |
721 |
else
|
722 |
result := 0;
|
723 |
end;
|
724 |
else
|
725 |
result := 0;
|
726 |
end;
|
727 |
1: // Affichage global |
728 |
begin
|
729 |
v := 0;
|
730 |
case CBPerf3Global.ItemIndex of |
731 |
0: // Body weight |
732 |
case CBPerf4.ItemIndex of |
733 |
0: // Weight gain (g/d) |
734 |
for h := 1 to PresSimulP.NbJSim do |
735 |
v := v + PResSimulP.TabResult[84, h] * 1000 / PresSimulP.NbJSim; |
736 |
1: // Weight gain (kg) |
737 |
for h := 1 to PresSimulP.NbJSim do |
738 |
v := v + PResSimulP.TabResult[84, h];
|
739 |
end;
|
740 |
1: // Time |
741 |
case CBPerf4.ItemIndex of |
742 |
0: // Duration (d) |
743 |
v := PresSimulP.NbJSim; |
744 |
end;
|
745 |
2: // Feed usage |
746 |
case CBPerf4.ItemIndex of |
747 |
0: // Feed usage (kg/d) |
748 |
for h := 1 to PresSimulP.NbJSim do |
749 |
v := v + PResSimulP.TabResult[113, h] / PresSimulP.NbJSim;
|
750 |
1: // Feed usage (kg DM/d) |
751 |
for h := 1 to PresSimulP.NbJSim do |
752 |
v := v + PResSimulP.TabResult[106, h] * PResSimulP.TabResult[113, h] / PresSimulP.NbJSim; |
753 |
2: // Feed usage (MJ DE/d) |
754 |
for h := 1 to PresSimulP.NbJSim do |
755 |
v := v + PResSimulP.TabResult[109, h] * PResSimulP.TabResult[113, h] / PresSimulP.NbJSim; |
756 |
3: // Feed usage (MJ ME/d) |
757 |
for h := 1 to PresSimulP.NbJSim do |
758 |
v := v + PResSimulP.TabResult[89, h] * PResSimulP.TabResult[113, h] / PresSimulP.NbJSim; |
759 |
4: // Feed usage (MJ NE/d) |
760 |
for h := 1 to PresSimulP.NbJSim do |
761 |
v := v + PResSimulP.TabResult[90, h] * PResSimulP.TabResult[113, h] / PresSimulP.NbJSim; |
762 |
5: // Total feed usage (kg) |
763 |
for h := 1 to PresSimulP.NbJSim do |
764 |
v := v + PResSimulP.TabResult[113, h];
|
765 |
6: // Total feed usage (kg DM) |
766 |
for h := 1 to PresSimulP.NbJSim do |
767 |
v := v + PResSimulP.TabResult[106, h] * PResSimulP.TabResult[113, h]; |
768 |
7: // Total feed usage (MJ DE) |
769 |
for h := 1 to PresSimulP.NbJSim do |
770 |
v := v + PResSimulP.TabResult[109, h] * PResSimulP.TabResult[113, h]; |
771 |
8: // Total feed usage (MJ ME) |
772 |
for h := 1 to PresSimulP.NbJSim do |
773 |
v := v + PResSimulP.TabResult[89, h] * PResSimulP.TabResult[113, h]; |
774 |
9: // Total feed usage (MJ NE) |
775 |
for h := 1 to PresSimulP.NbJSim do |
776 |
v := v + PResSimulP.TabResult[90, h] * PResSimulP.TabResult[113, h]; |
777 |
end;
|
778 |
3: // Feed wastage |
779 |
case CBPerf4.ItemIndex of |
780 |
0: // Feed wastage (%) |
781 |
for h := 1 to PresSimulP.NbJSim do |
782 |
v := v + PResSimulP.TabResult[112, h] * 100 / PresSimulP.NbJSim; |
783 |
1: // Total feed wastage (kg) |
784 |
for h := 1 to PresSimulP.NbJSim do |
785 |
v := v + PResSimulP.TabResult[113, h] - PResSimulP.TabResult[11, h]; |
786 |
end;
|
787 |
4: // Feed intake |
788 |
case CBPerf4.ItemIndex of |
789 |
0: // Feed intake (kg/d) |
790 |
for h := 1 to PresSimulP.NbJSim do |
791 |
v := v + PResSimulP.TabResult[11, h] / PresSimulP.NbJSim;
|
792 |
1: // Feed intake (kg DM/d) |
793 |
for h := 1 to PresSimulP.NbJSim do |
794 |
v := v + PResSimulP.TabResult[106, h] * PResSimulP.TabResult[11, h] / PresSimulP.NbJSim; |
795 |
2: // Feed intake (MJ DE/d) |
796 |
for h := 1 to PresSimulP.NbJSim do |
797 |
v := v + PResSimulP.TabResult[109, h] * PResSimulP.TabResult[11, h] / PresSimulP.NbJSim; |
798 |
3: // Feed intake (MJ ME/d) |
799 |
for h := 1 to PresSimulP.NbJSim do |
800 |
v := v + PResSimulP.TabResult[89, h] * PResSimulP.TabResult[11, h] / PresSimulP.NbJSim; |
801 |
4: // Feed intake (MJ NE/d) |
802 |
for h := 1 to PresSimulP.NbJSim do |
803 |
v := v + PResSimulP.TabResult[90, h] * PResSimulP.TabResult[11, h] / PresSimulP.NbJSim; |
804 |
5: // Total feed intake (kg) |
805 |
for h := 1 to PresSimulP.NbJSim do |
806 |
v := v + PResSimulP.TabResult[11, h];
|
807 |
6: // Total feed intake (kg DM) |
808 |
for h := 1 to PresSimulP.NbJSim do |
809 |
v := v + PResSimulP.TabResult[106, h] * PResSimulP.TabResult[11, h]; |
810 |
7: // Total feed intake (MJ DE) |
811 |
for h := 1 to PresSimulP.NbJSim do |
812 |
v := v + PResSimulP.TabResult[109, h] * PResSimulP.TabResult[11, h]; |
813 |
8: // Total feed intake (MJ ME) |
814 |
for h := 1 to PresSimulP.NbJSim do |
815 |
v := v + PResSimulP.TabResult[89, h] * PResSimulP.TabResult[11, h]; |
816 |
9: // Total feed intake (MJ NE) |
817 |
for h := 1 to PresSimulP.NbJSim do |
818 |
v := v + PResSimulP.TabResult[90, h] * PResSimulP.TabResult[11, h]; |
819 |
end;
|
820 |
5: // Feed:Gain |
821 |
begin
|
822 |
conso := 0;
|
823 |
for h := 1 to PresSimulP.NbJSim do |
824 |
case CBPerf4.ItemIndex of |
825 |
0: // Feed:Gain (kg/kg) |
826 |
conso := conso + PResSimulP.TabResult[113, h];
|
827 |
1: // Feed:Gain (kg DM/kg) |
828 |
conso := conso + PResSimulP.TabResult[106, h] * PResSimulP.TabResult[113, h]; |
829 |
2: // Feed:Gain (MJ DE/kg) |
830 |
conso := conso + PResSimulP.TabResult[109, h] * PResSimulP.TabResult[113, h]; |
831 |
3: // Feed:Gain (MJ ME/kg) |
832 |
conso := conso + PResSimulP.TabResult[89, h] * PResSimulP.TabResult[113, h]; |
833 |
4: // Feed:Gain (MJ NE/kg) |
834 |
conso := conso + PResSimulP.TabResult[90, h] * PResSimulP.TabResult[113, h]; |
835 |
end;
|
836 |
gain := 0;
|
837 |
for h := 1 to PresSimulP.NbJSim do |
838 |
gain := gain + PResSimulP.TabResult[84, h];
|
839 |
if gain <> 0 |
840 |
then
|
841 |
v := conso / gain; |
842 |
end;
|
843 |
6: // Gain:Feed |
844 |
begin
|
845 |
gain := 0;
|
846 |
for h := 1 to PresSimulP.NbJSim do |
847 |
gain := gain + PResSimulP.TabResult[84, h];
|
848 |
conso := 0;
|
849 |
for h := 1 to PresSimulP.NbJSim do |
850 |
case CBPerf4.ItemIndex of |
851 |
0: // Gain:Feed (kg/kg) |
852 |
conso := conso + PResSimulP.TabResult[113, h];
|
853 |
1: // Gain:Feed (kg/kg DM) |
854 |
conso := conso + PResSimulP.TabResult[106, h] * PResSimulP.TabResult[113, h]; |
855 |
2: // Gain:Feed (kg/MJ DE) |
856 |
conso := conso + PResSimulP.TabResult[109, h] * PResSimulP.TabResult[113, h]; |
857 |
3: // Gain:Feed (kg/MJ ME) |
858 |
conso := conso + PResSimulP.TabResult[89, h] * PResSimulP.TabResult[113, h]; |
859 |
4: // Gain:Feed (kg/MJ NE) |
860 |
conso := conso + PResSimulP.TabResult[90, h] * PResSimulP.TabResult[113, h]; |
861 |
end;
|
862 |
if conso <> 0 |
863 |
then
|
864 |
v := gain / conso; |
865 |
end;
|
866 |
7: // Protein |
867 |
case CBPerf4.ItemIndex of |
868 |
0: // Protein deposition (g/d) |
869 |
for h := 1 to PresSimulP.NbJSim do |
870 |
v := v + PResSimulP.TabResult[79, h] / PresSimulP.NbJSim;
|
871 |
1: // Protein deposition (kg) |
872 |
for h := 1 to PresSimulP.NbJSim do |
873 |
v := v + PResSimulP.TabResult[79, h] / 1000; |
874 |
end;
|
875 |
8: // Lipid |
876 |
case CBPerf4.ItemIndex of |
877 |
0: // Lipid deposition (g/d) |
878 |
for h := 1 to PresSimulP.NbJSim do |
879 |
v := v + PResSimulP.TabResult[80, h] / PresSimulP.NbJSim;
|
880 |
1: // Lipid deposition (kg) |
881 |
for h := 1 to PresSimulP.NbJSim do |
882 |
v := v + PResSimulP.TabResult[80, h] / 1000; |
883 |
end;
|
884 |
end;
|
885 |
result := v; |
886 |
end;
|
887 |
else
|
888 |
result := 0;
|
889 |
end;
|
890 |
end;
|
891 |
|
892 |
// AffGraphPerf
|
893 |
begin
|
894 |
ResetGraph; |
895 |
Graph.Legend.Inverted := FALSE; |
896 |
Graph.Title.Text.Add(Format('%s (%s)', [TabPerf.Caption, CBPerf1.Text]));
|
897 |
case CBPerf1.ItemIndex of |
898 |
0: // Affichage dynamique |
899 |
begin
|
900 |
Graph.LeftAxis.Title.Caption := CBPerf4.Text; |
901 |
Graph.BottomAxis.Title.Caption := CBPerf2.Text; |
902 |
// Affichage des lignes
|
903 |
for k := 1 to 5 do |
904 |
if TabSimulP[k].Ok
|
905 |
then
|
906 |
begin
|
907 |
LinePerf[k].Active := TRUE; |
908 |
LinePerf[k].Clear; |
909 |
PResSimulP := TabSimulP[k].Result; |
910 |
if TabSimulP[k].Profil = -1 |
911 |
then // Profil de la simulation |
912 |
PProfilP := ListProfilP[FindIdxProfilP(FindNomProfilP(PSimulP.Profil))] |
913 |
else
|
914 |
PProfilP := ListProfilP[FindIdxProfilP(FindNomProfilP(TabSimulP[k].Profil))]; |
915 |
cumul := 0;
|
916 |
for j := 1 to PresSimulP.NbJSim do |
917 |
LinePerf[k].AddXY(PerfX, PerfY, '', clTeeColor);
|
918 |
end;
|
919 |
if CBPerf2.ItemIndex = 3 |
920 |
then // Dur?e (semaine) |
921 |
Graph.BottomAxis.Increment := 1
|
922 |
else
|
923 |
Graph.BottomAxis.Increment := 10;
|
924 |
end;
|
925 |
1: // Affichage global |
926 |
begin
|
927 |
Graph.LeftAxis.Title.Caption := CBPerf4.Text; |
928 |
Graph.Legend.Visible := FALSE; |
929 |
case FSimulP.PC.ActivePageIndex of |
930 |
1: // Comparaison |
931 |
Graph.BottomAxis.Title.Caption := 'Simulation';
|
932 |
2: // Sensibilit? |
933 |
Graph.BottomAxis.Title.Caption := 'Variation';
|
934 |
end;
|
935 |
// Affichage de la barre
|
936 |
BarPerf.Active := TRUE; |
937 |
BarPerf.Clear; |
938 |
for k := 1 to 5 do |
939 |
if TabSimulP[k].Ok
|
940 |
then
|
941 |
begin
|
942 |
PResSimulP := TabSimulP[k].Result; |
943 |
if TabSimulP[k].Profil = -1 |
944 |
then // Profil de la simulation |
945 |
PProfilP := ListProfilP[FindIdxProfilP(FindNomProfilP(PSimulP.Profil))] |
946 |
else
|
947 |
PProfilP := ListProfilP[FindIdxProfilP(FindNomProfilP(TabSimulP[k].Profil))]; |
948 |
case FSimulP.PC.ActivePageIndex of |
949 |
1: // Comparaison |
950 |
BarPerf.AddBar (PerfY, Format('%d', [k]), clTeeColor);
|
951 |
2: // Sensibilit? |
952 |
if FSimulP.CBVariable.ItemIndex = 6 |
953 |
then // Gaspillage |
954 |
if TabSimulP[k].Variation > 0 |
955 |
then
|
956 |
BarPerf.AddBar(PerfY, Format('+%1.0f%%', [TabSimulP[k].Variation * 100]), clTeeColor) |
957 |
else
|
958 |
BarPerf.AddBar(PerfY, Format('%1.0f%%', [TabSimulP[k].Variation * 100]), clTeeColor) |
959 |
else
|
960 |
BarPerf.AddBar(PerfY, Format('%1.0f %%', [TabSimulP[k].Variation * 100]), clTeeColor); |
961 |
end;
|
962 |
end;
|
963 |
BarPerf.ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
964 |
end;
|
965 |
end;
|
966 |
AjustEchelle(Graph); |
967 |
end;
|
968 |
|
969 |
procedure TFCompSimulP.CBPerf1Change(Sender: TObject);
|
970 |
begin
|
971 |
CBPerf2.Visible := CBPerf1.ItemIndex = 0;
|
972 |
CBPerf3.Visible := CBPerf1.ItemIndex = 0;
|
973 |
CBPerf3Global.Visible := CBPerf1.ItemIndex = 1;
|
974 |
CBPerf3Change(nil);
|
975 |
end;
|
976 |
|
977 |
procedure TFCompSimulP.CBPerf2Change(Sender: TObject);
|
978 |
begin
|
979 |
AffGraphPerf; |
980 |
end;
|
981 |
|
982 |
procedure TFCompSimulP.CBPerf3Change(Sender: TObject);
|
983 |
begin
|
984 |
CBPerf4.Items.Clear; |
985 |
case CBPerf1.ItemIndex of |
986 |
0: // Affichage dynamique |
987 |
case CBPerf3.ItemIndex of |
988 |
0: // Body weight |
989 |
begin
|
990 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Weight gain'), _('g'), _('d')])); |
991 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Body weight'), _('kg')])); |
992 |
end;
|
993 |
1: // Time |
994 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Age'), _('d')])); |
995 |
2: // Feed usage |
996 |
begin
|
997 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('kg'), _('d')])); |
998 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('kg DM'), _('d')])); |
999 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('MJ DE'), _('d')])); |
1000 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('MJ ME'), _('d')])); |
1001 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('MJ NE'), _('d')])); |
1002 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('kg')])); |
1003 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('kg DM')])); |
1004 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('MJ DE')])); |
1005 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('MJ ME')])); |
1006 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('MJ NE')])); |
1007 |
end;
|
1008 |
3: // Feed wastage |
1009 |
begin
|
1010 |
CBPerf4.Items.Add(Format('%s (%%)', [_('Feed wastage')])); |
1011 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed wastage'), _('kg')])); |
1012 |
end;
|
1013 |
4: // Feed intake |
1014 |
begin
|
1015 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('kg'), _('d')])); |
1016 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('kg DM'), _('d')])); |
1017 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('MJ DE'), _('d')])); |
1018 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('MJ ME'), _('d')])); |
1019 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('MJ NE'), _('d')])); |
1020 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('kg')])); |
1021 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('kg DM')])); |
1022 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('MJ DE')])); |
1023 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('MJ ME')])); |
1024 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('MJ NE')])); |
1025 |
end;
|
1026 |
5: // Feed:Gain |
1027 |
begin
|
1028 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('kg'), _('kg')])); |
1029 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('kg DM'), _('kg')])); |
1030 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('MJ DE'), _('kg')])); |
1031 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('MJ ME'), _('kg')])); |
1032 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('MJ NE'), _('kg')])); |
1033 |
end;
|
1034 |
6: // Gain:Feed |
1035 |
begin
|
1036 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('kg')])); |
1037 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('kg DM')])); |
1038 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('MJ DE')])); |
1039 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('MJ ME')])); |
1040 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('MJ NE')])); |
1041 |
end;
|
1042 |
7: // Protein |
1043 |
begin
|
1044 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Protein deposition'), _('g'), _('d')])); |
1045 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Protein mass'), _('kg')])); |
1046 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Protein content'), _('% BW gain')])); |
1047 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Protein content'), _('% BW')])); |
1048 |
end;
|
1049 |
8: // Lipid |
1050 |
begin
|
1051 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Lipid deposition'), _('g'), _('d')])); |
1052 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Lipid mass'), _('kg')])); |
1053 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Lipid content'), _('% BW gain')])); |
1054 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Lipid content'), _('% BW')])); |
1055 |
end;
|
1056 |
9: // Carcass |
1057 |
begin
|
1058 |
CBPerf4.Items.Add(_('Dressing percentage'));
|
1059 |
if FatInfo = 0 |
1060 |
then // P2 |
1061 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Backfat thickness'), _('mm')])) |
1062 |
else // User defined |
1063 |
if Length(UserFatLongName) = 0 |
1064 |
then
|
1065 |
CBPerf4.Items.Add(Format('%s (%s)', [_('User-defined backfat thickness'), _('mm')])) |
1066 |
else
|
1067 |
CBPerf4.Items.Add(Format('%s (%s)', [UserFatLongName, _('mm')])); |
1068 |
if LeanInfo = 0 |
1069 |
then // TMP |
1070 |
CBPerf4.Items.Add(Format('%s (%%)', [_('Lean meat')])) |
1071 |
else // User defined |
1072 |
if Length(UserLeanLongName) = 0 |
1073 |
then
|
1074 |
CBPerf4.Items.Add(Format('%s (%%)', [_('User-defined lean meat')])) |
1075 |
else
|
1076 |
CBPerf4.Items.Add(Format('%s (%%)', [UserLeanLongName]));
|
1077 |
end;
|
1078 |
end;
|
1079 |
1: // Affichage global |
1080 |
case CBPerf3Global.ItemIndex of |
1081 |
0: // Body weight |
1082 |
begin
|
1083 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Weight gain'), _('g'), _('d')])); |
1084 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Weight gain'), _('kg')])); |
1085 |
end;
|
1086 |
1: // Time |
1087 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Duration'), _('d')])); |
1088 |
2: // Feed usage |
1089 |
begin
|
1090 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('kg'), _('d')])); |
1091 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('kg DM'), _('d')])); |
1092 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('MJ DE'), _('d')])); |
1093 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('MJ ME'), _('d')])); |
1094 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed usage'), _('MJ NE'), _('d')])); |
1095 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('kg')])); |
1096 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('kg DM')])); |
1097 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('MJ DE')])); |
1098 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('MJ ME')])); |
1099 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed usage'), _('MJ NE')])); |
1100 |
end;
|
1101 |
3: // Feed wastage |
1102 |
begin
|
1103 |
CBPerf4.Items.Add(Format('%s (%%)', [_('Feed wastage')])); |
1104 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed wastage'), _('kg')])); |
1105 |
end;
|
1106 |
4: // Feed intake |
1107 |
begin
|
1108 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('kg'), _('d')])); |
1109 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('kg DM'), _('d')])); |
1110 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('MJ DE'), _('d')])); |
1111 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('MJ ME'), _('d')])); |
1112 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Feed intake'), _('MJ NE'), _('d')])); |
1113 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('kg')])); |
1114 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('kg DM')])); |
1115 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('MJ DE')])); |
1116 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('MJ ME')])); |
1117 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Total feed intake'), _('MJ NE')])); |
1118 |
end;
|
1119 |
5: // Feed:Gain |
1120 |
begin
|
1121 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('kg'), _('kg')])); |
1122 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('kg DM'), _('kg')])); |
1123 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('MJ DE'), _('kg')])); |
1124 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('MJ ME'), _('kg')])); |
1125 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('F:G'), _('MJ NE'), _('kg')])); |
1126 |
end;
|
1127 |
6: // Gain:Feed |
1128 |
begin
|
1129 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('kg')])); |
1130 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('kg DM')])); |
1131 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('MJ DE')])); |
1132 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('MJ ME')])); |
1133 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('G:F'), _('kg'), _('MJ NE')])); |
1134 |
end;
|
1135 |
7: // Protein |
1136 |
begin
|
1137 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Protein deposition'), _('g'), _('d')])); |
1138 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Protein deposition'), _('kg')])); |
1139 |
end;
|
1140 |
8: // Lipid |
1141 |
begin
|
1142 |
CBPerf4.Items.Add(Format('%s (%s/%s)', [_('Lipid deposition'), _('g'), _('d')])); |
1143 |
CBPerf4.Items.Add(Format('%s (%s)', [_('Lipid deposition'), _('kg')])); |
1144 |
end;
|
1145 |
end;
|
1146 |
end;
|
1147 |
CBPerf4.ItemIndex := 0;
|
1148 |
AffGraphPerf; |
1149 |
end;
|
1150 |
|
1151 |
procedure TFCompSimulP.CBPerf4Change(Sender: TObject);
|
1152 |
begin
|
1153 |
AffGraphPerf; |
1154 |
end;
|
1155 |
|
1156 |
/////////////////
|
1157 |
// Aliment //
|
1158 |
/////////////////
|
1159 |
procedure TFCompSimulP.InitAli;
|
1160 |
var
|
1161 |
i, j, k: integer; |
1162 |
nom: string;
|
1163 |
begin
|
1164 |
// ListAli : liste des aliments utilis?s
|
1165 |
ListAli := TStringList.Create; |
1166 |
for k := 1 to 5 do // 5 simulations |
1167 |
if TabSimulP[k].Ok
|
1168 |
then
|
1169 |
for i := 1 to 2 do // 2 aliments |
1170 |
for j := 1 to TabSimulP[k].Result.NbJSim do |
1171 |
if TabSimulP[k].Result.TabResult[8 + i, j] > 0 |
1172 |
then
|
1173 |
begin
|
1174 |
nom := FindNomAliment(Trunc(TabSimulP[k].Result.TabResult[6 + i, j]));
|
1175 |
if ListAli.IndexOf (nom) = -1 |
1176 |
then
|
1177 |
ListAli.Add(nom); |
1178 |
end;
|
1179 |
// BarAli : s?ries (barres) graphiques
|
1180 |
SetLength(BarAli, ListAli.Count); |
1181 |
for i := 0 to ListAli.Count - 1 do |
1182 |
begin
|
1183 |
BarAli[i] := TBarSeries.Create(Graph); |
1184 |
BarAli[i].ParentChart := Graph; |
1185 |
BarAli[i].Title := ListAli[i]; |
1186 |
BarAli[i].BarPen.Color := BarAli[i].SeriesColor; |
1187 |
//BarAli[i].Marks.Visible := FALSE;
|
1188 |
BarAli[i].Marks.ArrowLength := -16;
|
1189 |
BarAli[i].Marks.Arrow.Visible := FALSE; |
1190 |
BarAli[i].Marks.Brush.Style := bsClear; |
1191 |
BarAli[i].Marks.Frame.Visible := FALSE; |
1192 |
BarAli[i].Marks.Style := smsValue; |
1193 |
//BarAli[i].AutoMarkPosition := FALSE;
|
1194 |
Graph.AddSeries(BarAli[i]); |
1195 |
end;
|
1196 |
// ListMat : liste des mati?res premi?res utilis?es
|
1197 |
CompositionComplete := TRUE; |
1198 |
ListMat := TStringList.Create; |
1199 |
for i := 0 to ListAli.Count - 1 do |
1200 |
begin
|
1201 |
PAliment := ListAliment[FindIdxAliment(ListAli[i])]; |
1202 |
if PAliment.MP.NbMat > 0 |
1203 |
then
|
1204 |
for j := 0 to PAliment.MP.NbMat - 1 do |
1205 |
begin
|
1206 |
nom := FindNomMatiere(PAliment.MP.NumMat[j]); |
1207 |
if ListMat.IndexOf(nom) = -1 |
1208 |
then
|
1209 |
ListMat.Add(nom); |
1210 |
end
|
1211 |
else
|
1212 |
CompositionComplete := FALSE; |
1213 |
end;
|
1214 |
CBAli1.Visible := ConfAffMP and CompositionComplete;
|
1215 |
CBAli5.Items.Assign(ListMat); |
1216 |
CBAli5.ItemIndex := 0;
|
1217 |
// BarMat : s?rie (barre) graphique
|
1218 |
BarMat := TBarSeries.Create(Graph); |
1219 |
BarMat.ParentChart := Graph; |
1220 |
BarMat.SeriesColor := clTeal; |
1221 |
BarMat.BarPen.Color := BarMat.SeriesColor; |
1222 |
//BarMat.Marks.Visible := FALSE;
|
1223 |
BarMat.Marks.ArrowLength := -16;
|
1224 |
BarMat.Marks.Arrow.Visible := FALSE; |
1225 |
BarMat.Marks.Brush.Style := bsClear; |
1226 |
BarMat.Marks.Frame.Visible := FALSE; |
1227 |
BarMat.Marks.Style := smsValue; |
1228 |
Graph.AddSeries(BarMat); |
1229 |
end;
|
1230 |
|
1231 |
procedure TFCompSimulP.AffGraphAli;
|
1232 |
var
|
1233 |
i, k: integer; |
1234 |
y: double; |
1235 |
s: string;
|
1236 |
|
1237 |
// Ordonn?e (Aliments)
|
1238 |
function AliY: double;
|
1239 |
var
|
1240 |
h: integer; |
1241 |
v, d: double; |
1242 |
begin
|
1243 |
// Diviseur
|
1244 |
case CBAli3.ItemIndex of |
1245 |
0: // Quantit? |
1246 |
case CBAli4.ItemIndex of |
1247 |
1: // Dur?e |
1248 |
d := PresSimulP.NbJSim; |
1249 |
else
|
1250 |
d := 1;
|
1251 |
end;
|
1252 |
1: // Co?t |
1253 |
case CBAli4.ItemIndex of |
1254 |
1: // Dur?e |
1255 |
d := PresSimulP.NbJSim; |
1256 |
2: // GMQ |
1257 |
begin
|
1258 |
d := 0;
|
1259 |
if PresSimulP.NbJSim > 1 |
1260 |
then
|
1261 |
for h := 1 to PresSimulP.NbJSim do |
1262 |
d := d + PResSimulP.TabResult[84, h];
|
1263 |
end;
|
1264 |
3: // Aliment |
1265 |
begin
|
1266 |
d := 0;
|
1267 |
if PresSimulP.NbJSim > 1 |
1268 |
then
|
1269 |
for h := 1 to PresSimulP.NbJSim do |
1270 |
d := d + PResSimulP.TabResult[113, h];
|
1271 |
end;
|
1272 |
else
|
1273 |
d := 1;
|
1274 |
end;
|
1275 |
else
|
1276 |
d := 1;
|
1277 |
end;
|
1278 |
v := 0;
|
1279 |
if PresSimulP.NbJSim > 1 |
1280 |
then
|
1281 |
for h := 1 to PresSimulP.NbJSim do |
1282 |
begin
|
1283 |
// Aliment 1
|
1284 |
if (PResSimulP.TabResult[7, h] <> -1) and (FindNomAliment(Trunc(PresSimulP.TabResult[7, h])) = ListAli[i]) |
1285 |
then
|
1286 |
v := v + (PresSimulP.TabResult[113, h] * PresSimulP.TabResult[9, h] / 100); |
1287 |
// Aliment 2
|
1288 |
if (PResSimulP.TabResult[8, h] <> -1) and (FindNomAliment(Trunc(PresSimulP.TabResult[8, h])) = ListAli[i]) |
1289 |
then
|
1290 |
v := v + (PresSimulP.TabResult[113, h] * PresSimulP.TabResult[10, h] / 100); |
1291 |
end;
|
1292 |
if CBAli3.ItemIndex = 1 |
1293 |
then // Co?t |
1294 |
begin
|
1295 |
PAliment := ListAliment[FindIdxAliment(ListAli[i])]; |
1296 |
v := v * PAliment.Prix / 1000;
|
1297 |
end;
|
1298 |
result := v / d; |
1299 |
end;
|
1300 |
|
1301 |
// Ordonn?es (Mati?res premi?res)
|
1302 |
function MatY: double;
|
1303 |
var
|
1304 |
g, h: integer; |
1305 |
v, d: double; |
1306 |
begin
|
1307 |
// Diviseur
|
1308 |
if CBAli4.ItemIndex = 1 |
1309 |
then // Dur?e |
1310 |
d := PresSimulP.NbJSim |
1311 |
else
|
1312 |
d := 1;
|
1313 |
v := 0;
|
1314 |
for h := 1 to PResSimulP.NbJSim do |
1315 |
begin
|
1316 |
if PResSimulP.TabResult[7, h] <> -1 |
1317 |
then // Aliment 1 |
1318 |
begin
|
1319 |
PAliment := ListAliment[FindIdxAliment(FindNomAliment(Trunc(PResSimulP.TabResult[7, h])))];
|
1320 |
for g := 0 to PAliment.MP.NbMat - 1 do |
1321 |
if FindNomMatiere(PAliment.MP.NumMat[g]) = CBAli5.Text
|
1322 |
then
|
1323 |
v := v + (PAliment.MP.Qte[g] * PResSimulP.TabResult[113, h] * PResSimulP.TabResult[9, h] / 100); |
1324 |
end;
|
1325 |
if PResSimulP.TabResult[8, h] <> -1 |
1326 |
then // Aliment 2 |
1327 |
begin
|
1328 |
PAliment := ListAliment[FindIdxAliment(FindNomAliment(Trunc(PResSimulP.TabResult[8, h])))];
|
1329 |
for g := 0 to PAliment.MP.NbMat - 1 do |
1330 |
if FindNomMatiere(PAliment.MP.NumMat[g]) = CBAli5.Text
|
1331 |
then
|
1332 |
v := v + (PAliment.MP.Qte[g] * PResSimulP.TabResult[113, h] * PResSimulP.TabResult[10, h] / 100); |
1333 |
end;
|
1334 |
end;
|
1335 |
v := v / 1000; // Conversion g -> kg |
1336 |
result := v / d; |
1337 |
end;
|
1338 |
|
1339 |
// AffGraphAli
|
1340 |
begin
|
1341 |
ResetGraph; |
1342 |
if CBAli1.ItemIndex = 0 |
1343 |
then // Aliments |
1344 |
begin
|
1345 |
Graph.Legend.Inverted := TRUE; |
1346 |
Graph.Title.Text.Add(CBAli1.Text); |
1347 |
end
|
1348 |
else // Mati?res premi?res |
1349 |
begin
|
1350 |
Graph.Legend.Visible := FALSE; |
1351 |
Graph.Title.Text.Add(Format('%s - %s', [CBAli1.Text, CBAli5.Text]));
|
1352 |
end;
|
1353 |
Graph.LeftAxis.Title.Caption := Format('%s (%s)', [CBAli3.Text, CBAli4.Text]);
|
1354 |
case FSimulP.PC.ActivePageIndex of |
1355 |
1: // Comparaison |
1356 |
Graph.BottomAxis.Title.Caption := 'Simulation';
|
1357 |
2: // Sensibilit? |
1358 |
Graph.BottomAxis.Title.Caption := 'Variation';
|
1359 |
end;
|
1360 |
// Affichage des barres
|
1361 |
if CBAli1.ItemIndex = 0 |
1362 |
then // Aliments |
1363 |
begin
|
1364 |
for i := 0 to ListAli.Count - 1 do |
1365 |
BarAli[i].Active := TRUE; |
1366 |
for i := 0 to ListAli.Count - 1 do |
1367 |
BarAli[i].Clear; |
1368 |
if ((CBAli4.ItemIndex = 2) and (CBAli3.ItemIndex = 0)) |
1369 |
or ((CBAli4.ItemIndex = 4) and (CBAli3.ItemIndex = 1)) |
1370 |
then
|
1371 |
for i := 0 to ListAli.Count - 1 do |
1372 |
BarAli[i].MultiBar := mbStacked100 |
1373 |
else
|
1374 |
for i := 0 to ListAli.Count - 1 do |
1375 |
BarAli[i].MultiBar := mbStacked; |
1376 |
for i := 0 to ListAli.Count - 1 do |
1377 |
for k := 1 to 5 do |
1378 |
if TabSimulP[k].Ok
|
1379 |
then
|
1380 |
begin
|
1381 |
PResSimulP := TabSimulP[k].Result; |
1382 |
y := AliY; |
1383 |
case FSimulP.PC.ActivePageIndex of |
1384 |
1: // Comparaison |
1385 |
s := Format('%d', [k]);
|
1386 |
2: // Sensibilit? |
1387 |
if FSimulP.CBVariable.ItemIndex = 6 |
1388 |
then // Gaspillage |
1389 |
if TabSimulP[k].Variation > 0 |
1390 |
then
|
1391 |
s := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
1392 |
else
|
1393 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
1394 |
else
|
1395 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
1396 |
end;
|
1397 |
if y > 0 |
1398 |
then
|
1399 |
BarAli[i].AddBar (y, s, clTeeColor) |
1400 |
else
|
1401 |
BarAli[i].AddNull (s); |
1402 |
end;
|
1403 |
for i := 0 to ListAli.Count - 1 do |
1404 |
BarAli[i].ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
1405 |
end
|
1406 |
else // Mati?res premi?res |
1407 |
begin
|
1408 |
BarMat.Active := TRUE; |
1409 |
BarMat.Clear; |
1410 |
for k := 1 to 5 do |
1411 |
if TabSimulP[k].Ok
|
1412 |
then
|
1413 |
begin
|
1414 |
PResSimulP := TabSimulP[k].Result; |
1415 |
y := MatY; |
1416 |
case FSimulP.PC.ActivePageIndex of |
1417 |
1: // Comparaison |
1418 |
s := Format('%d', [k]);
|
1419 |
2: // Sensibilit? |
1420 |
if FSimulP.CBVariable.ItemIndex = 6 |
1421 |
then // Gaspillage |
1422 |
if TabSimulP[k].Variation > 0 |
1423 |
then
|
1424 |
s := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
1425 |
else
|
1426 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
1427 |
else
|
1428 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
1429 |
end;
|
1430 |
if y > 0 |
1431 |
then
|
1432 |
BarMat.AddBar (y, s, clTeeColor) |
1433 |
else
|
1434 |
BarMat.AddNull (s); |
1435 |
end;
|
1436 |
BarMat.ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
1437 |
end;
|
1438 |
AjustEchelle(Graph); |
1439 |
end;
|
1440 |
|
1441 |
procedure TFCompSimulP.CBAli1Change(Sender: TObject);
|
1442 |
begin
|
1443 |
CBAli3.Enabled := CBAli1.ItemIndex = 0; // Aliments |
1444 |
CBAli5.Visible := CBAli1.ItemIndex = 1; // Mati?res premi?res |
1445 |
if CBAli1.ItemIndex = 1 |
1446 |
then // Mati?res premi?res |
1447 |
CBAli3.ItemIndex := 0;
|
1448 |
CBAli3Change(nil);
|
1449 |
end;
|
1450 |
|
1451 |
procedure TFCompSimulP.CBAli3Change(Sender: TObject);
|
1452 |
begin
|
1453 |
CBAli4.Items.Clear; |
1454 |
case CBAli3.ItemIndex of |
1455 |
0: // Quantit? |
1456 |
begin
|
1457 |
CBAli4.Items.Add(StrKg); |
1458 |
CBAli4.Items.Add(Format('%s/%s', [StrKg, StrJ]));
|
1459 |
if CBAli1.ItemIndex = 0 |
1460 |
then // Aliments |
1461 |
CBAli4.Items.Add('%');
|
1462 |
end;
|
1463 |
1: // Co?t |
1464 |
begin
|
1465 |
CBAli4.Items.Add(CurrencySign); |
1466 |
CBAli4.Items.Add(Format('%s/%s', [CurrencySign, StrJ]));
|
1467 |
CBAli4.Items.Add(Format('%s/%s %s', [CurrencySign, StrKg, StrGMQUnit]));
|
1468 |
CBAli4.Items.Add(Format('%s/%s %s', [CurrencySign, StrKg, StrAlimentUnit]));
|
1469 |
CBAli4.Items.Add('%');
|
1470 |
end;
|
1471 |
end;
|
1472 |
CBAli4.ItemIndex := 0;
|
1473 |
AffGraphAli; |
1474 |
end;
|
1475 |
|
1476 |
procedure TFCompSimulP.CBAli4Change(Sender: TObject);
|
1477 |
begin
|
1478 |
AffGraphAli; |
1479 |
end;
|
1480 |
|
1481 |
procedure TFCompSimulP.CBAli5Change(Sender: TObject);
|
1482 |
begin
|
1483 |
AffGraphAli; |
1484 |
end;
|
1485 |
|
1486 |
///////////////////////
|
1487 |
// Acides amin?s //
|
1488 |
///////////////////////
|
1489 |
procedure TFCompSimulP.InitAA;
|
1490 |
const
|
1491 |
TabColor1: array[0..8] of TColor |
1492 |
= (clBlack, clTeal, clAqua, clOlive, clSilver, clPink, clGray, clRed, clGreen); |
1493 |
TabColor2: array[1..5] of TColor |
1494 |
= (clRed, clGreen, clYellow, clBlue, clFuchsia); |
1495 |
var
|
1496 |
i, k: integer; |
1497 |
begin
|
1498 |
// ListAA : liste pour les acides amin?s
|
1499 |
ListAA := TStringList.Create; |
1500 |
ListAA.Assign(LBAA.Items); |
1501 |
// BarAA : s?ries (barres) graphiques
|
1502 |
SetLength(BarAA, ListAA.Count); |
1503 |
for i := 0 to ListAA.Count - 1 do |
1504 |
begin
|
1505 |
BarAA[i] := TBarSeries.Create(Graph); |
1506 |
BarAA[i].ParentChart := Graph; |
1507 |
BarAA[i].Title := ListAA[i]; |
1508 |
BarAA[i].SeriesColor := TabColor1[i]; |
1509 |
BarAA[i].BarPen.Color := BarAA[i].SeriesColor; |
1510 |
BarAA[i].Marks.Visible := FALSE; |
1511 |
{
|
1512 |
BarAA[i].Marks.ArrowLength := -16;
|
1513 |
BarAA[i].Marks.Arrow.Visible := FALSE;
|
1514 |
BarAA[i].Marks.Brush.Style := bsClear;
|
1515 |
BarAA[i].Marks.Frame.Visible := FALSE;
|
1516 |
BarAA[i].Marks.Style := smsValue;
|
1517 |
}
|
1518 |
//BarAA[i].AutoMarkPosition := FALSE;
|
1519 |
Graph.AddSeries(BarAA[i]); |
1520 |
end;
|
1521 |
// LineAA : s?ries (lignes) graphiques
|
1522 |
for k := 1 to 5 do |
1523 |
if TabSimulP[k].Ok
|
1524 |
then
|
1525 |
begin
|
1526 |
LineAA[k] := TLineSeries.Create(Graph); |
1527 |
LineAA[k].ParentChart := Graph; |
1528 |
case FSimulP.PC.ActivePageIndex of |
1529 |
1 : // Comparaison |
1530 |
LineAA[k].Title := Format('Simulation %d', [k]);
|
1531 |
2 : // Sensibilit? |
1532 |
if FSimulP.CBVariable.ItemIndex = 6 |
1533 |
then // Gaspillage |
1534 |
if TabSimulP[k].Variation > 0 |
1535 |
then
|
1536 |
LineAA[k].Title := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
1537 |
else
|
1538 |
LineAA[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
1539 |
else
|
1540 |
LineAA[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
1541 |
end;
|
1542 |
LineAA[k].SeriesColor := TabColor2[k]; |
1543 |
LineAA[k].LinePen.Color := LineAA[k].SeriesColor; |
1544 |
LineAA[k].LinePen.Width := 2;
|
1545 |
Graph.AddSeries(LineAA[k]); |
1546 |
end;
|
1547 |
end;
|
1548 |
|
1549 |
procedure TFCompSimulP.AffGraphAA;
|
1550 |
var
|
1551 |
i, j, k: integer; |
1552 |
y: double; |
1553 |
s: string;
|
1554 |
|
1555 |
// Abscisse
|
1556 |
function AAX: double;
|
1557 |
begin
|
1558 |
case CBAA1.ItemIndex of |
1559 |
1, 2: // Apport ou besoin |
1560 |
case CBAA2.ItemIndex of |
1561 |
0: // Poids vif |
1562 |
result := PResSimulP.TabResult[2, j];
|
1563 |
1: // Age |
1564 |
result := PResSimulP.TabResult[1, j];
|
1565 |
2: // Jours |
1566 |
result := j; |
1567 |
3: // Semaines |
1568 |
result := j / 7;
|
1569 |
else
|
1570 |
result := 0;
|
1571 |
end;
|
1572 |
else
|
1573 |
result := 0;
|
1574 |
end;
|
1575 |
end;
|
1576 |
|
1577 |
// Ordonn?e
|
1578 |
function AAY: double;
|
1579 |
var
|
1580 |
h: integer; |
1581 |
v, d, endogeneAA, m75AA, AAk, bodyAA, AAingere, AAdigestible, PDAA, |
1582 |
IngereSec, PV, PD, py1, AAPD, AAAA, AAenergie, PD3, PDapport, Gaspillage: double; |
1583 |
begin
|
1584 |
case CBAA1.ItemIndex of |
1585 |
0: // R?partition |
1586 |
begin
|
1587 |
// Diviseur
|
1588 |
case CBAA4.ItemIndex of |
1589 |
1: // Dur?e |
1590 |
d := PresSimulP.NbJSim; |
1591 |
2: // Aliment |
1592 |
begin
|
1593 |
d := 0;
|
1594 |
if PresSimulP.NbJSim > 1 |
1595 |
then
|
1596 |
for h := 1 to PresSimulP.NbJSim do |
1597 |
d := d + PresSimulP.TabResult[113, h];
|
1598 |
end;
|
1599 |
else
|
1600 |
d := 1;
|
1601 |
end;
|
1602 |
v := 0;
|
1603 |
case i of |
1604 |
0: // Gaspillage |
1605 |
if CBAA5A.ItemIndex = 2 |
1606 |
then // Total |
1607 |
if PresSimulP.NbJSim > 1 |
1608 |
then
|
1609 |
for h := 1 to PresSimulP.NbJSim do |
1610 |
begin
|
1611 |
AAingere := PResSimulP.TabResult[93 + CBAA3.ItemIndex, h];
|
1612 |
Gaspillage := PResSimulP.TabResult[112, h];
|
1613 |
v := v + AAingere / (1 - Gaspillage) - AAingere;
|
1614 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1615 |
then // met + cys, phe + tyr |
1616 |
begin
|
1617 |
AAingere := PresSimulP.TabResult[CBAA3.ItemIndex + 92, h];
|
1618 |
v := v + AAingere / (1 - Gaspillage) - AAingere;
|
1619 |
end;
|
1620 |
end;
|
1621 |
1: // Indigestible |
1622 |
if CBAA5A.ItemIndex = 2 |
1623 |
then // Total |
1624 |
if PresSimulP.NbJSim > 1 |
1625 |
then
|
1626 |
for h := 1 to PresSimulP.NbJSim do |
1627 |
begin
|
1628 |
AAingere := PresSimulP.TabResult[CBAA3.ItemIndex + 93, h];
|
1629 |
AAdigestible := PresSimulP.TabResult[CBAA3.ItemIndex + 19, h];
|
1630 |
v := v + (AAingere - AAdigestible); |
1631 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1632 |
then // met + cys, phe + tyr |
1633 |
begin
|
1634 |
AAingere := PresSimulP.TabResult[CBAA3.ItemIndex + 92, h];
|
1635 |
AAdigestible := PresSimulP.TabResult[CBAA3.ItemIndex + 18, h];
|
1636 |
v := v + (AAingere - AAdigestible); |
1637 |
end;
|
1638 |
end;
|
1639 |
2: // Endog?ne basal |
1640 |
if CBAA5A.ItemIndex <> 1 |
1641 |
then // Total ou Digestible standardis? |
1642 |
if PresSimulP.NbJSim > 1 |
1643 |
then
|
1644 |
for h := 1 to PresSimulP.NbJSim do |
1645 |
begin
|
1646 |
IngereSec := PresSimulP.TabResult[106, h] * PResSimulP.TabResult[11, h]; |
1647 |
endogeneAA := AAendogene[CBAA3.ItemIndex]; |
1648 |
v := v + (IngereSec * endogeneAA); |
1649 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1650 |
then // met + cys, phe + tyr |
1651 |
begin
|
1652 |
endogeneAA := AAendogene[CBAA3.ItemIndex - 1];
|
1653 |
v := v + (IngereSec * endogeneAA); |
1654 |
end;
|
1655 |
end;
|
1656 |
3: // Entretien |
1657 |
if PresSimulP.NbJSim > 1 |
1658 |
then
|
1659 |
for h := 1 to PresSimulP.NbJSim do |
1660 |
begin
|
1661 |
PV := PresSimulP.TabResult[2, h];
|
1662 |
m75AA := AAm75[CBAA3.ItemIndex]; |
1663 |
v := v + (m75AA * Power(PV, 0.75));
|
1664 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1665 |
then // met + cys, phe + tyr |
1666 |
begin
|
1667 |
m75AA := AAm75[CBAA3.ItemIndex - 1];
|
1668 |
v := v + (m75AA * Power (PV, 0.75));
|
1669 |
end;
|
1670 |
end;
|
1671 |
4: // Oxydation minimale |
1672 |
if PresSimulP.NbJSim > 1 |
1673 |
then
|
1674 |
for h := 1 to PresSimulP.NbJSim do |
1675 |
begin
|
1676 |
PD := PresSimulP.TabResult[79, h];
|
1677 |
bodyAA := AAbody[CBAA3.ItemIndex]; |
1678 |
AAk := kAA[CBAA3.ItemIndex]; |
1679 |
if AAk <= 1 |
1680 |
then
|
1681 |
v := v + (PD * bodyAA / AAk * (1 - AAk));
|
1682 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1683 |
then // met + cys, phe + tyr |
1684 |
begin
|
1685 |
bodyAA := AAbody[CBAA3.ItemIndex - 1];
|
1686 |
AAk := kAA[CBAA3.ItemIndex - 1];
|
1687 |
if AAk <= 1 |
1688 |
then
|
1689 |
v := v + (PD * bodyAA / AAk * (1 - AAk));
|
1690 |
end;
|
1691 |
end;
|
1692 |
5: // D?p?t |
1693 |
if PresSimulP.NbJSim > 1 |
1694 |
then
|
1695 |
for h := 1 to PresSimulP.NbJSim do |
1696 |
begin
|
1697 |
PD := PresSimulP.TabResult[79, h];
|
1698 |
bodyAA := AAbody[CBAA3.ItemIndex]; |
1699 |
v := v + (PD * bodyAA); |
1700 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1701 |
then // met + cys, phe + tyr |
1702 |
begin
|
1703 |
bodyAA := AAbody[CBAA3.ItemIndex - 1];
|
1704 |
v := v + (PD * bodyAA); |
1705 |
end;
|
1706 |
end;
|
1707 |
6: // D?s?quilibre |
1708 |
if PresSimulP.NbJSim > 1 |
1709 |
then
|
1710 |
if CBAA3.ItemIndex = 12 |
1711 |
then // Arginine |
1712 |
for h := 1 to PresSimulP.NbJSim do |
1713 |
begin
|
1714 |
PD := PresSimulP.TabResult[79, h];
|
1715 |
py1 := PresSimulP.TabResult[77, h];
|
1716 |
PD3 := py1 / GEProtJaap; |
1717 |
PDAA := PresSimulP.TabResult[44, h];
|
1718 |
AAk := kAA[12];
|
1719 |
PDapport := PDAA / AAk; |
1720 |
bodyAA := AAbody[12];
|
1721 |
if (PD < PD3) and (PD < PDAA) |
1722 |
then
|
1723 |
if (PDapport > PD3) or (PD3 < PDAA) |
1724 |
then
|
1725 |
v := v + ((PD3 - PD) * bodyAA) |
1726 |
else
|
1727 |
v := v + ((PDAA - PD) * bodyAA); |
1728 |
end
|
1729 |
else
|
1730 |
for h := 1 to PresSimulP.NbJSim do |
1731 |
begin
|
1732 |
PD := PresSimulP.TabResult[79, h];
|
1733 |
py1 := PresSimulP.TabResult[77, h];
|
1734 |
PDAA := PresSimulP.TabResult[CBAA3.ItemIndex + 32, h];
|
1735 |
bodyAA := AAbody[CBAA3.ItemIndex]; |
1736 |
AAk := kAA[CBAA3.ItemIndex]; |
1737 |
AAAA := PDAA * bodyAA / AAk; |
1738 |
AAPD := PD * bodyAA / AAk; |
1739 |
AAenergie := py1 / GEProtJaap * bodyAA / AAk; |
1740 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1741 |
then // met + cys, phe + tyr |
1742 |
begin
|
1743 |
PDAA := PresSimulP.TabResult[CBAA3.ItemIndex + 31, h];
|
1744 |
bodyAA := AAbody[CBAA3.ItemIndex - 1];
|
1745 |
AAk := kAA[CBAA3.ItemIndex - 1];
|
1746 |
AAAA := AAAA + (PDAA * bodyAA / AAk); |
1747 |
AAPD := AAPD + (PD * bodyAA / AAk); |
1748 |
AAenergie := AAenergie + (py1 / GEProtJaap * bodyAA / AAk); |
1749 |
end;
|
1750 |
if AAPD < AAAA
|
1751 |
then
|
1752 |
if AAAA < AAenergie
|
1753 |
then
|
1754 |
v := v + (AAAA - AAPD) |
1755 |
else
|
1756 |
v := v + (AAenergie - AAPD); |
1757 |
end;
|
1758 |
7: // D?ficit |
1759 |
if PresSimulP.NbJSim > 1 |
1760 |
then
|
1761 |
if CBAA3.ItemIndex = 12 |
1762 |
then // Arginine |
1763 |
for h := 1 to PresSimulP.NbJSim do |
1764 |
begin
|
1765 |
py1 := PresSimulP.TabResult[77, h];
|
1766 |
PD3 := py1 / GEProtJaap; |
1767 |
PDAA := PresSimulP.TabResult[44, h];
|
1768 |
bodyAA := AAbody[12];
|
1769 |
if PDAA < PD3
|
1770 |
then
|
1771 |
v := v + ((PD3 - PDAA) * bodyAA); |
1772 |
end
|
1773 |
else
|
1774 |
for h := 1 to PresSimulP.NbJSim do |
1775 |
begin
|
1776 |
py1 := PresSimulP.TabResult[77, h];
|
1777 |
PDAA := PresSimulP.TabResult[CBAA3.ItemIndex + 32, h];
|
1778 |
bodyAA := AAbody[CBAA3.ItemIndex]; |
1779 |
AAk := kAA[CBAA3.ItemIndex]; |
1780 |
AAAA := PDAA * bodyAA / AAk; |
1781 |
AAenergie := py1 / GEProtJaap * bodyAA / AAk; |
1782 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1783 |
then // met + cys, phe + tyr |
1784 |
begin
|
1785 |
PDAA := PresSimulP.TabResult[CBAA3.ItemIndex + 31, h];
|
1786 |
bodyAA := AAbody[CBAA3.ItemIndex - 1];
|
1787 |
AAk := kAA[CBAA3.ItemIndex - 1];
|
1788 |
AAAA := AAAA + (PDAA * bodyAA / AAk); |
1789 |
AAenergie := AAenergie + (py1 / GEProtJaap * bodyAA / AAk); |
1790 |
end;
|
1791 |
if AAAA < AAenergie
|
1792 |
then
|
1793 |
v := v + (AAenergie - AAAA); |
1794 |
end;
|
1795 |
8: // Exc?s |
1796 |
if PresSimulP.NbJSim > 1 |
1797 |
then
|
1798 |
if CBAA3.ItemIndex = 12 |
1799 |
then // Arginine |
1800 |
for h := 1 to PresSimulP.NbJSim do |
1801 |
begin
|
1802 |
py1 := PresSimulP.TabResult[77, h];
|
1803 |
PD3 := py1 / GEProtJaap; |
1804 |
PDAA := PresSimulP.TabResult[44, h];
|
1805 |
AAk := kAA[12];
|
1806 |
PDapport := PDAA / AAk; |
1807 |
bodyAA := AAbody[12];
|
1808 |
if PD3 < PDapport
|
1809 |
then
|
1810 |
v := v + ((PDapport - PD3) * bodyAA); |
1811 |
end
|
1812 |
else
|
1813 |
for h := 1 to PresSimulP.NbJSim do |
1814 |
begin
|
1815 |
py1 := PresSimulP.TabResult[77, h];
|
1816 |
PDAA := PresSimulP.TabResult[CBAA3.ItemIndex + 32, h];
|
1817 |
bodyAA := AAbody[CBAA3.ItemIndex]; |
1818 |
AAk := kAA[CBAA3.ItemIndex]; |
1819 |
AAAA := PDAA * bodyAA / AAk; |
1820 |
AAenergie := py1 / GEProtJaap * bodyAA / AAk; |
1821 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1822 |
then // met + cys, phe + tyr |
1823 |
begin
|
1824 |
PDAA := PresSimulP.TabResult[CBAA3.ItemIndex + 31, h];
|
1825 |
bodyAA := AAbody[CBAA3.ItemIndex - 1];
|
1826 |
AAk := kAA[CBAA3.ItemIndex - 1];
|
1827 |
AAAA := AAAA + (PDAA * bodyAA / AAk); |
1828 |
AAenergie := AAenergie + (py1 / GEProtJaap * bodyAA / AAk); |
1829 |
end;
|
1830 |
if AAenergie < AAAA
|
1831 |
then
|
1832 |
v := v + (AAAA - AAenergie); |
1833 |
end;
|
1834 |
end;
|
1835 |
result := v / d; |
1836 |
end;
|
1837 |
1: // Apport |
1838 |
begin
|
1839 |
IngereSec := PresSimulP.TabResult[106, j] * PResSimulP.TabResult[11, j]; |
1840 |
// Diviseur
|
1841 |
case CBAA4.ItemIndex of |
1842 |
1: // Lysine |
1843 |
begin
|
1844 |
AAdigestible := PresSimulP.TabResult[20, j];
|
1845 |
case CBAA5A.ItemIndex of |
1846 |
0: // Standardis? |
1847 |
d := AAdigestible; |
1848 |
1: // Apparent |
1849 |
begin
|
1850 |
endogeneAA := AAendogene[1];
|
1851 |
d := AAdigestible |
1852 |
- IngereSec * endogeneAA; // Basal
|
1853 |
end;
|
1854 |
2: // Total |
1855 |
begin
|
1856 |
AAingere := PresSimulP.TabResult[94, j];
|
1857 |
d := AAingere; |
1858 |
end;
|
1859 |
else
|
1860 |
d := 1;
|
1861 |
end;
|
1862 |
d := d / 100;
|
1863 |
end;
|
1864 |
2: // GMQ |
1865 |
d := PresSimulP.TabResult[84, j];
|
1866 |
3: // ED |
1867 |
d := PResSimulP.TabResult[109, j] * PResSimulP.TabResult[113, j]; |
1868 |
4: // EM |
1869 |
d := PresSimulP.TabResult[89, j] * PresSimulP.TabResult[113, j]; |
1870 |
5: // EN |
1871 |
d := PresSimulP.TabResult[90, j] * PresSimulP.TabResult[113, j]; |
1872 |
6: // Aliment |
1873 |
d := PresSimulP.TabResult[113, j];
|
1874 |
else
|
1875 |
d := 1;
|
1876 |
end;
|
1877 |
AAdigestible := PresSimulP.TabResult[CBAA3.ItemIndex + 19, j];
|
1878 |
case CBAA5A.ItemIndex of |
1879 |
0: // Standardis? |
1880 |
v := AAdigestible; |
1881 |
1: // Apparent |
1882 |
begin
|
1883 |
endogeneAA := AAendogene[CBAA3.ItemIndex]; |
1884 |
v := AAdigestible |
1885 |
- IngereSec * endogeneAA; // Basal
|
1886 |
end;
|
1887 |
2: // Total |
1888 |
begin
|
1889 |
AAingere := PresSimulP.TabResult[CBAA3.ItemIndex + 93, j];
|
1890 |
v := AAingere; |
1891 |
end;
|
1892 |
else
|
1893 |
v := 0;
|
1894 |
end;
|
1895 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1896 |
then // met + cys, phe + tyr |
1897 |
begin
|
1898 |
AAdigestible := PresSimulP.TabResult[CBAA3.ItemIndex + 18, j];
|
1899 |
case CBAA5A.ItemIndex of |
1900 |
0: // Standardis? |
1901 |
v := v + AAdigestible; |
1902 |
1: // Apparent |
1903 |
begin
|
1904 |
endogeneAA := AAendogene[CBAA3.ItemIndex - 1];
|
1905 |
v := v + AAdigestible |
1906 |
- IngereSec * endogeneAA; // Basal
|
1907 |
end;
|
1908 |
2: // Total |
1909 |
begin
|
1910 |
AAingere := PresSimulP.TabResult[CBAA3.ItemIndex + 92, j];
|
1911 |
v := v + AAingere; |
1912 |
end;
|
1913 |
end;
|
1914 |
end;
|
1915 |
result := v / d; |
1916 |
end;
|
1917 |
2: // Besoin |
1918 |
begin
|
1919 |
IngereSec := PresSimulP.TabResult[106, j] * PResSimulP.TabResult[11, j]; |
1920 |
PV := PresSimulP.TabResult[2, j];
|
1921 |
py1 := PresSimulP.TabResult[77, j];
|
1922 |
// Diviseur
|
1923 |
case CBAA4.ItemIndex of |
1924 |
1: // Lysine |
1925 |
begin
|
1926 |
AAk := kAA[1];
|
1927 |
bodyAA := AAbody[1];
|
1928 |
m75AA := AAm75[1];
|
1929 |
AAenergie := py1 / GEProtJaap * bodyAA / AAk; |
1930 |
case CBAA5B.ItemIndex of |
1931 |
0: // Standardis? |
1932 |
begin
|
1933 |
endogeneAA := AAendogene[1];
|
1934 |
d := AAenergie |
1935 |
+ m75AA * Power (PV, 0.75) // Entretien |
1936 |
+ IngereSec * endogeneAA; // Basal
|
1937 |
end;
|
1938 |
1: // Apparent |
1939 |
d := AAenergie |
1940 |
+ m75AA * Power (PV, 0.75); // Entretien |
1941 |
else
|
1942 |
d := 1;
|
1943 |
end;
|
1944 |
d := d / 100;
|
1945 |
end;
|
1946 |
2: // GMQ |
1947 |
d := PresSimulP.TabResult[84, j];
|
1948 |
3: // ED |
1949 |
d := PResSimulP.TabResult[109, j] * PResSimulP.TabResult[113, j]; |
1950 |
4: // EM |
1951 |
d := PresSimulP.TabResult[89, j] * PresSimulP.TabResult[113, j]; |
1952 |
5: // EN |
1953 |
d := PresSimulP.TabResult[90, j] * PresSimulP.TabResult[113, j]; |
1954 |
6: // Aliment |
1955 |
d := PresSimulP.TabResult[113, j];
|
1956 |
else
|
1957 |
d := 1;
|
1958 |
end;
|
1959 |
bodyAA := AAbody[CBAA3.ItemIndex]; |
1960 |
AAk := kAA[CBAA3.ItemIndex]; |
1961 |
AAenergie := py1 / GEProtJaap * bodyAA / AAk; |
1962 |
m75AA := AAm75[CBAA3.ItemIndex]; |
1963 |
case CBAA5B.ItemIndex of |
1964 |
0: // Standardis? |
1965 |
begin
|
1966 |
endogeneAA := AAendogene[CBAA3.ItemIndex]; |
1967 |
v := AAenergie |
1968 |
+ m75AA * Power (PV, 0.75) // Entretien |
1969 |
+ IngereSec * endogeneAA; // Basal
|
1970 |
end;
|
1971 |
1: // Apparent |
1972 |
v := AAenergie |
1973 |
+ m75AA * Power (PV, 0.75); // Entretien |
1974 |
else
|
1975 |
v := 0;
|
1976 |
end;
|
1977 |
if (CBAA3.ItemIndex = 3) or (CBAA3.ItemIndex = 7) |
1978 |
then // met + cys, phe + tyr |
1979 |
begin
|
1980 |
bodyAA := AAbody[CBAA3.ItemIndex - 1];
|
1981 |
AAk := kAA[CBAA3.ItemIndex - 1];
|
1982 |
AAenergie := py1 / GEProtJaap * bodyAA / AAk; |
1983 |
m75AA := AAm75[CBAA3.ItemIndex - 1];
|
1984 |
case CBAA5B.ItemIndex of |
1985 |
0: // Standardis? |
1986 |
begin
|
1987 |
endogeneAA := AAendogene[CBAA3.ItemIndex - 1];
|
1988 |
v := v + AAenergie |
1989 |
+ m75AA * Power (PV, 0.75) // Entretien |
1990 |
+ IngereSec * endogeneAA; // Basal
|
1991 |
end;
|
1992 |
1: // Apparent |
1993 |
v := v + AAenergie |
1994 |
+ m75AA * Power (PV, 0.75); // Entretien |
1995 |
end;
|
1996 |
end;
|
1997 |
result := v / d; |
1998 |
end;
|
1999 |
else
|
2000 |
result := 0;
|
2001 |
end;
|
2002 |
end;
|
2003 |
|
2004 |
// AffGraphAA
|
2005 |
begin
|
2006 |
ResetGraph; |
2007 |
Graph.Title.Text.Add(Format('%s (%s)', [CBAA3.Text, CBAA1.Text]));
|
2008 |
Graph.LeftAxis.Title.Caption := Format('%s (%s)', [CBAA3.Text, CBAA4.Text]);
|
2009 |
case CBAA1.ItemIndex of |
2010 |
0: // R?partition |
2011 |
begin
|
2012 |
Graph.Legend.Inverted := TRUE; |
2013 |
Graph.SubTitle.Text.Add(CBAA5A.Text); |
2014 |
case FSimulP.PC.ActivePageIndex of |
2015 |
1: // Comparaison |
2016 |
Graph.BottomAxis.Title.Caption := 'Simulation';
|
2017 |
2: // Sensibilit? |
2018 |
Graph.BottomAxis.Title.Caption := 'Variation';
|
2019 |
end;
|
2020 |
// Affichage des barres
|
2021 |
for i := 0 to ListAA.Count - 1 do |
2022 |
BarAA[i].Active := TRUE; |
2023 |
for i := 0 to ListAA.Count - 1 do |
2024 |
BarAA[i].Clear; |
2025 |
if CBAA4.ItemIndex = 3 |
2026 |
then
|
2027 |
for i := 0 to ListAA.Count - 1 do |
2028 |
BarAA[i].MultiBar := mbStacked100 |
2029 |
else
|
2030 |
for i := 0 to ListAA.Count - 1 do |
2031 |
BarAA[i].MultiBar := mbStacked; |
2032 |
for i := 0 to ListAA.Count - 1 do |
2033 |
for k := 1 to 5 do |
2034 |
if TabSimulP[k].Ok
|
2035 |
then
|
2036 |
begin
|
2037 |
PResSimulP := TabSimulP[k].Result; |
2038 |
case FSimulP.PC.ActivePageIndex of |
2039 |
1: // Comparaison |
2040 |
s := Format('%d', [k]);
|
2041 |
2: // Sensibilit? |
2042 |
if FSimulP.CBVariable.ItemIndex = 6 |
2043 |
then // Gaspillage |
2044 |
if TabSimulP[k].Variation > 0 |
2045 |
then
|
2046 |
s := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
2047 |
else
|
2048 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
2049 |
else
|
2050 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
2051 |
end;
|
2052 |
y := AAY; |
2053 |
if y > PICO
|
2054 |
then
|
2055 |
BarAA[i].AddBar (y, s, clTeeColor) |
2056 |
else
|
2057 |
BarAA[i].AddNull (s); |
2058 |
end;
|
2059 |
for i := 0 to ListAA.Count - 1 do |
2060 |
BarAA[i].ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
2061 |
end;
|
2062 |
1, 2: // Apport ou besoin |
2063 |
begin
|
2064 |
Graph.Legend.Inverted := FALSE; |
2065 |
if CBAA1.ItemIndex = 2 |
2066 |
then // Besoin |
2067 |
Graph.SubTitle.Text.Add(CBAA5B.Text) |
2068 |
else
|
2069 |
Graph.SubTitle.Text.Add(CBAA5A.Text); |
2070 |
Graph.BottomAxis.Title.Caption := CBAA2.Text; |
2071 |
// Affichage des lignes
|
2072 |
for k := 1 to 5 do |
2073 |
if TabSimulP[k].Ok
|
2074 |
then
|
2075 |
begin
|
2076 |
LineAA[k].Active := TRUE; |
2077 |
LineAA[k].Clear; |
2078 |
PResSimulP := TabSimulP[k].Result; |
2079 |
for j := 1 to PresSimulP.NbJSim do |
2080 |
LineAA[k].AddXY (AAX, AAY, '', clTeeColor);
|
2081 |
end;
|
2082 |
if CBAA2.ItemIndex = 3 |
2083 |
then // Dur?e (semaine) |
2084 |
Graph.BottomAxis.Increment := 1
|
2085 |
else
|
2086 |
Graph.BottomAxis.Increment := 10;
|
2087 |
end;
|
2088 |
end;
|
2089 |
AjustEchelle(Graph); |
2090 |
end;
|
2091 |
|
2092 |
procedure TFCompSimulP.CBAA1Change(Sender: TObject);
|
2093 |
begin
|
2094 |
CBAA4.Items.Clear; |
2095 |
case CBAA1.ItemIndex of |
2096 |
0: // R?partition |
2097 |
begin
|
2098 |
CBAA2.Visible := FALSE; |
2099 |
CBAA5A.Visible := TRUE; |
2100 |
CBAA5B.Visible := FALSE; |
2101 |
// Unit?s
|
2102 |
CBAA4.Items.Add(StrG); |
2103 |
CBAA4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
2104 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
2105 |
CBAA4.Items.Add('%');
|
2106 |
end;
|
2107 |
1, 2: // Apport ou besoin |
2108 |
begin
|
2109 |
if CBAA1.ItemIndex = 2 |
2110 |
then // Besoin |
2111 |
if AffBesoin
|
2112 |
then
|
2113 |
begin
|
2114 |
FWarning := TFWarning.Create (Self); |
2115 |
with FWarning do |
2116 |
begin
|
2117 |
Msg := 'Besoin';
|
2118 |
ShowModal; |
2119 |
Release; |
2120 |
AffBesoin := FALSE; |
2121 |
end;
|
2122 |
end;
|
2123 |
CBAA2.Visible := TRUE; |
2124 |
CBAA5A.Visible := (CBAA1.ItemIndex = 1);
|
2125 |
CBAA5B.Visible := (CBAA1.ItemIndex = 2);
|
2126 |
// Unit?s
|
2127 |
CBAA4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
2128 |
CBAA4.Items.Add(Format('%% %s', [StrLys]));
|
2129 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrGMQUnit]));
|
2130 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrMJ, StrED]));
|
2131 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrMJ, StrEM]));
|
2132 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrMJ, StrEN]));
|
2133 |
CBAA4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
2134 |
if (CBAA1.ItemIndex = 2) and(CBAA5A.ItemIndex = 2) |
2135 |
then // Besoin -> Total |
2136 |
CBAA5A.ItemIndex := 0;
|
2137 |
end;
|
2138 |
end;
|
2139 |
CBAA4.ItemIndex := 0;
|
2140 |
AffGraphAA; |
2141 |
end;
|
2142 |
|
2143 |
procedure TFCompSimulP.CBAA2Change(Sender: TObject);
|
2144 |
begin
|
2145 |
AffGraphAA; |
2146 |
end;
|
2147 |
|
2148 |
procedure TFCompSimulP.CBAA3Change(Sender: TObject);
|
2149 |
begin
|
2150 |
AffGraphAA; |
2151 |
end;
|
2152 |
|
2153 |
procedure TFCompSimulP.CBAA4Change(Sender: TObject);
|
2154 |
begin
|
2155 |
AffGraphAA; |
2156 |
end;
|
2157 |
|
2158 |
procedure TFCompSimulP.CBAA5Change(Sender: TObject);
|
2159 |
begin
|
2160 |
if CBAA1.ItemIndex = 2 |
2161 |
then // Besoin |
2162 |
CBAA5A.ItemIndex := CBAA5B.ItemIndex |
2163 |
else
|
2164 |
if CBAA5A.ItemIndex = 2 |
2165 |
then // Total |
2166 |
CBAA5B.ItemIndex := 0
|
2167 |
else
|
2168 |
CBAA5B.ItemIndex := CBAA5A.ItemIndex; |
2169 |
AffGraphAA; |
2170 |
end;
|
2171 |
|
2172 |
/////////////////
|
2173 |
// Energie //
|
2174 |
/////////////////
|
2175 |
procedure TFCompSimulP.InitNRJ;
|
2176 |
const
|
2177 |
TabColor1: array[0..7] of TColor |
2178 |
= (clBlack, clTeal, clYellow, clOlive, clGray, clFuchsia, clBlue, clLime); |
2179 |
TabColor2: array[1..5] of TColor |
2180 |
= (clRed, clGreen, clYellow, clBlue, clFuchsia); |
2181 |
var
|
2182 |
i, k: integer; |
2183 |
begin
|
2184 |
// ListNRJ : liste pour l'?nergie
|
2185 |
ListNRJ := TStringList.Create; |
2186 |
ListNRJ.Assign(LBNRJ.Items); |
2187 |
// BarNRJ : s?ries (barres) graphiques
|
2188 |
SetLength(BarNRJ, ListNRJ.Count); |
2189 |
for i := 0 to ListNRJ.Count - 1 do |
2190 |
begin
|
2191 |
BarNRJ[i] := TBarSeries.Create(Graph); |
2192 |
BarNRJ[i].ParentChart := Graph; |
2193 |
BarNRJ[i].Title := ListNRJ[i]; |
2194 |
BarNRJ[i].SeriesColor := TabColor1[i]; |
2195 |
BarNRJ[i].BarPen.Color := BarNRJ[i].SeriesColor; |
2196 |
BarNRJ[i].Marks.Visible := FALSE; |
2197 |
{
|
2198 |
BarNRJ[i].Marks.ArrowLength := -16;
|
2199 |
BarNRJ[i].Marks.Arrow.Visible := FALSE;
|
2200 |
BarNRJ[i].Marks.Brush.Style := bsClear;
|
2201 |
BarNRJ[i].Marks.Frame.Visible := FALSE;
|
2202 |
BarNRJ[i].Marks.Style := smsValue;
|
2203 |
}
|
2204 |
//BarNRJ[i].AutoMarkPosition := FALSE;
|
2205 |
Graph.AddSeries(BarNRJ[i]); |
2206 |
end;
|
2207 |
// LineNRJ : s?ries (lignes) graphiques
|
2208 |
for k := 1 to 5 do |
2209 |
if TabSimulP[k].Ok
|
2210 |
then
|
2211 |
begin
|
2212 |
LineNRJ[k] := TLineSeries.Create(Graph); |
2213 |
LineNRJ[k].ParentChart := Graph; |
2214 |
case FSimulP.PC.ActivePageIndex of |
2215 |
1 : // Comparaison |
2216 |
LineNRJ[k].Title := Format('Simulation %d', [k]);
|
2217 |
2 : // Sensibilit? |
2218 |
if FSimulP.CBVariable.ItemIndex = 6 |
2219 |
then // Gaspillage |
2220 |
if TabSimulP[k].Variation > 0 |
2221 |
then
|
2222 |
LineNRJ[k].Title := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
2223 |
else
|
2224 |
LineNRJ[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
2225 |
else
|
2226 |
LineNRJ[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
2227 |
end;
|
2228 |
LineNRJ[k].SeriesColor := TabColor2[k]; |
2229 |
LineNRJ[k].LinePen.Color := LineNRJ[k].SeriesColor; |
2230 |
LineNRJ[k].LinePen.Width := 2;
|
2231 |
Graph.AddSeries(LineNRJ[k]); |
2232 |
end;
|
2233 |
end;
|
2234 |
|
2235 |
procedure TFCompSimulP.AffGraphNRJ;
|
2236 |
var
|
2237 |
i, j, k: integer; |
2238 |
y: double; |
2239 |
s: string;
|
2240 |
|
2241 |
// Abscisse
|
2242 |
function NRJX: double;
|
2243 |
begin
|
2244 |
case CBNRJ1.ItemIndex of |
2245 |
1: // Apport |
2246 |
case CBNRJ2.ItemIndex of |
2247 |
0: // Poids vif |
2248 |
result := PResSimulP.TabResult[2, j];
|
2249 |
1: // Age |
2250 |
result := PResSimulP.TabResult[1, j];
|
2251 |
2: // Jours |
2252 |
result := j; |
2253 |
3: // Semaines |
2254 |
result := j / 7;
|
2255 |
else
|
2256 |
result := 0;
|
2257 |
end;
|
2258 |
else
|
2259 |
result := 0;
|
2260 |
end;
|
2261 |
end;
|
2262 |
|
2263 |
// Ordonn?e
|
2264 |
function NRJY: double;
|
2265 |
var
|
2266 |
h: integer; |
2267 |
v, d, PV, EBing, EDing, {MAD, MGD, CBD, Amidon, Sucre, ResiduD,} MEintake,
|
2268 |
PDfreeNEintake, PDfreeNEreq, FHP60, kdiet, Standing, Entretien, Activite, |
2269 |
energyPD, energyLD, NEcrois, MEcrois, NEintake, Gaspillage: double; |
2270 |
begin
|
2271 |
case CBNRJ1.ItemIndex of |
2272 |
0: // R?partition |
2273 |
begin
|
2274 |
// Diviseur
|
2275 |
case CBNRJ4.ItemIndex of |
2276 |
1: // Dur?e |
2277 |
d := PresSimulP.NbJSim; |
2278 |
2: // Aliment |
2279 |
begin
|
2280 |
d := 0;
|
2281 |
if PresSimulP.NbJSim > 1 |
2282 |
then
|
2283 |
for h := 1 to PresSimulP.NbJSim do |
2284 |
d := d + PresSimulP.TabResult[113, h];
|
2285 |
end;
|
2286 |
else
|
2287 |
d := 1;
|
2288 |
end;
|
2289 |
v := 0;
|
2290 |
case i of |
2291 |
0: // Gaspillage |
2292 |
if CBNRJ3.ItemIndex = 0 |
2293 |
then // EB |
2294 |
if PresSimulP.NbJSim > 1 |
2295 |
then
|
2296 |
for h := 1 to PresSimulP.NbJSim do |
2297 |
begin
|
2298 |
EBing := PresSimulP.TabResult[12, h];
|
2299 |
Gaspillage := PResSimulP.TabResult[112, h];
|
2300 |
v := v + EBing / (1 - Gaspillage) - EBing;
|
2301 |
end;
|
2302 |
1: // Indigestible |
2303 |
if CBNRJ3.ItemIndex = 0 |
2304 |
then // EB |
2305 |
if PresSimulP.NbJSim > 1 |
2306 |
then
|
2307 |
for h := 1 to PresSimulP.NbJSim do |
2308 |
begin
|
2309 |
EBing := PresSimulP.TabResult[12, h];
|
2310 |
EDing := PResSimulP.TabResult[109, h] * PResSimulP.TabResult[11, h]; |
2311 |
v := v + (EBing - EDing); |
2312 |
end;
|
2313 |
2: // M?thane et urines |
2314 |
if CBNRJ3.ItemIndex <= 1 |
2315 |
then // EB ou ED |
2316 |
if PresSimulP.NbJSim > 1 |
2317 |
then
|
2318 |
for h := 1 to PresSimulP.NbJSim do |
2319 |
begin
|
2320 |
EDing := PResSimulP.TabResult[109, h] * PResSimulP.TabResult[11, h]; |
2321 |
MEintake := PresSimulP.TabResult[86, h] / 1000; |
2322 |
v := v + (EDing - MEintake); |
2323 |
end;
|
2324 |
3: // Entretien |
2325 |
if PresSimulP.NbJSim > 1 |
2326 |
then
|
2327 |
for h := 1 to PresSimulP.NbJSim do |
2328 |
begin
|
2329 |
FHP60 := PresSimulP.TabResult[91, h] / 1000; |
2330 |
PV := PresSimulP.TabResult[2, h];
|
2331 |
if CBNRJ3.ItemIndex = 3 |
2332 |
then // EN |
2333 |
Entretien := PProfilP.Entretien * kBR * FHP60 * Power(PV, 0.6)
|
2334 |
else // EB, ED ou EM |
2335 |
begin
|
2336 |
PDfreeNEintake := PresSimulP.TabResult[65, h] / 1000; |
2337 |
MEintake := PresSimulP.TabResult[86, h] / 1000; |
2338 |
energyPD := PresSimulP.TabResult[66, h] / 1000; |
2339 |
kdiet := PDfreeNEintake / (MEintake - energyPD); |
2340 |
Entretien := PProfilP.Entretien * kBR * FHP60 * Power(PV, 0.6) / kdiet;
|
2341 |
end;
|
2342 |
v := v + Entretien; |
2343 |
end;
|
2344 |
4: // Activit? |
2345 |
if PresSimulP.NbJSim > 1 |
2346 |
then
|
2347 |
for h := 1 to PresSimulP.NbJSim do |
2348 |
begin
|
2349 |
Standing := PresSimulP.TabResult[70, h];
|
2350 |
PV := PresSimulP.TabResult[2, h];
|
2351 |
if CBNRJ3.ItemIndex = 3 |
2352 |
then // EN |
2353 |
Activite := Standing * (NEact60h / 1000) * Power (PV, 0.6) |
2354 |
else // EB, ED ou EM |
2355 |
begin
|
2356 |
PDfreeNEintake := PresSimulP.TabResult[65, h] / 1000; |
2357 |
MEintake := PresSimulP.TabResult[86, h] / 1000; |
2358 |
energyPD := PresSimulP.TabResult[66, h] / 1000; |
2359 |
kdiet := PDfreeNEintake / (MEintake - energyPD); |
2360 |
Activite := Standing * (NEact60h / 1000) * Power(PV, 0.6) / kdiet; |
2361 |
end;
|
2362 |
v := v + Activite; |
2363 |
end;
|
2364 |
5: // Extrachaleur |
2365 |
if CBNRJ3.ItemIndex <= 2 |
2366 |
then // EB ou ED ou EM |
2367 |
if PresSimulP.NbJSim > 1 |
2368 |
then
|
2369 |
for h := 1 to PresSimulP.NbJSim do |
2370 |
begin
|
2371 |
MEintake := PresSimulP.TabResult[86, h] / 1000; |
2372 |
energyPD := PresSimulP.TabResult[66, h] / 1000; |
2373 |
PDfreeNEintake := PresSimulP.TabResult[65, h] / 1000; |
2374 |
PDfreeNEreq := PresSimulP.TabResult[73, h] / 1000; |
2375 |
energyLD := PDfreeNEintake - PDfreeNEreq; |
2376 |
FHP60 := PresSimulP.TabResult[91, h] / 1000; |
2377 |
PV := PresSimulP.TabResult[2, h];
|
2378 |
kdiet := PDfreeNEintake / (MEintake - energyPD); |
2379 |
Entretien := PProfilP.Entretien * kBR * FHP60 * Power(PV, 0.6) / kdiet;
|
2380 |
Standing := PresSimulP.TabResult[70, h];
|
2381 |
Activite := Standing * (NEact60h / 1000) * Power(PV, 0.6) / kdiet; |
2382 |
v := v + (MEintake - (energyPD + energyLD + Entretien + Activite)); |
2383 |
end;
|
2384 |
6: // Prot?ines |
2385 |
if PresSimulP.NbJSim > 1 |
2386 |
then
|
2387 |
for h := 1 to PresSimulP.NbJSim do |
2388 |
begin
|
2389 |
energyPD := PresSimulP.TabResult[66, h] / 1000; |
2390 |
v := v + energyPD; |
2391 |
end;
|
2392 |
7: // Lipides |
2393 |
if PresSimulP.NbJSim > 1 |
2394 |
then
|
2395 |
for h := 1 to PresSimulP.NbJSim do |
2396 |
begin
|
2397 |
PDfreeNEintake := PresSimulP.TabResult[65, h] / 1000; |
2398 |
PDfreeNEreq := PresSimulP.TabResult[73, h] / 1000; |
2399 |
energyLD := PDfreeNEintake - PDfreeNEreq; |
2400 |
v := v + energyLD; |
2401 |
end;
|
2402 |
end;
|
2403 |
result := v / d; |
2404 |
end;
|
2405 |
1: // Valeurs ?nerg?tiques |
2406 |
begin
|
2407 |
// Diviseur
|
2408 |
case CBNRJ4.ItemIndex of |
2409 |
1: // PV^0.60 |
2410 |
d := Power (PresSimulP.TabResult[2, j], 0.60); |
2411 |
2: // PV^0.75 |
2412 |
d := Power (PresSimulP.TabResult[2, j], 0.75); |
2413 |
3: // Aliment |
2414 |
d := PresSimulP.TabResult[11, j];
|
2415 |
4: // GMQ |
2416 |
d := PresSimulP.TabResult[84, j];
|
2417 |
else
|
2418 |
d := 1;
|
2419 |
end;
|
2420 |
case CBNRJ3Valeurs.ItemIndex of |
2421 |
0: // Energie digestible |
2422 |
begin
|
2423 |
EDing := PResSimulP.TabResult[109, j] * PResSimulP.TabResult[11, j]; |
2424 |
v := EDing; |
2425 |
end;
|
2426 |
1: // Energie m?tabolisable |
2427 |
case CBNRJ5.ItemIndex of |
2428 |
0: // Valeurs calcul?es |
2429 |
begin
|
2430 |
MEcrois := PresSimulP.TabResult[89, j];
|
2431 |
v := MEcrois * PresSimulP.TabResult[113, j];
|
2432 |
end;
|
2433 |
1: // Valeurs simul?es |
2434 |
begin
|
2435 |
MEintake := PresSimulP.TabResult[86, j] / 1000; |
2436 |
v := MEintake; |
2437 |
end;
|
2438 |
else
|
2439 |
v := 0;
|
2440 |
end;
|
2441 |
2: // Energie nette |
2442 |
case CBNRJ5.ItemIndex of |
2443 |
0: // Valeurs calcul?es |
2444 |
begin
|
2445 |
NEcrois := PresSimulP.TabResult[90, j];
|
2446 |
v := NEcrois * PresSimulP.TabResult[11, j];
|
2447 |
end;
|
2448 |
1: // Valeurs simul?es |
2449 |
begin
|
2450 |
NEintake := PresSimulP.TabResult[67, j] / 1000; |
2451 |
v := NEintake; |
2452 |
end;
|
2453 |
else
|
2454 |
v := 0;
|
2455 |
end;
|
2456 |
else
|
2457 |
v := 0;
|
2458 |
end;
|
2459 |
result := v / d; |
2460 |
end;
|
2461 |
else
|
2462 |
result := 0;
|
2463 |
end;
|
2464 |
end;
|
2465 |
|
2466 |
// AffGraphNRJ
|
2467 |
begin
|
2468 |
ResetGraph; |
2469 |
case CBNRJ1.ItemIndex of |
2470 |
0: // R?partition |
2471 |
begin
|
2472 |
Graph.Title.Text.Add(Format('%s (%s)', [CBNRJ3.Text, CBNRJ1.Text]));
|
2473 |
Graph.LeftAxis.Title.Caption := Format('%s (%s)', [CBNRJ3.Text, CBNRJ4.Text]);
|
2474 |
Graph.Legend.Inverted := TRUE; |
2475 |
case FSimulP.PC.ActivePageIndex of |
2476 |
1: // Comparaison |
2477 |
Graph.BottomAxis.Title.Caption := 'Simulation';
|
2478 |
2: // Sensibilit? |
2479 |
Graph.BottomAxis.Title.Caption := 'Variation';
|
2480 |
end;
|
2481 |
// Affichage des barres
|
2482 |
for i := 0 to ListNRJ.Count - 1 do |
2483 |
BarNRJ[i].Active := TRUE; |
2484 |
for i := 0 to ListNRJ.Count - 1 do |
2485 |
BarNRJ[i].Clear; |
2486 |
if CBNRJ4.ItemIndex = 3 |
2487 |
then
|
2488 |
for i := 0 to ListNRJ.Count - 1 do |
2489 |
BarNRJ[i].MultiBar := mbStacked100 |
2490 |
else
|
2491 |
for i := 0 to ListNRJ.Count - 1 do |
2492 |
BarNRJ[i].MultiBar := mbStacked; |
2493 |
for i := 0 to ListNRJ.Count - 1 do |
2494 |
for k := 1 to 5 do |
2495 |
if TabSimulP[k].Ok
|
2496 |
then
|
2497 |
begin
|
2498 |
PResSimulP := TabSimulP[k].Result; |
2499 |
if TabSimulP[k].Profil = -1 |
2500 |
then // Profil de la simulation |
2501 |
PProfilP := ListProfilP[FindIdxProfilP (FindNomProfilP (PSimulP.Profil))] |
2502 |
else
|
2503 |
PProfilP := ListProfilP[FindIdxProfilP (FindNomProfilP (TabSimulP[k].Profil))]; |
2504 |
case FSimulP.PC.ActivePageIndex of |
2505 |
1: // Comparaison |
2506 |
s := Format('%d', [k]);
|
2507 |
2: // Sensibilit? |
2508 |
if FSimulP.CBVariable.ItemIndex = 6 |
2509 |
then // Gaspillage |
2510 |
if TabSimulP[k].Variation > 0 |
2511 |
then
|
2512 |
s := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
2513 |
else
|
2514 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
2515 |
else
|
2516 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
2517 |
end;
|
2518 |
y := NRJY; |
2519 |
if y > PICO
|
2520 |
then
|
2521 |
BarNRJ[i].AddBar(y, s, clTeeColor) |
2522 |
else
|
2523 |
BarNRJ[i].AddNull(s); |
2524 |
end;
|
2525 |
for i := 0 to ListNRJ.Count - 1 do |
2526 |
BarNRJ[i].ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
2527 |
end;
|
2528 |
1: // Valeurs ?nerg?tiques |
2529 |
begin
|
2530 |
Graph.Title.Text.Add(Format('%s (%s)', [CBNRJ3Valeurs.Text, CBNRJ1.Text]));
|
2531 |
Graph.LeftAxis.Title.Caption := Format('%s (%s)', [CBNRJ3Valeurs.Text, CBNRJ4.Text]);
|
2532 |
Graph.Legend.Inverted := FALSE; |
2533 |
Graph.SubTitle.Text.Add(CBNRJ5.Text); |
2534 |
Graph.BottomAxis.Title.Caption := CBNRJ2.Text; |
2535 |
// Affichage des lignes
|
2536 |
for k := 1 to 5 do |
2537 |
if TabSimulP[k].Ok
|
2538 |
then
|
2539 |
begin
|
2540 |
LineNRJ[k].Active := TRUE; |
2541 |
LineNRJ[k].Clear; |
2542 |
PResSimulP := TabSimulP[k].Result; |
2543 |
for j := 1 to PresSimulP.NbJSim do |
2544 |
LineNRJ[k].AddXY(NRJX, NRJY, '', clTeeColor);
|
2545 |
end;
|
2546 |
if CBNRJ2.ItemIndex = 3 |
2547 |
then // Dur?e (semaine) |
2548 |
Graph.BottomAxis.Increment := 1
|
2549 |
else
|
2550 |
Graph.BottomAxis.Increment := 10;
|
2551 |
end;
|
2552 |
end;
|
2553 |
AjustEchelle(Graph); |
2554 |
end;
|
2555 |
|
2556 |
procedure TFCompSimulP.CBNRJ1Change(Sender: TObject);
|
2557 |
begin
|
2558 |
CBNRJ4.Items.Clear; |
2559 |
case CBNRJ1.ItemIndex of |
2560 |
0: // R?partition |
2561 |
begin
|
2562 |
CBNRJ2.Visible := FALSE; |
2563 |
CBNRJ3.Visible := TRUE; |
2564 |
CBNRJ3Valeurs.Visible := FALSE; |
2565 |
CBNRJ5.Visible := FALSE; |
2566 |
// Unit?s
|
2567 |
CBNRJ4.Items.Add(StrMJ); |
2568 |
CBNRJ4.Items.Add(Format('%s/%s', [StrMJ, StrJ]));
|
2569 |
CBNRJ4.Items.Add(Format('%s/%s %s', [StrMJ, StrKg, StrAlimentUnit]));
|
2570 |
CBNRJ4.Items.Add('%');
|
2571 |
end;
|
2572 |
1: // Valeurs ?nerg?tiques |
2573 |
begin
|
2574 |
CBNRJ2.Visible := TRUE; |
2575 |
CBNRJ3.Visible := FALSE; |
2576 |
CBNRJ3Valeurs.Visible := TRUE; |
2577 |
CBNRJ5.Visible := TRUE; |
2578 |
// Unit?s
|
2579 |
CBNRJ4.Items.Add(Format('%s/%s', [StrMJ, StrJ]));
|
2580 |
CBNRJ4.Items.Add(Format('%s/(%s %s)^0.60/%s', [StrMJ, StrKg, StrPV, StrJ]));
|
2581 |
CBNRJ4.Items.Add(Format('%s/(%s %s)^0.75/%s', [StrMJ, StrKg, StrPV, StrJ]));
|
2582 |
CBNRJ4.Items.Add(Format('%s/%s %s', [StrMJ, StrKg, StrAlimentUnit]));
|
2583 |
CBNRJ4.Items.Add(Format('%s/%s %s', [StrMJ, StrKg, StrGMQUnit]));
|
2584 |
end;
|
2585 |
end;
|
2586 |
CBNRJ4.ItemIndex := 0;
|
2587 |
AffGraphNRJ; |
2588 |
end;
|
2589 |
|
2590 |
procedure TFCompSimulP.CBNRJ2Change(Sender: TObject);
|
2591 |
begin
|
2592 |
AffGraphNRJ; |
2593 |
end;
|
2594 |
|
2595 |
procedure TFCompSimulP.CBNRJ3Change(Sender: TObject);
|
2596 |
begin
|
2597 |
AffGraphNRJ; |
2598 |
end;
|
2599 |
|
2600 |
procedure TFCompSimulP.CBNRJ4Change(Sender: TObject);
|
2601 |
begin
|
2602 |
AffGraphNRJ; |
2603 |
end;
|
2604 |
|
2605 |
procedure TFCompSimulP.CBNRJ5Change(Sender: TObject);
|
2606 |
begin
|
2607 |
AffGraphNRJ; |
2608 |
end;
|
2609 |
|
2610 |
//////////////////
|
2611 |
// Min?raux //
|
2612 |
//////////////////
|
2613 |
procedure TFCompSimulP.InitMin;
|
2614 |
const
|
2615 |
TabColor1: array[0..5] of TColor |
2616 |
= (clBlack, clTeal, clOlive, clPink, clRed, clGreen); |
2617 |
TabColor2: array[1..5] of TColor |
2618 |
= (clRed, clGreen, clYellow, clBlue, clFuchsia); |
2619 |
var
|
2620 |
i, k: integer; |
2621 |
begin
|
2622 |
// ListMin : liste pour les min?raux
|
2623 |
ListMin := TStringList.Create; |
2624 |
ListMin.Assign(LBMin.Items); |
2625 |
// BarMin : s?ries (barres) graphiques
|
2626 |
SetLength(BarMin, ListMin.Count); |
2627 |
for i := 0 to ListMin.Count - 1 do |
2628 |
begin
|
2629 |
BarMin[i] := TBarSeries.Create(Graph); |
2630 |
BarMin[i].ParentChart := Graph; |
2631 |
BarMin[i].Title := ListMin[i]; |
2632 |
BarMin[i].SeriesColor := TabColor1[i]; |
2633 |
BarMin[i].BarPen.Color := BarMin[i].SeriesColor; |
2634 |
BarMin[i].Marks.Visible := FALSE; |
2635 |
{
|
2636 |
BarMin[i].Marks.ArrowLength := -16;
|
2637 |
BarMin[i].Marks.Arrow.Visible := FALSE;
|
2638 |
BarMin[i].Marks.Brush.Style := bsClear;
|
2639 |
BarMin[i].Marks.Frame.Visible := FALSE;
|
2640 |
BarMin[i].Marks.Style := smsValue;
|
2641 |
}
|
2642 |
//BarMin[i].AutoMarkPosition := FALSE;
|
2643 |
Graph.AddSeries(BarMin[i]); |
2644 |
end;
|
2645 |
// LineMin : s?ries (lignes) graphiques
|
2646 |
for k := 1 to 5 do |
2647 |
if TabSimulP[k].Ok
|
2648 |
then
|
2649 |
begin
|
2650 |
LineMin[k] := TLineSeries.Create(Graph); |
2651 |
LineMin[k].ParentChart := Graph; |
2652 |
case FSimulP.PC.ActivePageIndex of |
2653 |
1 : // Comparaison |
2654 |
LineMin[k].Title := Format('Simulation %d', [k]);
|
2655 |
2 : // Sensibilit? |
2656 |
if FSimulP.CBVariable.ItemIndex = 6 |
2657 |
then // Gaspillage |
2658 |
if TabSimulP[k].Variation > 0 |
2659 |
then
|
2660 |
LineMin[k].Title := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
2661 |
else
|
2662 |
LineMin[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
2663 |
else
|
2664 |
LineMin[k].Title := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
2665 |
end;
|
2666 |
LineMin[k].SeriesColor := TabColor2[k]; |
2667 |
LineMin[k].LinePen.Color := LineMin[k].SeriesColor; |
2668 |
LineMin[k].LinePen.Width := 2;
|
2669 |
Graph.AddSeries(LineMin[k]); |
2670 |
end;
|
2671 |
end;
|
2672 |
|
2673 |
procedure TFCompSimulP.AffGraphMin;
|
2674 |
var
|
2675 |
i, j, k: integer; |
2676 |
y: double; |
2677 |
s: string;
|
2678 |
|
2679 |
// Abscisse
|
2680 |
function MinX: double;
|
2681 |
begin
|
2682 |
case CBMin1.ItemIndex of |
2683 |
1, 2: // Apport ou besoin |
2684 |
case CBMin2.ItemIndex of |
2685 |
0: // Poids vif |
2686 |
result := PResSimulP.TabResult[2, j];
|
2687 |
1: // Age |
2688 |
result := PResSimulP.TabResult[1, j];
|
2689 |
2: // Jours |
2690 |
result := j; |
2691 |
3: // Semaines |
2692 |
result := j / 7;
|
2693 |
else
|
2694 |
result := 0;
|
2695 |
end;
|
2696 |
else
|
2697 |
result := 0;
|
2698 |
end;
|
2699 |
end;
|
2700 |
|
2701 |
// Ordonn?e
|
2702 |
function MinY: double;
|
2703 |
var
|
2704 |
h: integer; |
2705 |
v, d, Ptot, Pdig, PV, GMQ, Indigestible, Entretien, Retenu, Gaspillage: double; |
2706 |
|
2707 |
// Composition des aliments
|
2708 |
procedure Composition(jour: integer);
|
2709 |
var
|
2710 |
Aliment1, Aliment2: integer; |
2711 |
IngereFrais, Taux1, Taux2, IngereSec1, IngereSec2, Ptot1, Ptot2, Pdig1, Pdig2: double; |
2712 |
CC1, CC2: CompositionChimique; |
2713 |
begin
|
2714 |
IngereFrais := PresSimulP.TabResult[11, jour];
|
2715 |
// Aliment 1
|
2716 |
Aliment1 := Round (PresSimulP.TabResult[7, jour]);
|
2717 |
if Aliment1 = -1 |
2718 |
then
|
2719 |
CC1 := CCVide |
2720 |
else
|
2721 |
begin
|
2722 |
PAliment := ListAliment[FindIdxAliment(FindNomAliment(Aliment1))]; |
2723 |
CC1 := PAliment.CC; |
2724 |
end;
|
2725 |
Taux1 := PresSimulP.TabResult[9, jour] / 100; |
2726 |
IngereSec1 := IngereFrais * Taux1 * CC1.MS / 1000;
|
2727 |
Ptot1 := IngereSec1 * CC1.P; |
2728 |
if Aliment1 = -1 |
2729 |
then
|
2730 |
Pdig1 := 0
|
2731 |
else
|
2732 |
if PAliment.Presentation = 0 |
2733 |
then // Granul?s |
2734 |
Pdig1 := IngereSec1 * PAliment.CC.PdigG |
2735 |
else // Farine |
2736 |
Pdig1 := IngereSec1 * PAliment.CC.PdigF; |
2737 |
// Aliment 2
|
2738 |
Aliment2 := Round(PresSimulP.TabResult[8, jour]);
|
2739 |
if Aliment2 = -1 |
2740 |
then
|
2741 |
CC2 := CCVide |
2742 |
else
|
2743 |
begin
|
2744 |
PAliment := ListAliment[FindIdxAliment(FindNomAliment(Aliment2))]; |
2745 |
CC2 := PAliment.CC; |
2746 |
end;
|
2747 |
Taux2 := PresSimulP.TabResult[10, jour] / 100; |
2748 |
IngereSec2 := IngereFrais * Taux2 * CC2.MS / 1000;
|
2749 |
Ptot2 := IngereSec2 * CC2.P; |
2750 |
if Aliment2 = -1 |
2751 |
then
|
2752 |
Pdig2 := 0
|
2753 |
else
|
2754 |
if PAliment.Presentation = 0 |
2755 |
then // Granul?s |
2756 |
Pdig2 := IngereSec2 * PAliment.CC.PdigG |
2757 |
else // Farine |
2758 |
Pdig2 := IngereSec2 * PAliment.CC.PdigF; |
2759 |
// Cumul
|
2760 |
Ptot := Ptot1 + Ptot2; |
2761 |
Pdig := Pdig1 + Pdig2; |
2762 |
end;
|
2763 |
|
2764 |
begin
|
2765 |
case CBMin1.ItemIndex of |
2766 |
0: // R?partition |
2767 |
begin
|
2768 |
// Diviseur
|
2769 |
case CBMin4.ItemIndex of |
2770 |
1: // Dur?e |
2771 |
d := PresSimulP.NbJSim; |
2772 |
2: // Aliment |
2773 |
begin
|
2774 |
d := 0;
|
2775 |
if PresSimulP.NbJSim > 1 |
2776 |
then
|
2777 |
for h := 1 to PresSimulP.NbJSim do |
2778 |
d := d + PresSimulP.TabResult[113, h];
|
2779 |
end;
|
2780 |
else
|
2781 |
d := 1;
|
2782 |
end;
|
2783 |
v := 0;
|
2784 |
case CBMin3.ItemIndex of |
2785 |
0: // Phosphore |
2786 |
case i of |
2787 |
0: // Gaspillage |
2788 |
if CBMin5A.ItemIndex = 1 |
2789 |
then // Total |
2790 |
for h := 1 to PresSimulP.NbJSim do |
2791 |
begin
|
2792 |
Composition(h); |
2793 |
Gaspillage := PResSimulP.TabResult[112, h];
|
2794 |
v := v + Ptot / (1 - Gaspillage) - Ptot;
|
2795 |
end;
|
2796 |
1: // Indigestible |
2797 |
if CBMin5A.ItemIndex = 1 |
2798 |
then // Total |
2799 |
for h := 1 to PresSimulP.NbJSim do |
2800 |
begin
|
2801 |
Composition(h); |
2802 |
Indigestible := Ptot - Pdig; |
2803 |
v := v + Indigestible; |
2804 |
end;
|
2805 |
2: // Entretien |
2806 |
for h := 1 to PresSimulP.NbJSim do |
2807 |
begin
|
2808 |
Composition(h); |
2809 |
Indigestible := Ptot - Pdig; |
2810 |
PV := PResSimulP.TabResult[2, h];
|
2811 |
Entretien := 10 * PV / 1000; |
2812 |
if Ptot < Indigestible + Entretien
|
2813 |
then // D?ficit |
2814 |
v := v + Ptot - Indigestible |
2815 |
else
|
2816 |
v := v + Entretien; |
2817 |
end;
|
2818 |
3: // Retenu |
2819 |
for h := 1 to PresSimulP.NbJSim do |
2820 |
begin
|
2821 |
Composition(h); |
2822 |
Indigestible := Ptot - Pdig; |
2823 |
PV := PResSimulP.TabResult[2, h];
|
2824 |
Entretien := 10 * PV / 1000; |
2825 |
GMQ := PResSimulP.TabResult[84, h];
|
2826 |
Retenu := (5.4199 - 2 * 0.002857 * PV) * GMQ; |
2827 |
if Ptot < Indigestible + Entretien + Retenu
|
2828 |
then // D?ficit |
2829 |
v := v + Max(Ptot - Indigestible - Entretien, 0)
|
2830 |
else
|
2831 |
v := v + Retenu; |
2832 |
end;
|
2833 |
4: // D?ficit |
2834 |
for h := 1 to PresSimulP.NbJSim do |
2835 |
begin
|
2836 |
Composition(h); |
2837 |
Indigestible := Ptot - Pdig; |
2838 |
PV := PResSimulP.TabResult[2, h];
|
2839 |
Entretien := 10 * PV / 1000; |
2840 |
GMQ := PResSimulP.TabResult[84, h];
|
2841 |
Retenu := (5.4199 - 2 * 0.002857 * PV) * GMQ; |
2842 |
if Ptot < Indigestible + Entretien + Retenu
|
2843 |
then
|
2844 |
v := v + Indigestible + Entretien + Retenu - Ptot; |
2845 |
end;
|
2846 |
5: // Exc?s |
2847 |
for h := 1 to PresSimulP.NbJSim do |
2848 |
begin
|
2849 |
Composition(h); |
2850 |
Indigestible := Ptot - Pdig; |
2851 |
PV := PResSimulP.TabResult[2, h];
|
2852 |
Entretien := 10 * PV / 1000; |
2853 |
GMQ := PResSimulP.TabResult[84, h];
|
2854 |
Retenu := (5.4199 - 2 * 0.002857 * PV) * GMQ; |
2855 |
if Ptot > Indigestible + Entretien + Retenu
|
2856 |
then
|
2857 |
v := v + Ptot - Indigestible - Entretien - Retenu; |
2858 |
end;
|
2859 |
end;
|
2860 |
end;
|
2861 |
result := v / d; |
2862 |
end;
|
2863 |
1: // Apport |
2864 |
begin
|
2865 |
// Diviseur
|
2866 |
case CBMin4.ItemIndex of |
2867 |
1: // GMQ |
2868 |
d := PResSimulP.TabResult[84, j];
|
2869 |
2: // Aliment |
2870 |
d := PResSimulP.TabResult[113, j];
|
2871 |
else
|
2872 |
d := 1;
|
2873 |
end;
|
2874 |
case CBMin3.ItemIndex of |
2875 |
0: // Phosphore |
2876 |
begin
|
2877 |
Composition(j); |
2878 |
if CBMin5A.ItemIndex = 0 |
2879 |
then // Digestibilit? apparente |
2880 |
v := Pdig |
2881 |
else // Total |
2882 |
v := Ptot; |
2883 |
end;
|
2884 |
else
|
2885 |
v := 0;
|
2886 |
end;
|
2887 |
result := v / d; |
2888 |
end;
|
2889 |
2: // Besoin |
2890 |
begin
|
2891 |
// Diviseur
|
2892 |
case CBMin4.ItemIndex of |
2893 |
1: // GMQ |
2894 |
d := PResSimulP.TabResult[84, j];
|
2895 |
2: // Aliment |
2896 |
d := PResSimulP.TabResult[113, j];
|
2897 |
else
|
2898 |
d := 1;
|
2899 |
end;
|
2900 |
case CBMin3.ItemIndex of |
2901 |
0: // Phosphore |
2902 |
begin
|
2903 |
PV := PResSimulP.TabResult[2, j];
|
2904 |
Entretien := 10 * PV / 1000; |
2905 |
GMQ := PResSimulP.TabResult[84, j];
|
2906 |
Retenu := (5.4199 - 2 * 0.002857 * PV) * GMQ; |
2907 |
v := Entretien + Retenu; |
2908 |
end;
|
2909 |
else
|
2910 |
v := 0;
|
2911 |
end;
|
2912 |
result := v / d; |
2913 |
end;
|
2914 |
else
|
2915 |
result := 0;
|
2916 |
end;
|
2917 |
end;
|
2918 |
|
2919 |
// AffGraphMin
|
2920 |
begin
|
2921 |
ResetGraph; |
2922 |
Graph.Title.Text.Add(Format('%s (%s)', [CBMin3.Text, CBMin1.Text]));
|
2923 |
if CBMin1.ItemIndex = 1 |
2924 |
then // Besoin |
2925 |
Graph.SubTitle.Text.Add(CBMin5B.Text) |
2926 |
else
|
2927 |
Graph.SubTitle.Text.Add(CBMin5A.Text); |
2928 |
Graph.LeftAxis.Title.Caption := Format('%s (%s)', [CBMin3.Text, CBMin4.Text]);
|
2929 |
case CBMin1.ItemIndex of |
2930 |
0: // R?partition |
2931 |
begin
|
2932 |
Graph.Legend.Inverted := TRUE; |
2933 |
case FSimulP.PC.ActivePageIndex of |
2934 |
1: // Comparaison |
2935 |
Graph.BottomAxis.Title.Caption := 'Simulation';
|
2936 |
2: // Sensibilit? |
2937 |
Graph.BottomAxis.Title.Caption := 'Variation';
|
2938 |
end;
|
2939 |
// Affichage des barres
|
2940 |
for i := 0 to ListMin.Count - 1 do |
2941 |
BarMin[i].Active := TRUE; |
2942 |
for i := 0 to ListMin.Count - 1 do |
2943 |
BarMin[i].Clear; |
2944 |
if CBMin4.ItemIndex = 3 |
2945 |
then
|
2946 |
for i := 0 to ListMin.Count - 1 do |
2947 |
BarMin[i].MultiBar := mbStacked100 |
2948 |
else
|
2949 |
for i := 0 to ListMin.Count - 1 do |
2950 |
BarMin[i].MultiBar := mbStacked; |
2951 |
for i := 0 to ListMin.Count - 1 do |
2952 |
for k := 1 to 5 do |
2953 |
if TabSimulP[k].Ok
|
2954 |
then
|
2955 |
begin
|
2956 |
PResSimulP := TabSimulP[k].Result; |
2957 |
case FSimulP.PC.ActivePageIndex of |
2958 |
1: // Comparaison |
2959 |
s := Format('%d', [k]);
|
2960 |
2: // Sensibilit? |
2961 |
if FSimulP.CBVariable.ItemIndex = 6 |
2962 |
then // Gaspillage |
2963 |
if TabSimulP[k].Variation > 0 |
2964 |
then
|
2965 |
s := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
2966 |
else
|
2967 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
2968 |
else
|
2969 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
2970 |
end;
|
2971 |
y := MinY; |
2972 |
if y > PICO
|
2973 |
then
|
2974 |
BarMin[i].AddBar(y, s, clTeeColor) |
2975 |
else
|
2976 |
BarMin[i].AddNull(s); |
2977 |
end;
|
2978 |
for i := 0 to ListMin.Count - 1 do |
2979 |
BarMin[i].ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
2980 |
end;
|
2981 |
1, 2: // Apport ou besoin |
2982 |
begin
|
2983 |
Graph.Legend.Inverted := FALSE; |
2984 |
Graph.BottomAxis.Title.Caption := CBMin2.Text; |
2985 |
// Affichage des lignes
|
2986 |
for k := 1 to 5 do |
2987 |
if TabSimulP[k].Ok
|
2988 |
then
|
2989 |
begin
|
2990 |
LineMin[k].Active := TRUE; |
2991 |
LineMin[k].Clear; |
2992 |
PResSimulP := TabSimulP[k].Result; |
2993 |
for j := 1 to PresSimulP.NbJSim do |
2994 |
LineMin[k].AddXY(MinX, MinY, '', clTeeColor);
|
2995 |
end;
|
2996 |
if CBMin2.ItemIndex = 3 |
2997 |
then // Dur?e (semaine) |
2998 |
Graph.BottomAxis.Increment := 1
|
2999 |
else
|
3000 |
Graph.BottomAxis.Increment := 10;
|
3001 |
end;
|
3002 |
end;
|
3003 |
AjustEchelle(Graph); |
3004 |
end;
|
3005 |
|
3006 |
procedure TFCompSimulP.CBMin1Change(Sender: TObject);
|
3007 |
begin
|
3008 |
CBMin4.Items.Clear; |
3009 |
case CBMin1.ItemIndex of |
3010 |
0: // R?partition |
3011 |
begin
|
3012 |
CBMin2.Visible := FALSE; |
3013 |
CBMin5A.Visible := TRUE; |
3014 |
CBMin5B.Visible := FALSE; |
3015 |
// Unit?s
|
3016 |
CBMin4.Items.Add(StrG); |
3017 |
CBMin4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
3018 |
CBMin4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
3019 |
CBMin4.Items.Add('%');
|
3020 |
end;
|
3021 |
1, 2: // Apport ou besoin |
3022 |
begin
|
3023 |
CBMin2.Visible := TRUE; |
3024 |
CBMin5A.Visible := (CBMin1.ItemIndex = 1);
|
3025 |
CBMin5B.Visible := (CBMin1.ItemIndex = 2);
|
3026 |
if CBMin1.ItemIndex = 2 |
3027 |
then // Besoin |
3028 |
if CBMin5A.ItemIndex = 1 |
3029 |
then // Total |
3030 |
CBMin5A.ItemIndex := 0;
|
3031 |
// Unit?s
|
3032 |
CBMin4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
3033 |
CBMin4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrGMQUnit]));
|
3034 |
CBMin4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
3035 |
end;
|
3036 |
end;
|
3037 |
CBMin4.ItemIndex := 0;
|
3038 |
AffGraphMin; |
3039 |
end;
|
3040 |
|
3041 |
procedure TFCompSimulP.CBMin2Change(Sender: TObject);
|
3042 |
begin
|
3043 |
AffGraphMin; |
3044 |
end;
|
3045 |
|
3046 |
procedure TFCompSimulP.CBMin3Change(Sender: TObject);
|
3047 |
begin
|
3048 |
AffGraphMin; |
3049 |
end;
|
3050 |
|
3051 |
procedure TFCompSimulP.CBMin4Change(Sender: TObject);
|
3052 |
begin
|
3053 |
AffGraphMin; |
3054 |
end;
|
3055 |
|
3056 |
procedure TFCompSimulP.CBMin5Change(Sender: TObject);
|
3057 |
begin
|
3058 |
if CBMin1.ItemIndex = 2 |
3059 |
then // Besoin |
3060 |
CBMin5A.ItemIndex := CBMin5B.ItemIndex |
3061 |
else
|
3062 |
if CBMin5A.ItemIndex = 1 |
3063 |
then // Total |
3064 |
CBMin5B.ItemIndex := 0
|
3065 |
else
|
3066 |
CBMin5B.ItemIndex := CBMin5A.ItemIndex; |
3067 |
AffGraphMin; |
3068 |
end;
|
3069 |
|
3070 |
////////////////
|
3071 |
// Rejets //
|
3072 |
////////////////
|
3073 |
procedure TFCompSimulP.InitRej;
|
3074 |
const
|
3075 |
TabColor: array[0..4] of TColor |
3076 |
= (clBlack, clMaroon, clYellow, clMaroon, clPink); |
3077 |
var
|
3078 |
i: integer; |
3079 |
begin
|
3080 |
// ListRej : liste pour les rejets
|
3081 |
ListRej := TStringList.Create; |
3082 |
ListRej.Assign(LBRej.Items); |
3083 |
// BarRej : s?ries (barres) graphiques
|
3084 |
SetLength(BarRej, ListRej.Count); |
3085 |
for i := 0 to ListRej.Count - 1 do |
3086 |
begin
|
3087 |
BarRej[i] := TBarSeries.Create(Graph); |
3088 |
BarRej[i].ParentChart := Graph; |
3089 |
BarRej[i].Title := ListRej[i]; |
3090 |
BarRej[i].SeriesColor := TabColor[i]; |
3091 |
BarRej[i].BarPen.Color := BarRej[i].SeriesColor; |
3092 |
BarRej[i].Marks.Visible := FALSE; |
3093 |
{
|
3094 |
BarRej[i].Marks.ArrowLength := -16;
|
3095 |
BarRej[i].Marks.Arrow.Visible := FALSE;
|
3096 |
BarRej[i].Marks.Brush.Style := bsClear;
|
3097 |
BarRej[i].Marks.Frame.Visible := FALSE;
|
3098 |
BarRej[i].Marks.Style := smsValue;
|
3099 |
}
|
3100 |
//BarRej[i].AutoMarkPosition := FALSE;
|
3101 |
Graph.AddSeries(BarRej[i]); |
3102 |
end;
|
3103 |
end;
|
3104 |
|
3105 |
procedure TFCompSimulP.AffGraphRej;
|
3106 |
var
|
3107 |
i, k: integer; |
3108 |
y: double; |
3109 |
s: string;
|
3110 |
|
3111 |
// Ordonn?e
|
3112 |
function RejY: double;
|
3113 |
var
|
3114 |
h: integer; |
3115 |
v, d, IngereSec1, IngereSec2, Ptot, Pdig, Ingere, Digestible, Depose, Gaspillage: double; |
3116 |
CC1, CC2: CompositionChimique; |
3117 |
|
3118 |
// Composition des aliments
|
3119 |
procedure Composition(jour: integer);
|
3120 |
var
|
3121 |
Aliment1, Aliment2: integer; |
3122 |
IngereFrais, Taux1, Taux2, Ptot1, Ptot2, Pdig1, Pdig2: double; |
3123 |
begin
|
3124 |
IngereFrais := PresSimulP.TabResult[11, jour];
|
3125 |
// Aliment 1
|
3126 |
Aliment1 := Round (PresSimulP.TabResult[7, jour]);
|
3127 |
if Aliment1 = -1 |
3128 |
then
|
3129 |
CC1 := CCVide |
3130 |
else
|
3131 |
begin
|
3132 |
PAliment := ListAliment[FindIdxAliment(FindNomAliment(Aliment1))]; |
3133 |
CC1 := PAliment.CC; |
3134 |
end;
|
3135 |
Taux1 := PresSimulP.TabResult[9, jour] / 100; |
3136 |
IngereSec1 := IngereFrais * Taux1 * CC1.MS / 1000;
|
3137 |
Ptot1 := IngereSec1 * CC1.P; |
3138 |
if Aliment1 = -1 |
3139 |
then
|
3140 |
Pdig1 := 0
|
3141 |
else
|
3142 |
if PAliment.Presentation = 0 |
3143 |
then // Granul?s |
3144 |
Pdig1 := IngereSec1 * PAliment.CC.PdigG |
3145 |
else // Farine |
3146 |
Pdig1 := IngereSec1 * PAliment.CC.PdigF; |
3147 |
// Aliment 2
|
3148 |
Aliment2 := Round (PresSimulP.TabResult[8, jour]);
|
3149 |
if Aliment2 = -1 |
3150 |
then
|
3151 |
CC2 := CCVide |
3152 |
else
|
3153 |
begin
|
3154 |
PAliment := ListAliment[FindIdxAliment(FindNomAliment (Aliment2))]; |
3155 |
CC2 := PAliment.CC; |
3156 |
end;
|
3157 |
Taux2 := PresSimulP.TabResult[10, jour] / 100; |
3158 |
IngereSec2 := IngereFrais * Taux2 * CC2.MS / 1000;
|
3159 |
Ptot2 := IngereSec2 * CC2.P; |
3160 |
if Aliment2 = -1 |
3161 |
then
|
3162 |
Pdig2 := 0
|
3163 |
else
|
3164 |
if PAliment.Presentation = 0 |
3165 |
then // Granul?s |
3166 |
Pdig2 := IngereSec2 * PAliment.CC.PdigG |
3167 |
else // Farine |
3168 |
Pdig2 := IngereSec2 * PAliment.CC.PdigF; |
3169 |
// Cumul
|
3170 |
Ptot := Ptot1 + Ptot2; |
3171 |
Pdig := Pdig1 + Pdig2; |
3172 |
end;
|
3173 |
|
3174 |
// Calcul de l'ing?r?
|
3175 |
function CalcIngere: Double;
|
3176 |
begin
|
3177 |
case CBRej3.ItemIndex of |
3178 |
0: // Azote |
3179 |
result := (IngereSec1*CC1.MAT + IngereSec2*CC2.MAT) * 0.16;
|
3180 |
1: // Phosphore |
3181 |
result := Ptot; |
3182 |
2: // Calcium |
3183 |
result := IngereSec1*CC1.Ca + IngereSec2*CC2.Ca; |
3184 |
3: // Potassium |
3185 |
result := IngereSec1*CC1.K + IngereSec2*CC2.K; |
3186 |
4: // Cuivre |
3187 |
result := IngereSec1*CC1.Cu + IngereSec2*CC2.Cu; |
3188 |
5: // Zinc |
3189 |
result := IngereSec1*CC1.Zn + IngereSec2*CC2.Zn; |
3190 |
else
|
3191 |
result := 0;
|
3192 |
end;
|
3193 |
end;
|
3194 |
|
3195 |
// Calcul du digestible
|
3196 |
function CalcDigestible: Double;
|
3197 |
begin
|
3198 |
case CBRej3.ItemIndex of |
3199 |
0: // Azote |
3200 |
result := (IngereSec1*CC1.MAT*CC1.dMAT_C/100 + IngereSec2*CC2.MAT*CC2.dMAT_C/100) * 0.16; |
3201 |
1: // Phosphore |
3202 |
result := Pdig; |
3203 |
else
|
3204 |
result := 0;
|
3205 |
end;
|
3206 |
end;
|
3207 |
|
3208 |
// Calcul du d?p?t (potentiel)
|
3209 |
function CalcDepot(jour: integer): Double;
|
3210 |
var
|
3211 |
PV, PVV, PVfin, PVVfin, GMQ, PD: Double; |
3212 |
begin
|
3213 |
PV := PresSimulP.TabResult[2, jour];
|
3214 |
PVV := CalcPVV(PV); |
3215 |
PVfin := PresSimulP.TabResult[83, jour];
|
3216 |
PVVfin := CalcPVV(PVfin); |
3217 |
GMQ := PResSimulP.TabResult[84, jour];
|
3218 |
PD := PResSimulP.TabResult[79, jour];
|
3219 |
case CBRej3.ItemIndex of |
3220 |
0: // Azote |
3221 |
result := PD * 0.16;
|
3222 |
1: // Phosphore |
3223 |
result := (5.4199 - 2 * 0.002857 * PV) * GMQ; |
3224 |
2: // Calcium |
3225 |
result := -0.00180 * (Power (PVVfin, 2) - Power (PVV, 2)) + 8.64633 * (PVVfin - PVV); |
3226 |
3: // Potassium |
3227 |
result := -0.00345 * (Power (PVVfin, 2) - Power (PVV, 2)) + 2.53338 * (PVVfin - PVV); |
3228 |
4: // Cuivre |
3229 |
result := -0.00251 * (Power (PVVfin, 2) - Power (PVV, 2)) + 1.05393 * (PVVfin - PVV); |
3230 |
5: // Zinc |
3231 |
result := 21.8 * (PVVfin - PVV); |
3232 |
else
|
3233 |
result := 0;
|
3234 |
end;
|
3235 |
end;
|
3236 |
|
3237 |
// RejY
|
3238 |
begin
|
3239 |
// Diviseur
|
3240 |
case CBRej4.ItemIndex of |
3241 |
1: // Dur?e |
3242 |
d := PresSimulP.NbJSim; |
3243 |
2: // Aliment |
3244 |
begin
|
3245 |
d := 0;
|
3246 |
for h := 1 to PresSimulP.NbJSim do |
3247 |
d := d + PresSimulP.TabResult[113, h];
|
3248 |
end;
|
3249 |
else
|
3250 |
d := 1;
|
3251 |
end;
|
3252 |
v := 0;
|
3253 |
for h := 1 to PresSimulP.NbJSim do |
3254 |
begin
|
3255 |
Composition(h); |
3256 |
Ingere := CalcIngere; |
3257 |
Gaspillage := PResSimulP.TabResult[112, h];
|
3258 |
Digestible := CalcDigestible; |
3259 |
Depose := CalcDepot(h); |
3260 |
if CBRej3.ItemIndex < 2 |
3261 |
then // Azote ou phosphore |
3262 |
case i of |
3263 |
0: // Gaspillage |
3264 |
v := v + Ingere / (1 - Gaspillage) - Ingere;
|
3265 |
1: // F?cal |
3266 |
v := v + Ingere - Digestible; |
3267 |
2: // Urinaire |
3268 |
v := v + Max(Digestible - Depose, 0);
|
3269 |
4: // Retenu |
3270 |
v := v + Min(Digestible, Depose); |
3271 |
end
|
3272 |
else // Autres |
3273 |
case i of |
3274 |
0: // Gaspillage |
3275 |
v := v + Ingere / (1 - Gaspillage) - Ingere;
|
3276 |
3: // Ecr?t? |
3277 |
v := v + Max(Ingere - Depose, 0);
|
3278 |
4: // Retenu |
3279 |
v := v + Min(Ingere, Depose); |
3280 |
end;
|
3281 |
end;
|
3282 |
result := v / d; |
3283 |
end;
|
3284 |
|
3285 |
// AffGraphRej
|
3286 |
begin
|
3287 |
ResetGraph; |
3288 |
Graph.Legend.Inverted := TRUE; |
3289 |
Graph.Title.Text.Add(TabRej.Caption); |
3290 |
Graph.LeftAxis.Title.Caption := Format('%s (%s)', [CBRej3.Text, CBRej4.Text]);
|
3291 |
case FSimulP.PC.ActivePageIndex of |
3292 |
1: // Comparaison |
3293 |
Graph.BottomAxis.Title.Caption := 'Simulation';
|
3294 |
2: // Sensibilit? |
3295 |
Graph.BottomAxis.Title.Caption := 'Variation';
|
3296 |
end;
|
3297 |
// Affichage des barres
|
3298 |
BarRej[0].Active := TRUE;
|
3299 |
BarRej[1].Active := CBRej3.ItemIndex < 2; |
3300 |
BarRej[2].Active := CBRej3.ItemIndex < 2; |
3301 |
BarRej[3].Active := CBRej3.ItemIndex > 1; |
3302 |
BarRej[4].Active := TRUE;
|
3303 |
for i := 0 to ListRej.Count - 1 do |
3304 |
BarRej[i].Clear; |
3305 |
if CBRej4.ItemIndex = 3 |
3306 |
then
|
3307 |
for i := 0 to ListRej.Count - 1 do |
3308 |
BarRej[i].MultiBar := mbStacked100 |
3309 |
else
|
3310 |
for i := 0 to ListRej.Count - 1 do |
3311 |
BarRej[i].MultiBar := mbStacked; |
3312 |
for i := 0 to ListRej.Count - 1 do |
3313 |
for k := 1 to 5 do |
3314 |
if TabSimulP[k].Ok
|
3315 |
then
|
3316 |
begin
|
3317 |
PResSimulP := TabSimulP[k].Result; |
3318 |
case FSimulP.PC.ActivePageIndex of |
3319 |
1: // Comparaison |
3320 |
s := Format('%d', [k]);
|
3321 |
2: // Sensibilit? |
3322 |
if FSimulP.CBVariable.ItemIndex = 6 |
3323 |
then // Gaspillage |
3324 |
if TabSimulP[k].Variation > 0 |
3325 |
then
|
3326 |
s := Format('+%1.0f%%', [TabSimulP[k].Variation * 100]) |
3327 |
else
|
3328 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]) |
3329 |
else
|
3330 |
s := Format('%1.0f%%', [TabSimulP[k].Variation * 100]); |
3331 |
end;
|
3332 |
y := RejY; |
3333 |
if y > PICO
|
3334 |
then
|
3335 |
BarRej[i].AddBar(y, s, clTeeColor) |
3336 |
else
|
3337 |
BarRej[i].AddNull(s); |
3338 |
end;
|
3339 |
for i := 0 to ListRej.Count - 1 do |
3340 |
BarRej[i].ValueFormat := AjustFormat(AjustPas(Graph.MaxYValue(Graph.LeftAxis) - Graph.MinYValue(Graph.LeftAxis))); |
3341 |
AjustEchelle(Graph); |
3342 |
end;
|
3343 |
|
3344 |
procedure TFCompSimulP.CBRej3Change(Sender: TObject);
|
3345 |
begin
|
3346 |
CBRej4.Items.Clear; |
3347 |
if CBRej3.ItemIndex > 3 |
3348 |
then // Oligo-?l?ment |
3349 |
begin
|
3350 |
CBRej4.Items.Add(StrMG); |
3351 |
CBRej4.Items.Add(Format('%s/%s', [StrMG, StrJ]));
|
3352 |
CBRej4.Items.Add(Format('%s/%s %s', [StrMG, StrKg, StrAlimentUnit]));
|
3353 |
CBRej4.Items.Add('%');
|
3354 |
end
|
3355 |
else // Macro-?l?ment |
3356 |
begin
|
3357 |
CBRej4.Items.Add(StrG); |
3358 |
CBRej4.Items.Add(Format('%s/%s', [StrG, StrJ]));
|
3359 |
CBRej4.Items.Add(Format('%s/%s %s', [StrG, StrKg, StrAlimentUnit]));
|
3360 |
CBRej4.Items.Add('%');
|
3361 |
end;
|
3362 |
CBRej4.ItemIndex := 0;
|
3363 |
AffGraphRej; |
3364 |
end;
|
3365 |
|
3366 |
procedure TFCompSimulP.CBRej4Change(Sender: TObject);
|
3367 |
begin
|
3368 |
AffGraphRej; |
3369 |
end;
|
3370 |
|
3371 |
procedure TFCompSimulP.WMSysCommand(var Message: TWMSysCommand); |
3372 |
begin
|
3373 |
if Message.CmdType = SC_MINIMIZE
|
3374 |
then
|
3375 |
Application.Minimize |
3376 |
else
|
3377 |
inherited;
|
3378 |
end;
|
3379 |
|
3380 |
end.
|