-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathim58calibration.cpp
54 lines (50 loc) · 1.71 KB
/
im58calibration.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "im58calibration.h"
#include "im58main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm7 *Form7;
extern TTest test;
extern TTest currentTest;
//---------------------------------------------------------------------------
__fastcall TForm7::TForm7(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm7::FormCreate(TObject *Sender)
{
sg1->Cells[0][0]="Óñòàíîâèòü";
sg1->Cells[1][0]="Ðåãèñòðàòîð";
sg1->Cells[2][0]="Äèíàìîìåòð";
sg1->ColWidths[0]=sg1->Canvas->TextWidth(sg1->Cells[0][0])+16;
sg1->ColWidths[1]=sg1->Canvas->TextWidth(sg1->Cells[1][0])+16;
sg1->ColWidths[2]=sg1->Canvas->TextWidth(sg1->Cells[2][0])+16;
sg1->Width=sg1->ColWidths[0]+sg1->ColWidths[1]+sg1->ColWidths[2]+6;
for(int i=1;i<=sg1->RowCount;i++)
{
sg1->Cells[0][i]=IntToStr(i*20);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm7::btn1Click(TObject *Sender)
{
double Xtotal,Ytotal;
for(int i=1;i<sg1->RowCount;i++)
{
if(sg1->Cells[1][i]!=""&&sg1->Cells[2][i]!="")
{
Series1->AddXY(sg1->Cells[1][i].ToDouble(),sg1->Cells[2][i].ToDouble());
Xtotal+=sg1->Cells[1][i].ToDouble();
Ytotal+=sg1->Cells[2][i].ToDouble();
}
Series2->AddXY(Xtotal,Ytotal);
test.force_k=Ytotal/Xtotal;
currentTest.force_k=test.force_k;
}
lbl1->Caption=FloatToStr(test.force_k);
}
//---------------------------------------------------------------------------