94 virtual std::ostream&
DescribeDof(std::ostream& out,
const char *prefix,
bool bInitial)
const;
95 virtual std::ostream&
DescribeEq(std::ostream& out,
const char *prefix,
bool bInitial)
const;
117 virtual std::ostream&
Restart(std::ostream& out)
const;
158 unsigned uLabel,
const DofOwner *pDO,
177 "Module: asynchronous_machine\n"
179 " This module implements an asynchronous electric machine\n"
182 " Maschinendynamik\n"
183 " Hans Dresig, Franz Holzweißig\n"
185 " page 58 equation 1.122 and 1.123\n"
188 " asynchronous_machine,\n"
189 " rotor, (label) <rotor_node>,\n"
190 " stator, (label) <stator_node>,\n"
191 " MK, (real) <MK>,\n"
192 " sK, (real) <sK>,\n"
193 " OmegaS, (DriveCaller) <omega_s>\n"
194 " [ , motor on , (DriveCaller) <motor_on> ]\n"
195 " [ , M0 , (real) <M0> ]\n"
196 " [ , MP0 , (real) <MP0> ]\n"
198 " MK ... breakdown torque ( MK > 0 )\n"
199 " sK ... breakdown slip ( sK > 0 )\n"
200 " OmegaS = 2 * pi * f / p * sense_of_rotation ... synchronous angular velocity\n"
201 " motor_on ... power supply is turned off when 0, on otherwise\n"
202 " M0 ... initial torque ( default 0 )\n"
203 " MP0 ... initial torque derivative ( default 0 )\n"
205 " The axis of rotation is assumed to be axis 3 of the reference frame of the stator node.\n"
215 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): keyword \"rotor\" expected at line " << HP.
GetLineData() << std::endl);
222 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): structural node expected at line " << HP.
GetLineData() << std::endl);
227 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): keyword \"stator\" expected at line " << HP.
GetLineData() << std::endl);
234 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): structural node expected at line " << HP.
GetLineData() << std::endl);
239 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): keyword \"MK\" expected at line " << HP.
GetLineData() << std::endl);
245 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): keyword \"sK\" expected at line " << HP.
GetLineData() << std::endl);
251 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): keyword \"OmegaS\" expected" << std::endl);
276 m_omega = e3.Dot(omega1 - omega2);
315 const integer intTorqueDerivativeRowIndex = iFirstIndex + 1;
316 const integer intTorqueRowIndex = iFirstIndex + 2;
317 const integer intOmegaRowIndex = iFirstIndex + 3;
320 m_M = X(intTorqueRowIndex);
321 m_dM_dt = X(intTorqueDerivativeRowIndex);
322 m_dM_dt2 = XP(intTorqueDerivativeRowIndex);
347 std::cerr << __FILE__ <<
":" << __LINE__ <<
":" << __PRETTY_FUNCTION__ << std::endl;
457 << prefix << iIndex + 1 <<
": motor torque derivative [MP]" << std::endl
458 << prefix << iIndex + 2 <<
": motor torque [M]" << std::endl
459 << prefix << iIndex + 3 <<
": relative angular velocity [omega]" << std::endl;
478 << prefix << iIndex + 1 <<
": motor DAE [f1]" << std::endl
479 << prefix << iIndex + 2 <<
": motor torque derivative [f2]" << std::endl
480 << prefix << iIndex + 3 <<
": angular velocity derivative [f9]" << std::endl;
514 static const struct {
527 for (
unsigned i = 0; i <
sizeof(data) /
sizeof(data[0]); ++i ) {
528 if (0 == strcmp(data[i].name,s)) {
529 return data[i].index;
533 silent_cerr(
"asynchronous_machine(" <<
GetLabel() <<
"): no private data \"" << s <<
"\"" << std::endl);
633 std::cerr << __FILE__ <<
':' << __LINE__ <<
':' << __PRETTY_FUNCTION__ << std::endl;
647 const integer intTorqueDerivativeColumnIndex = iFirstIndex + 1;
648 const integer intTorqueColumnIndex = iFirstIndex + 2;
649 const integer intOmegaColumnIndex = iFirstIndex + 3;
651 const integer intTorqueDerivativeRowIndex = iFirstIndex + 1;
652 const integer intTorqueRowIndex = iFirstIndex + 2;
653 const integer intOmegaRowIndex = iFirstIndex + 3;
697 WorkMat.
PutRowIndex(1, intTorqueDerivativeRowIndex);
698 WorkMat.
PutColIndex(1, intTorqueDerivativeColumnIndex);
703 for (
int iCnt = 1; iCnt <= 3; ++iCnt) {
704 WorkMat.
PutRowIndex(iCnt + 2, intRotorMomentumIndex + iCnt + 3);
705 WorkMat.
PutColIndex(iCnt + 2, intRotorPositionIndex + iCnt + 3);
707 WorkMat.
PutRowIndex(iCnt + 5, intStatorMomentumIndex + iCnt + 3);
708 WorkMat.
PutColIndex(iCnt + 5, intStatorPositionIndex + iCnt + 3);
723 const doublereal y1 = XCurr(intTorqueDerivativeRowIndex);
724 const doublereal y2 = XCurr(intTorqueRowIndex);
725 const doublereal y5 = XCurr(intOmegaRowIndex);
727 const doublereal y1_dot = XPrimeCurr(intTorqueDerivativeRowIndex);
728 const doublereal y2_dot = XPrimeCurr(intTorqueRowIndex);
730 const doublereal y5_dot = XPrimeCurr(intOmegaRowIndex);
736 silent_cerr(
"\nasynchronous_machine(" <<
GetLabel() <<
"): warning slip rate s = " << s <<
" is close to machine precision!\n");
743 doublereal df1_dy1_dot, df1_dy2_dot, df1_dy5_dot;
750 df1_dy1 = ( 2 *
m_sK +
copysign(1., OmegaS) * y5_dot / ( s *
std::pow(OmegaS,2) ) ) * abs(OmegaS);
762 df1_dy5 = df1_ds * ( -1. / OmegaS );
764 df1_dy5_dot = y1 / ( s * OmegaS ) +
copysign(1., OmegaS) * y2 *
m_sK / s;
782 const Vec3 df4_dy2 = -df3_dy2;
786 const Mat3x3 df4_dy4 = -df3_dy4;
790 const Vec3 df5_dy3_dot_T = -e3;
792 const Vec3 df5_dy4_dot_T = -df5_dy3_dot_T;
794 const Vec3 df5_dy3_T = -omega1_ref.
Cross(e3);
796 const Vec3 df5_dy4_T = ( omega1 - omega2 ).
Cross( e3_0 ) + omega2_ref.
Cross( e3 );
798 WorkMat.
PutCoef( 1, 1, -df1_dy1_dot - dCoef * df1_dy1 );
799 WorkMat.
PutCoef( 1, 2, - dCoef * df1_dy2 );
800 WorkMat.
PutCoef( 1, 9, -df1_dy5_dot - dCoef * df1_dy5 );
801 WorkMat.
PutCoef( 2, 1, - dCoef * df2_dy1 );
802 WorkMat.
PutCoef( 2, 2, -df2_dy2_dot );
803 WorkMat.
Put( 3, 2, df3_dy2 * ( -dCoef ) );
804 WorkMat.
Put( 3, 6, df3_dy4 * ( -dCoef ) );
805 WorkMat.
Put( 6, 2, df4_dy2 * ( -dCoef ) );
806 WorkMat.
Put( 6, 6, df4_dy4 * ( -dCoef ) );
807 WorkMat.
PutT( 9, 3, -df5_dy3_dot_T + df5_dy3_T * ( -dCoef ) );
808 WorkMat.
PutT( 9, 6, -df5_dy4_dot_T + df5_dy4_T * ( -dCoef ) );
809 WorkMat.
PutCoef( 9, 9, df5_dy5 * ( -dCoef ) );
812 std::cerr << __FILE__
":" << __LINE__ <<
":" << __PRETTY_FUNCTION__ << std::endl;
813 std::cerr <<
"s = " << s << std::endl;
814 std::cerr <<
"WorkMat=" << std::endl
815 << WorkMat << std::endl << std::endl;
877 std::cerr << __FILE__ <<
':' << __LINE__ <<
':' << __PRETTY_FUNCTION__ << std::endl;
888 const integer intTorqueDerivativeRowIndex = iFirstIndex + 1;
889 const integer intTorqueRowIndex = iFirstIndex + 2;
890 const integer intOmegaRowIndex = iFirstIndex + 3;
895 WorkVec.
PutRowIndex(1, intTorqueDerivativeRowIndex);
898 for (
int iCnt = 1; iCnt <= 3; ++iCnt) {
899 WorkVec.
PutRowIndex(iCnt + 2, intRotorMomentumIndex + iCnt + 3);
900 WorkVec.
PutRowIndex(iCnt + 5, intStatorMomentumIndex + iCnt + 3);
911 const doublereal y1 = XCurr(intTorqueDerivativeRowIndex);
912 const doublereal y2 = XCurr(intTorqueRowIndex);
913 const doublereal y5 = XCurr(intOmegaRowIndex);
914 const doublereal y1_dot = XPrimeCurr(intTorqueDerivativeRowIndex);
915 const doublereal y2_dot = XPrimeCurr(intTorqueRowIndex);
916 const doublereal y5_dot = XPrimeCurr(intOmegaRowIndex);
922 silent_cerr(
"\nasynchronous_machine(" <<
GetLabel() <<
"): warning slip rate s = " << s <<
" is close to machine precision!\n");
932 f1 = y1_dot + ( 2 *
m_sK +
copysign(1., OmegaS) * y5_dot / ( s *
std::pow(OmegaS,2) ) ) * y1 * abs(OmegaS)
949 WorkVec.
Put( 3, f3 );
950 WorkVec.
Sub( 6, f3 );
955 << __FILE__
":" << __LINE__ <<
":" << __PRETTY_FUNCTION__ << std::endl
956 <<
"s = " << s << std::endl
957 <<
"y1 = " << y1 << std::endl
958 <<
"y1_dot = " << y1_dot << std::endl
959 <<
"y2 = " << y2 << std::endl
960 <<
"y2_dot = " << y2_dot << std::endl
961 <<
"f1 = " << f1 << std::endl
962 <<
"f2 = " << f2 << std::endl
963 <<
"f3 = " << f3 << std::endl
964 <<
"f4 = " << -f3 << std::endl
965 <<
"f5 = " << f5 << std::endl
966 <<
"WorkVec=" << std::endl
967 << WorkVec << std::endl << std::endl;
1023 out <<
"asynchronous_machine, "
1026 "MK, " <<
m_MK <<
", "
1027 "sK, " <<
m_sK <<
", "
1093 std::cerr << __FILE__ <<
":"<< __LINE__ <<
":"<< __PRETTY_FUNCTION__ << std::endl;
1098 if (!
SetUDE(
"asynchronous_machine", rf)) {
1106 #ifndef STATIC_MODULES
1120 silent_cerr(
"asynchronous_machine: "
1121 "module_init(" << module_name <<
") "
1122 "failed" << std::endl);
1131 #endif // ! STATIC_MODULES
flag fReadOutput(MBDynParser &HP, const T &t) const
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
void PutColIndex(integer iSubCol, integer iCol)
virtual unsigned int iGetNumPrivData(void) const
This member function is called when a bind statement or a element drive is used to access private dat...
Vec3 Cross(const Vec3 &v) const
virtual const Mat3x3 & GetRRef(void) const
virtual bool bToBeOutput(void) const
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
#define MBDYN_EXCEPT_ARGS
virtual void ResizeReset(integer)
const MatCross_Manip MatCross
FullSubMatrixHandler & SetFull(void)
virtual const Mat3x3 & GetRCurr(void) const
void PutT(integer iRow, integer iCol, const Vec3 &v)
asynchronous_machine(unsigned uLabel, const DofOwner *pDO, DataManager *pDM, MBDynParser &HP)
Constructs the element from the information in the input file.
bool IsMotorOn(void) const
If a drive caller has been specified in the input file the value returned by the drive caller is used...
doublereal Dot(const Vec3 &v) const
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
This member function implements the equation of an asynchronous machine according to Maschinendynamik...
virtual void Sub(integer iRow, const Vec3 &v)
void Put(integer iRow, integer iCol, const Vec3 &v)
const StructNode * m_pStatorNode
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Vec3 GetCol(unsigned short int i) const
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Computes the contribution to the jacobian matrix .
virtual DofOrder::Order GetDofType(unsigned int i) const
The type of the equation of the private degrees of freedom is determined by this member function...
virtual const Vec3 & GetWRef(void) const
std::vector< Hint * > Hints
virtual void Update(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
This member function is called after each iteration in the nonlinear solution phase.
virtual std::ostream & Restart(std::ostream &out) const =0
virtual void Output(OutputHandler &OH) const
Writes private data to a file at each time step.
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual int iGetNumConnectedNodes(void) const
This member function is called if the statement "print: node connection;" is specified in the input f...
virtual doublereal dGetPrivData(unsigned int i) const
This member function is called whenever a bind statement or a element drive is used to access private...
int module_init(const char *module_name, void *pdm, void *php)
This function registers our user defined element for the math parser.
const StructNode * m_pRotorNode
virtual bool IsKeyWord(const char *sKeyWord)
bool asynchronous_machine_set(void)
std::ostream & Loadable(void) const
doublereal copysign(doublereal x, doublereal y)
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix, bool bInitial) const
This member function is called if the statement "print: dof description;" is specified in the input f...
virtual ~asynchronous_machine(void)
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
virtual const Vec3 & GetWCurr(void) const
virtual void SetInitialValue(VectorHandler &X)
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
DriveCaller * pGetDriveCaller(void) const
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
This member function is called if the statement "print: node connection;" is specified in the input f...
virtual void ResizeReset(integer, integer)
virtual void AfterPredict(VectorHandler &X, VectorHandler &XP)
virtual void Put(integer iRow, const Vec3 &v)
static const doublereal sm_SingTol
void PutRowIndex(integer iSubRow, integer iRow)
std::ostream & GetLogFile(void) const
bool SetUDE(const std::string &s, UserDefinedElemRead *rude)
void Set(const DriveCaller *pDC)
doublereal dGet(const doublereal &dVar) const
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
The size of the contribution to the residual and the jacobian matrix is determined by this member fun...
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix, bool bInitial) const
This member function is called if the statement "print: equation description;" is specified in the in...
DriveCaller * GetDriveCaller(bool bDeferred=false)
virtual unsigned int iGetInitialNumDof(void) const
This member function must be implemented only if the initial assembly feature is requested.
virtual std::ostream & Restart(std::ostream &out) const
This member function is called if "make restart file;" is specified in the input file.
virtual void SetOutputFlag(flag f=flag(1))
virtual integer iGetFirstIndex(void) const
virtual unsigned int iGetPrivDataIdx(const char *s) const
The following string values can be specified in a bind statement or in an element drive caller...
virtual HighParser::ErrOut GetLineData(void) const
unsigned int GetLabel(void) const
Node * ReadNode(MBDynParser &HP, Node::Type type) const
virtual unsigned int iGetNumDof(void) const
The number of private degrees of freedom is determined by this member function.
bool UseText(int out) const
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph)
This member function is called before the integration starts in order to set the initial values for t...
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
virtual doublereal GetReal(const doublereal &dDefval=0.0)