C
C#3y ago
changffof

crankshaft rotation

I am making a program that dictates the position of the piston in millimeters with respect to the degrees of rotation of the crankshaft, the idea is that both variables, reach 0, according to the parameters that the user has set, ie the degrees of rotation to accompany the level of descent of the piston that this is in millimeters. example 90 degrees = 30mm, 89 degrees=28mm, 88 degrees =27.5mm, and so on, until both reach 0, for each degree of crankshaft rotation there are certain millimeters traveled, I would need to do some for loop, or something like that, if anyone knows help, pd: I do not know much about programming, I attach an image to what I mean this is the code: public double ConvertToRadians(double angle) { return angle * Math.PI / 180; } public double ConvertToDegree(double rad) { return rad * 180 / Math.PI; }
public void calc_Click(object sender, EventArgs e) {

double crank_angle;
double st, conrod, x, ct, alpha; st = double.Parse(textBox65.Text); conrod = double.Parse(textBox1.Text); crank_angle = double.Parse(textBox2.Text); ct = st / 2; alpha = ConvertToDegree(Math.Asin(ct * Math.Sin(ConvertToRadians(crank_angle)) / conrod)); x = conrod + ct - Math.Cos(ConvertToRadians(alpha)) * conrod - Math.Cos(ConvertToRadians(crank_angle)) * ct; textBox3.Text = string.Format("{0:N3}", x);

}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server