//
// textBox43
// >textBox43->Location = System::Drawing::Point(135, 182);>textBox43->Margin = System::Windows::Forms::Padding(3, 10, 3, 3);>textBox43->Name = L"textBox43";>textBox43->Size = System::Drawing::Size(80, 20);>textBox43->TabIndex = 173;>textBox43->Text = L"2";
//
// textBox44
// >textBox44->Location = System::Drawing::Point(135, 149);>textBox44->Margin = System::Windows::Forms::Padding(3, 10, 3, 3);>textBox44->Name = L"textBox44";>textBox44->Size = System::Drawing::Size(80, 20);>textBox44->TabIndex = 172;>textBox44->Text = L"0";
//
// textBox45
// >textBox45->Location = System::Drawing::Point(135, 116);>textBox45->Margin = System::Windows::Forms::Padding(3, 10, 3, 3);>textBox45->Name = L"textBox45";>textBox45->Size = System::Drawing::Size(80, 20);>textBox45->TabIndex = 171;>textBox45->Text = L"-2";
//
// textBox46
// >textBox46->Location = System::Drawing::Point(135, 83);>textBox46->Margin = System::Windows::Forms::Padding(3, 10, 3, 3);>textBox46->Name = L"textBox46";>textBox46->Size = System::Drawing::Size(80, 20);>textBox46->TabIndex = 170;>textBox46->Text = L"6";
//
// textBox47
// >textBox47->Location = System::Drawing::Point(135, 50);>textBox47->Margin = System::Windows::Forms::Padding(3, 10, 3, 3);>textBox47->Name = L"textBox47";>textBox47->Size = System::Drawing::Size(80, 20);>textBox47->TabIndex = 169;>textBox47->Text = L"11";
//
// textBox48
// >textBox48->Location = System::Drawing::Point(135, 17);>textBox48->Margin = System::Windows::Forms::Padding(3, 10, 3, 3);>textBox48->Name = L"textBox48";>textBox48->Size = System::Drawing::Size(80, 20);>textBox48->TabIndex = 168;>textBox48->Text = L"5";
//
// button12
// >button12->Location = System::Drawing::Point(312, 37);>button12->Name = L"button12";>button12->Size = System::Drawing::Size(115, 33);>button12->TabIndex = 167;>button12->Text = L"Старт";>button12->UseVisualStyleBackColor = true;>button12->Click += gcnew System::EventHandler(this, &Form1::button12_Click);
//
// textBox1
// >textBox1->Location = System::Drawing::Point(135, 287);>textBox1->Name = L"textBox1";>textBox1->Size = System::Drawing::Size(80, 20);>textBox1->TabIndex = 198;>textBox1->Text = L"0";
//
// label1
// >label1->AutoSize = true;>label1->Location = System::Drawing::Point(9, 290);>label1->Name = L"label1";>label1->Size = System::Drawing::Size(83, 13);>label1->TabIndex = 199;>label1->Text = L"Координата yD";
//
// label2
// >label2->AutoSize = true;>label2->Location = System::Drawing::Point(229, 294);>label2->Name = L"label2";>label2->Size = System::Drawing::Size(27, 13);>label2->TabIndex = 200;>label2->Text = L", см";
//
// Form1
// >AutoScaleDimensions = System::Drawing::SizeF(6, 13);>AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;>ClientSize = System::Drawing::Size(1136, 750);>Controls->Add(this->label2);>Controls->Add(this->label1);>Controls->Add(this->textBox1);>Controls->Add(this->label105);>Controls->Add(this->label88);>Controls->Add(this->label89);>Controls->Add(this->textBox41);>Controls->Add(this->label90);>Controls->Add(this->label91);>Controls->Add(this->textBox42);>Controls->Add(this->button11);>Controls->Add(this->label92);>Controls->Add(this->label93);>Controls->Add(this->label94);>Controls->Add(this->label95);>Controls->Add(this->label96);>Controls->Add(this->label97);>Controls->Add(this->label98);>Controls->Add(this->label99);>Controls->Add(this->label100);>Controls->Add(this->label101);>Controls->Add(this->label102);>Controls->Add(this->label103);>Controls->Add(this->label104);>Controls->Add(this->textBox43);>Controls->Add(this->textBox44);>Controls->Add(this->textBox45);>Controls->Add(this->textBox46);>Controls->Add(this->textBox47);>Controls->Add(this->textBox48);>Controls->Add(this->button12);>Controls->Add(this->dataGridView1);>Controls->Add(this->pictureBox2);>Controls->Add(this->pictureBox1);>DoubleBuffered = true;>Name = L"Form1";>Text = L"Механизмы";>Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox2))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView1))->EndInit();>ResumeLayout(false);>PerformLayout();
}
#pragma endregionAB, BC, BM, CD;xA, yA, xB, yB, xC, yC, xM, yM, xD, yD;w, l, alfa, R;a, b, c, d, k, h;t, delta_t;j; xC_now, yC_now, xB_now, yB_now, xM_now, yM_now, xC_before, yC_before, xB_before, yB_before, xM_before, yM_before;VxC, VyC, VxB, VyB, wBC;^canvas; ^canvas1; ^colour;^pen;::Drawing::Font ^font;^img;^br; ::IO::FileInfo ^Info;::IO::StreamWriter ^Writer;: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { = this->pictureBox1->CreateGraphics();
canvas1 = this->pictureBox2->CreateGraphics();= gcnew Color(); = gcnew Pen(colour->Blue);= gcnew System::Drawing::Font(System::Drawing::FontFamily::GenericSansSerif,12,System::Drawing::FontStyle::Regular);>pictureBox1->Image = img->FromFile("Image.bmp");>dataGridView1->ColumnCount = 8;
j = 0;
}Calculation() { {= Double::Parse(this->textBox48->Text);= Double::Parse(this->textBox47->Text); = Convert::ToDouble(this->textBox46->Text); = Double::Parse(this->textBox45->Text);= Double::Parse(this->textBox44->Text);= Double::Parse(this->textBox43->Text);= Double::Parse(this->textBox42->Text);= Double::Parse(this->textBox1->Text);= Double::Parse(this->textBox41->Text);
}(System::FormatException ^e) {>timer6->Enabled = false;::Show("Ошибка ввода.", "Ошибка", MessageBoxButtons::OK, MessageBoxIcon::None);
}= alfa*3.14/180;= xA+AB*Math::Cos(w*t);= yA+AB*Math::Sin(w*t);= Math::Tan(alfa);= 1+k*k;= -k*xD;= 2*(k*(h-yB)-xB);= xB*xB-BC*BC+(h-yB)*(h-yB);= b*b-4*a*c;(d < 0) {>timer6->Enabled = false; >textBox48->Text = "5";>textBox47->Text = "11";>textBox46->Text = "6";>textBox45->Text = "-2";>textBox44->Text = "0";>textBox43->Text = "2";>textBox42->Text = "2";>textBox41->Text = "-20";>textBox1->Text = "0";::Show("Некорректные данные.", "Ошибка", MessageBoxButtons::OK, MessageBoxIcon::None); ;
}= (-b+Math::Sqrt(d))/(2*a);= k*xC+h;= (BM/BC)*(xC-xB)+xB;= (BM/BC)*(yC-yB)+yB;
}Animation() {= Brushes::Black;>DrawLine(pen,50,0,50,this->pictureBox1->Height); >DrawLine(pen,0,200,this->pictureBox1->Width,200); >DrawString("0",font,br,50,200); >DrawString("y",font,br,50,0);>DrawString("x",font,br,this->pictureBox1->Width-20,200); //Оси и подписи.>DrawLine(pen,(xA*20)+50,(-yA*20)+200,(xA*20)+45,(-yA*20)+210);>DrawLine(pen,(xA*20)+45,(-yA*20)+210,(xA*20)+55,(-yA*20)+210);>DrawLine(pen,(xA*20)+55,(-yA*20)+210,(xA*20)+50,(-yA*20)+200); //Крепление точки А.>DrawLine(pen,(xA*20)+50,(-yA*20)+200,(xB*20)+50,(-yB*20)+200);>DrawLine(pen,(xB*20)+50,(-yB*20)+200,(xC*20)+50,(-yC*20)+200); //Саммеханизм.
canvas->DrawRectangle(pen,(xC*20)+35,-(yC*20)+193,30.0,14.0); //Рисуем прямоугольник текущим пером по координатам верхнего левого угла, ширины и высоты.
canvas->DrawString("A",font,br,(xA*20)+50,(-yA*20)+200);>DrawString("B",font,br,(xB*20)+50,(-yB*20)+200);>DrawString("C",font,br,(xC*20)+50,(-yC*20)+200);>DrawString("M",font,br,(xM*20)+50,(-yM*20)+200); // Подписи точек.= Brushes::Red;>FillEllipse(br,(xC*20)+48,(-yC*20)+198,4.0,4.0);= Brushes::Green;>FillEllipse(br,(xB*20)+48,(-yB*20)+198,4.0,4.0);= Brushes::Purple;>FillEllipse(br,(xM*20)+48,(-yM*20)+198,4.0,4.0); //Точки.
}Graphic() {++; ->DrawLine(pen,50,0,50,this->pictureBox1->Height); ->DrawLine(pen,0,200,this->pictureBox1->Width,200); ->DrawString("0",font,br,50,200); ->DrawString("y",font,br,50,0);->DrawString("x",font,br,this->pictureBox1->Width-20,200); //Оси и подписи.= Brushes::Red;->FillEllipse(br,(xC*20)+48,(-yC*20)+198,4.0,4.0);= Brushes::Green;->FillEllipse(br,(xB*20)+48,(-yB*20)+198,4.0,4.0);= Brushes::Purple;->FillEllipse(br,(xM*20)+48,(-yM*20)+198,4.0,4.0);(j == 78 ) {->Clear(colour->White);= 0;
}
}Velocity() {= (xB_now-xB_before)/delta_t;= (yB_now-yB_before)/delta_t;= (xC_now-xC_before)/delta_t;= (yC_now-yC_before)/delta_t;= (xC-xB)*(VyC-VyB)-(yC-yB)*(VxC-VxB);
}Table() {_t = 1;(t <= (2*Math::PI/w)+1) {>dataGridView1->Rows[0]->Cells[0]->Value = "t";>dataGridView1->Rows[0]->Cells[1]->Value = "xB";>dataGridView1->Rows[0]->Cells[2]->Value = "yB";>dataGridView1->Rows[0]->Cells[3]->Value = "xC";>dataGridView1->Rows[0]->Cells[4]->Value = "yC";>dataGridView1->Rows[0]->Cells[5]->Value = "xM";>dataGridView1->Rows[0]->Cells[6]->Value = "yM";>dataGridView1->Rows[0]->Cells[7]->Value = "wBC";>dataGridView1->Rows[t]->Cells[0]->Value = Convert::ToString(Math::Round(t,4));>dataGridView1->Rows[t]->Cells[1]->Value = Convert::ToString(Math::Round(xB,4));>dataGridView1->Rows[t]->Cells[2]->Value = Convert::ToString(Math::Round(yB,4));>dataGridView1->Rows[t]->Cells[3]->Value = Convert::ToString(Math::Round(xC,4));>dataGridView1->Rows[t]->Cells[4]->Value = Convert::ToString(Math::Round(yC,4));>dataGridView1->Rows[t]->Cells[5]->Value = Convert::ToString(Math::Round(xM,4));>dataGridView1->Rows[t]->Cells[6]->Value = Convert::ToString(Math::Round(yM,4));(t >= 2) {_now = Convert::ToDouble(this->dataGridView1->Rows[t]->Cells[3]->Value);_before = Convert::ToDouble(this->dataGridView1->Rows[t-1]->Cells[3]->Value);_now = Convert::ToDouble(this->dataGridView1->Rows[t]->Cells[4]->Value);_before = Convert::ToDouble(this->dataGridView1->Rows[t-1]->Cells[4]->Value);_now = Convert::ToDouble(this->dataGridView1->Rows[t]->Cells[1]->Value);_before = Convert::ToDouble(this->dataGridView1->Rows[t-1]->Cells[1]->Value);_now = Convert::ToDouble(this->dataGridView1->Rows[t]->Cells[2]->Value);_before = Convert::ToDouble(this->dataGridView1->Rows[t-1]->Cells[2]->Value);();>dataGridView1->Rows[t-1]->Cells[7]->Value = Convert::ToString(Math::Round(wBC,4));
}
}
}ToFile() {= gcnew System::IO::FileInfo(Application::StartupPath+"\\File.txt");= Info->CreateText();= 0;();_before = xB;_before = yB;_before = xC;_before = yC;_before = xM;_before = yM;_t = (2*Math::PI/w)/1000;>WriteLine("t" + " | " + "xB" + " | " + "yB" + " | " + "xC" + " | " + "yC" + " | " + "xM" + " | " + "yM" + " | " + "wBC");(t = delta_t; t <= 2*Math::PI/w; t = t+delta_t) {();_now = xC;_now = yC;_now = xB;_now = yB;_now = xM;_now = yM;();>WriteLine(Convert::ToString(Math::Round(t-delta_t,4)) + " | " + Convert::ToString(Math::Round(xB_before,4))
+ " | " + Convert::ToString(Math::Round(yB_before,4)) + " | " + Convert::ToString(Math::Round(xC_before,4))
+ " | " + Convert::ToString(Math::Round(yC_before,4)) + " | " + Convert::ToString(Math::Round(xM_before,4))
+ " | " + Convert::ToString(Math::Round(yM_before,4)) + " | " + Convert::ToString(Math::Round(wBC,4)));_before = xC;_before = yC;_before = xB;_before = yB;_before = xM;_before = yM;
}>Close();
}: System::Void button12_Click(System::Object^ sender, System::EventArgs^ e) {>timer6->Enabled = true;();>dataGridView1->RowCount = Math::Truncate(2*Math::PI/w)+2;
canvas1->Clear(colour->White);
t = 0;
}: System::Void timer6_Tick(System::Object^ sender, System::EventArgs^ e) {>Clear(Color::White);++;();();();();
}
};
}
4.
Результаты расчетов
Таблица 1 - Результаты
расчетов
t
xB
yB
xC
yC
xM
yM
wBC
0
3
0
13,2154
-4,0798
8,5721
-2,2254
-103,308
0,0031
2,9999
0,0314
13,2043
-4,0758
8,566
-2,2089
-103,0779
0,0063
2,9996
0,0628
13,193
-4,0717
8,5597
-2,1924
-102,842
0,0094
2,9991
0,0942
13,1815
-4,0675
8,5531
-2,1758
-102,6045
0,0126
2,9984
0,1257
13,1696
-4,0632
8,5464
-2,1592
-102,3641
0,0157
2,9975
0,1571
13,1576
-4,0588
8,5394
-2,1425
-102,1174
0,0188
2,9964
0,1885
13,1453
-4,0543
8,5322
-2,1258
-101,8708
0,022 0,2198
13,1327
-4,0498
8,5248
-2,109
-101,6201
0,0251
2,9937
0,2512
13,12
-4,0451
8,5171
-2,0922
-101,3632
0,0283
2,992
0,2826
13,1069
-4,0404
8,5092
-2,0754
-101,1046
3,1071
2,9881
-0,345
13,3207
-4,1181
8,6241
-2,4031
-105,6267
3,1102
2,9902
-0,3136
13,3124
-4,1151
8,6205
-2,3872
-105,4328
3,1133
2,992
-0,2823
13,3038
-4,112
8,6166
-2,3712
-105,2357
3,1165
2,9937
-0,2509
13,295
-4,1088
8,6126
-2,3552
-105,036
3,1196
2,9952
-0,2195
13,2859
-4,1055
8,6083
-2,3391
-104,8311
3,1228
2,9965
-0,1881
13,2766
-4,1021
8,6038
-2,323
-104,6223 2,9975
-0,1567
13,267
-4,0986
8,5991
-2,3068
-104,4135
3,1291
2,9984
-0,1253
13,2572
-4,095
8,5941
-2,2906
-104,1984
3,1322
2,9991
-0,0939
13,2471
-4,0913
8,5889
-2,2743
-103,9802
3,1353
2,9996
-0,0625
13,2367
-4,0876
8,5835
-2,258
-103,7602
кривошипный кинематика программа
Заключение
Создана оболочка моделирования работы кривошипно-шатунного механизма
методами объектно-ориентированного программирования:
Рисунок 2 - Оболочка моделирования работы кривошипно-шатунного механизма
в среде Visual Studio 2013 C++
На основании исследованной кинематики и параметров механизма была
приведена схема механизма, создана анимация его движения и график движения
основных точек:
Рисунок 3 - Параметры и схема механизма, анимация движения механизма,
график движения точек В, С, М.
В пояснительной записке приведена таблица с требующимися данными:
координаты точек В, С, и М, скорость точки М.
Следовательно, поставленные задачи решены.
Библиографический список
Моделирование движения плоского механизма /сост. А.А. Лысова.
- Челябинск: Изд. ЮУрГУ, 2013. - 170 с.