77 const std::string& baseName,
78 const std::string& xcmp,
79 const std::string& ycmp,
80 const std::string& zcmp)
96 <<
"No frame specified for external " << el->
GetName() <<
", \""
97 << Name <<
"\"." << endl
98 <<
"Frame set to Body" << endl;
100 }
else if (sFrame ==
"BODY") {
102 }
else if (sFrame ==
"LOCAL") {
104 }
else if (sFrame ==
"WIND") {
108 <<
"Invalid frame specified for external " << el->
GetName() <<
", \""
109 << Name <<
"\"." << endl
110 <<
"Frame set to Body" << endl;
114 Element* direction_element = el->
FindElement(
"direction");
115 if (!direction_element) {
117 <<
"No direction element specified in " << el->
GetName()
118 <<
" object. Default is (0,0,0)." << endl;
121 direction.Normalize();
131 Element* function_element = el->
FindElement(
"function");
132 if (function_element) {
133 return new FGFunction(
fdmex, function_element);
135 FGPropertyManager* pm =
fdmex->GetPropertyManager();
136 FGPropertyNode* node = pm->GetNode(magName,
true);
137 return new FGPropertyValue(node);
147 string BasePropertyName =
"external_reactions/" + Name;
151 forceMagnitude = bind(el, BasePropertyName +
"/magnitude", forceDirection);
154 if (!location_element) {
156 <<
"No location element specified in force object." << endl;
161 PropertyManager->
Tie( BasePropertyName +
"/location-x-in", (
FGForce*)
this,
163 PropertyManager->
Tie( BasePropertyName +
"/location-y-in", (
FGForce*)
this,
165 PropertyManager->
Tie( BasePropertyName +
"/location-z-in", (
FGForce*)
this,
175 string BasePropertyName =
"external_reactions/" + Name;
179 momentMagnitude = bind(el, BasePropertyName +
"/magnitude-lbsft",
187 delete forceMagnitude;
188 delete momentMagnitude;
197 vFn = forceMagnitude->GetValue() * forceDirection;
200 vMn =
Transform() * (momentMagnitude->GetValue() * momentDirection);
224void FGExternalForce::Debug(
int from)
230 cout <<
" " << Name << endl;
243 cout <<
"ERROR/UNKNOWN";
245 cout << endl <<
" Location: (" <<
vXYZn(
eX) <<
", " <<
vXYZn(
eY) <<
", " <<
vXYZn(
eZ) <<
")" << endl;
249 if (from == 0) cout <<
"Instantiated: FGExternalForce" << endl;
250 if (from == 1) cout <<
"Destroyed: FGExternalForce" << endl;
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
const std::string & GetName(void) const
Retrieves the element name.
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
std::string ReadFrom(void) const
Return a string that contains a description of the location where the current XML element was read fr...
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
Element * FindElement(const std::string &el="")
Searches for a specified element.
This class implements a 3 element column vector.
void setForce(Element *el)
const FGColumnVector3 & GetBodyForces(void) override
void setMoment(Element *el)
~FGExternalForce() override
Destructor.
virtual const FGColumnVector3 & GetBodyForces(void)
const FGMatrix33 & Transform(void) const
double GetLocationZ(void) const
void SetLocationY(double y)
double GetLocationY(void) const
void SetLocationX(double x)
void SetLocationZ(double z)
FGForce(FGFDMExec *FDMExec)
Constructor.
double GetLocationX(void) const
void SetLocation(double x, double y, double z)
Represents various types of parameters.
void Tie(const std::string &name, T *pointer)
Tie a property to an external variable.
simgear::PropertyObject< T > CreatePropertyObject(const std::string &path)