78 const char* sKeyWords[] = {
85 "cross" "spring" "support",
88 "state" "space" "SISO",
89 "state" "space" "MIMO",
121 switch (CurrKeyWord) {
132 fCollLimits =
flag(1);
141 flag fForeAftLimits(0);
145 fForeAftLimits =
flag(1);
158 fLatLimits =
flag(1);
177 dDynCoef = HP.
GetReal(dDynCoef);
182 dCyclFact = HP.
GetReal(dCyclFact);
187 dCollFact = HP.
GetReal(dCollFact);
198 pNode1, pNode2, pNode3,
216 const Rotor* pRot = 0;
240 if (dRadius < std::numeric_limits<doublereal>::epsilon()) {
241 silent_cerr(
"RotorTrim(" << uLabel <<
"): "
242 "invalid rotor radius at line " << HP.
GetLineData() << std::endl);
251 silent_cout(
"RotorTrim(" << uLabel <<
"): "
252 "keyword \"rotor\" expected at line " << HP.
GetLineData() << std::endl);
258 if (dRadius < std::numeric_limits<doublereal>::epsilon()) {
259 silent_cerr(
"RotorTrim(" << uLabel <<
"): "
260 "invalid rotor radius for Rotor(" << pRot->
GetLabel() <<
") "
272 <<
" linked to rotor " << pRot->
GetLabel() << std::endl
273 <<
"abstract nodes: "
274 << pvNodes[0]->GetLabel() <<
", "
275 << pvNodes[1]->GetLabel() <<
", "
276 << pvNodes[2]->GetLabel() << std::endl);
284 DEBUGCOUT(
"Gamma: " << dGamma << std::endl);
290 DEBUGCOUT(
"Tau0: " << dTau0 << std::endl);
293 DEBUGCOUT(
"Tau1: " << dTau1 << std::endl);
296 DEBUGCOUT(
"Kappa0: " << dKappa0 << std::endl);
299 DEBUGCOUT(
"Kappa1: " << dKappa1 << std::endl);
315 pvNodes[0], pvNodes[1], pvNodes[2],
316 pvDrives[0], pvDrives[1], pvDrives[2],
318 dTau0, dTau1, dKappa0, dKappa1,
326 pThrust, pRollMoment, pPitchMoment,
327 pAP, dRadius, pOmega, pMu,
328 pvNodes[0], pvNodes[1], pvNodes[2],
329 pvDrives[0], pvDrives[1], pvDrives[2],
331 dTau0, dTau1, dKappa0, dKappa1,
339 silent_cerr(
"GenelClamp(" << uLabel <<
"): "
340 "parameter nodes are not allowed "
347 silent_cerr(
"GenelClamp(" << uLabel <<
"): "
348 "illegal order " << SD.
iOrder
367 silent_cerr(
"GenelDistance(" << uLabel <<
"): "
368 "parameter nodes not allowed "
376 silent_cerr(
"GenelDistance(" << uLabel <<
"): "
377 "illegal order " << SD1.
iOrder
378 <<
" for ScalarDof 1 "
386 silent_cerr(
"GenelDistance(" << uLabel <<
"): "
387 "parameter nodes not allowed "
395 silent_cerr(
"GenelDistance(" << uLabel <<
"): "
396 "illegal order " << SD2.
iOrder
397 <<
" for ScalarDof 2 "
416 silent_cerr(
"GenelSpring(" << uLabel <<
"): "
417 "parameter nodes not allowed for ScalarDof 1 "
424 silent_cerr(
"GenelSpring(" << uLabel <<
"): "
425 "illegal order " << SD1.
iOrder
426 <<
" for ScalarDof 1 "
434 silent_cerr(
"GenelSpring(" << uLabel <<
"): "
435 "parameter nodes not allowed for ScalarDof 2 "
442 silent_cerr(
"GenelSpring(" << uLabel <<
"): "
443 "illegal order " << SD2.
iOrder
444 <<
" for ScalarDof 2 "
454 silent_cerr(
"GenelSpring(" << uLabel <<
"): "
455 "support dynamic constitutive laws "
463 silent_cerr(
"GenelSpring(" << uLabel <<
"): "
464 "only elastic constitutive laws allowed "
478 case SPRINGSUPPORT: {
481 silent_cerr(
"GenelSpringSupport(" << uLabel <<
"): "
482 "parameter nodes not allowed for ScalarDof "
491 silent_cerr(
"GenelSpringSupport(" << uLabel <<
"): "
492 "illegal order " << SD.
iOrder
493 <<
" for ScalarDof; the algebraic value "
494 "of a differential node is required "
503 silent_cerr(
"GenelSpringSupport(" << uLabel <<
"): "
504 "only elastic constitutive laws allowed "
539 silent_cerr(
"You shouldn't be here!" << std::endl);
545 case CROSSSPRINGSUPPORT: {
549 "GenelCrossSpringSupport(" << uLabel <<
"): "
550 "parameter nodes not allowed for ScalarDof 1 "
558 "GenelCrossSpringSupport(" << uLabel <<
"): "
559 "illegal order " << SDRow.
iOrder
560 <<
" for ScalarDof 1 "
571 "GenelCrossSpringSupport(" << uLabel <<
"): "
572 "parameter nodes not allowed for ScalarDof "
582 "GenelCrossSpringSupport(" << uLabel <<
"): "
583 "illegal order " << SDCol.
iOrder
584 <<
" for ScalarDof; the algebraic value "
585 "of a differential node is required "
596 "GenelCrossSpringSupport(" << uLabel <<
"): "
597 "dynamic constitutive laws not supported "
610 SDRow, SDCol, fOut));
618 SDRow, SDCol, fOut));
622 silent_cerr(
"You shouldn't be here!" << std::endl);
631 silent_cerr(
"GenelMass(" << uLabel <<
"): "
632 "parameter nodes not allowed for ScalarDof "
639 silent_cerr(
"GenelMass(" << uLabel <<
"): "
640 "illegal order " << SD.
iOrder
641 <<
" for ScalarDof 1 "
648 silent_cerr(
"GenelMass(" << uLabel <<
"): "
649 "only differential dofs allowed for ScalarDof "
665 case STATESPACESISO: {
668 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
669 "parameter nodes not allowed "
670 "for output ScalarDof (y) "
677 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
678 "illegal order " << SD_y.
iOrder
679 <<
" for output ScalarDof (y) "
689 <<
" is of order " << Order << std::endl);
697 for (
unsigned int i = 0; i < Order*
Order; i++) {
703 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
713 for (
unsigned int i = 0; i < Order*
Order; i++) {
718 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
728 for (
unsigned int i = 0; i <
Order; i++) {
733 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
743 for (
unsigned int i = 0; i <
Order; i++) {
750 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
751 "warning, matrix D provided "
752 "while in descriptor form "
763 for (
unsigned int i = 0; i <
Order; i++) {
773 silent_cerr(
"GenelStateSpaceSISO(" << uLabel <<
"): "
774 "unknown balance mode at line "
782 std::vector<doublereal> dX0;
784 std::vector<doublereal> dXP0;
790 for (
unsigned i = 0; i <
Order; i++) {
794 if (pdE != 0 && HP.
IsKeyWord(
"derivative")) {
798 for (
unsigned i = 0; i <
Order; i++) {
810 pdE, pdA, pdB, pdC, dD, bBalance,
818 silent_cerr(
"ScalarFilter(" << uLabel <<
"): "
819 "parameter nodes not allowed "
820 "for output ScalarDof (y) "
827 silent_cerr(
"ScalarFilter(" << uLabel <<
"): "
828 "illegal order " << SD_y.
iOrder
829 <<
" for output ScalarDof (y) "
860 bool bControllable(
true);
863 bControllable =
true;
866 bControllable =
false;
869 silent_cerr(
"ScalarFilter(" << uLabel <<
"):"
870 "unknown canonical form "
879 silent_cerr(
"ScalarFilter(" << uLabel <<
"):"
880 "invalid denominator order " << nd <<
" "
886 std::vector<doublereal> den(nd + 1);
888 for (
int i = 1; i <= nd; i++) {
893 if (nn < 0 || nn > nd) {
894 silent_cerr(
"ScalarFilter(" << uLabel <<
"):"
895 "invalid numerator order " << nn <<
" "
901 std::vector<doublereal> num(nd + 1);
902 for (
int i = 0; i < nd - nn; i++) {
906 for (
int i = nd - nn; i <= nd; i++) {
913 for (
int i = 0; i <= nd; i++) {
920 for (
int i = 1; i <= nd; i++) {
921 num[i] -= den[i]*num[0];
941 for (
int i = 1; i <=
Order; i++) {
944 for (
int i = 0; i < Order - 2; i++) {
946 for (
int j = 0; j <
Order; j++) {
956 ASSERT(pd == pdA + Order*Order);
961 for (
int i = 0; i < Order - 1; i++) {
967 for (
int i = 1; i <=
Order; i++) {
974 for (
int i = 1; i <=
Order; i++) {
976 for (
int j = 1; j <
Order; j++) {
986 ASSERT(pd == pdA + Order*Order);
990 for (
int i = 1; i <=
Order; i++) {
997 for (
int i = 0; i < Order - 1; i++) {
1002 bool bBalance(
true);
1005 silent_cerr(
"ScalarFilter(" << uLabel <<
"): "
1006 "unknown balance mode at line "
1019 pdE, pdA, pdB, pdC, dD, bBalance,
1024 case STATESPACEMIMO: {
1025 int iNumOutputs = HP.
GetInt();
1026 if (iNumOutputs <= 0) {
1027 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1028 "illegal number of outputs "
1036 for (
int i = 0; i < iNumOutputs; i++) {
1040 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1041 "parameter nodes not allowed "
1042 "for output ScalarDof "
1050 if (pvSD_y[i].iOrder > 1) {
1051 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1052 "illegal order " << pvSD_y[i].iOrder
1053 <<
" for output ScalarDof "
1062 int iNumInputs = HP.
GetInt();
1063 if (iNumInputs <= 0) {
1064 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1065 "illegal number of inputs "
1072 std::vector<ScalarValue *> SV_u(iNumInputs);
1075 unsigned int Order = HP.
GetInt();
1077 <<
" is of order " << Order << std::endl);
1084 for (
unsigned int i = 0; i < Order*
Order; i++) {
1090 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1091 "matrix A expected "
1101 for (
unsigned int i = 0; i < Order*
Order; i++) {
1106 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1107 "matrix B expected "
1117 for (
unsigned int i = 0; i < Order*iNumInputs; i++) {
1122 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1123 "matrix C expected "
1133 for (
unsigned int i = 0; i < iNumOutputs*
Order; i++) {
1140 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1141 "warning, matrix D provided "
1142 "while in descriptor form "
1149 for (
int i = 0; i < iNumOutputs*iNumInputs; i++) {
1158 for (
unsigned int i = 0; i < iNumOutputs*
Order; i++) {
1163 for (
int i = 0; i < iNumOutputs*iNumInputs; i++) {
1168 bool bBalance(
true);
1171 silent_cerr(
"GenelStateSpaceMIMO(" << uLabel <<
"): "
1172 "unknown balance mode at line "
1181 std::vector<doublereal> dX0;
1183 std::vector<doublereal> dXP0;
1189 for (
unsigned i = 0; i <
Order; i++) {
1193 if (pdE != 0 && HP.
IsKeyWord(
"derivative")) {
1197 for (
unsigned i = 0; i <
Order; i++) {
1208 iNumOutputs, pvSD_y,
1211 pdE, pdA, pdB, pdC, pdD, bBalance,
1212 pdX0, pdXP0, fOut));
1218 silent_cerr(
"Genel(" << uLabel <<
"): "
1226 silent_cerr(
"semicolon expected "
flag fReadOutput(MBDynParser &HP, const T &t) const
#define MBDYN_EXCEPT_ARGS
#define DEBUGCOUTFNAME(fname)
virtual integer GetInt(integer iDefval=0)
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
#define SAFEDELETEARR(pnt)
virtual const doublereal & dGetX(void) const =0
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
virtual doublereal dGetRadius(void) const
#define SAFENEW(pnt, item)
virtual bool IsKeyWord(const char *sKeyWord)
ScalarValue * ReadScalarValue(DataManager *pDM, MBDynParser &HP)
virtual DofOrder::Order GetDofType(unsigned int i) const =0
#define ASSERT(expression)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
virtual unsigned int iGetNumDof(void) const
virtual bool GetYesNo(bool &bRet)
virtual Node::Type GetNodeType(void) const =0
#define SAFENEWARRNOFILL(pnt, item, sz)
virtual int GetWord(void)
#define SAFENEWARR(pnt, item, sz)
virtual int GetLineNumber(void) const
DriveCaller * GetDriveCaller(bool bDeferred=false)
void ReadScalarValues(DataManager *pDM, MBDynParser &HP, std::vector< ScalarValue * > &Values)
virtual HighParser::ErrOut GetLineData(void) const
unsigned int GetLabel(void) const
Node * ReadNode(MBDynParser &HP, Node::Type type) const
ConstitutiveLaw1D * GetConstLaw1D(ConstLawType::Type &clt)
ScalarDof ReadScalarDof(const DataManager *pDM, MBDynParser &HP, bool bDof, bool bOrder)
virtual doublereal GetReal(const doublereal &dDefval=0.0)