1線地絡時の起誘導電流についてはここ。
この記事で作ったクラスを改造して電流を複素数で入力できるようにする。
complexを読み込んでsetInducingCurrentdotを作った。引数は実部と虚部。型はdouble。
InductiveInterference.h
#pragma once
#include<iostream>
#include<ccomplex>
class InductiveInterference
{
public:
InductiveInterference(std::string name,
double omega, double M, double D) {
m_name = name;
m_omega = omega;
m_M = M;
m_D = D;
m_I0 = 0.0;
m_Vm = 0.0;
}
~InductiveInterference() {
}
void setInducingCurrentdot(double x, double y) {
std::complex<double> i_dot(x, y);
m_i0dot = i_dot;
}
void setInducingCurrent(double I0) {
m_I0 = I0;
}
void setInducingVoltage(double Vm) {
m_Vm = Vm;
}
double getInducingCurrent(void) {
return m_Vm / (m_omega * m_M * m_D);
}
void showInducingCurrent(void) {
std::cout << "I -> " << getInducingCurrent() << "[A]" << std::endl;
}
void showInducingCurrentdot(void) {
std::cout << "I -> " << m_i0dot.real() << "+j" << m_i0dot.imag() << "[A]" << std::endl;
}
private:
std::string m_name;
double m_omega;
double m_M;
double m_D;
double m_I0;
double m_Vm;
std::complex<float> m_i0dot;
};
main.cpp
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include "InductiveInterference.h"
#include<ccomplex>
int main() {
std::complex<double> c(1.0f, 2.0f);
InductiveInterference wire1("wire1", 2 * M_PI * 60, 1, 1);
wire1.setInducingCurrentdot(1, 2);
wire1.showInducingCurrentdot();
return 0;
}
実行結果
I -> 1+j2[A]
コメント