これの続き。結果は過去記事と同じ。
ソースコード。
#include <iostream>
#define pi 3.14
class IM {
public:
std::string name = "";
double r1 = 0.0;
double r2 = 0.0;
double x1 = 0.0;
double x2 = 0.0;
double s = 0.0;
double V = 0.0;
double I = 0.0;
double P = 0.0;
double T = 0.0;
double N = 0.0;
double Ns = 0.0;
void show(void) {
std::cout << "r1->" << r1 << std::endl;
std::cout << "r2->" << r2 << std::endl;
std::cout << "x1->" << x1 << std::endl;
std::cout << "x2->" << x2 << std::endl;
std::cout << "s->" << s << std::endl;
std::cout << "V->" << V << std::endl;
std::cout << "I->" << I << std::endl;
}
};
double torque(IM motor) {
return motor.P / (2 * pi * motor.N / 60);
}
double current(IM motor) {
double Z, R, X;
R = motor.r1 + motor.r2 / motor.s;
X = motor.x1 + motor.x2;
Z = sqrt(std::pow(R, 2) + std::pow(X, 2));
return motor.V / (sqrt(3) * Z);
}
int main() {
double P0;
IM motor1;
motor1.r1 = 0.1;
motor1.r2 = 0.15;
motor1.x1 = 0.3;
motor1.x2 = 0.4;
motor1.s = 0.05;
motor1.V = 200;
motor1.P = 15000;
motor1.N = 1440;
motor1.T = torque(motor1);
std::cout << "T -> " << motor1.T << std::endl;
return 0;
}
コメント