Author: Jon S. Berndt
Date started: 6/17/2006
- ------------- Copyright (C) 2006 Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 2006 Jon S. Berndt (jon@jsbsim.org) -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGPID.h"
+#include "input_output/FGXMLElement.h"
+#include <string>
+#include <iostream>
+
+using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGPID.cpp,v 1.16 2009/10/24 22:59:30 jberndt Exp $";
static const char *IdHdr = ID_PID;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGPID::FGPID(FGFCS* fcs, Element* element) : FGFCSComponent(fcs, element)
{
string kp_string, ki_string, kd_string;
- dt = fcs->GetState()->Getdt();
Kp = Ki = Kd = 0.0;
KpPropertyNode = 0;
if ( element->FindElement("kp") ) {
kp_string = element->FindElementValue("kp");
- if (kp_string.find_first_not_of("+-.0123456789Ee") != string::npos) { // property
+ if (!is_number(kp_string)) { // property
if (kp_string[0] == '-') {
KpPropertySign = -1.0;
kp_string.erase(0,1);
if ( element->FindElement("ki") ) {
ki_string = element->FindElementValue("ki");
- if (ki_string.find_first_not_of("+-.0123456789Ee") != string::npos) { // property
+ if (!is_number(ki_string)) { // property
if (ki_string[0] == '-') {
KiPropertySign = -1.0;
ki_string.erase(0,1);
if ( element->FindElement("kd") ) {
kd_string = element->FindElementValue("kd");
- if (kd_string.find_first_not_of("+-.0123456789Ee") != string::npos) { // property
+ if (!is_number(kd_string)) { // property
if (kd_string[0] == '-') {
KdPropertySign = -1.0;
kd_string.erase(0,1);
}
}
- //if (element->FindElement("kp")) Kp = element->FindElementValueAsNumber("kp");
- //if (element->FindElement("ki")) Ki = element->FindElementValueAsNumber("ki");
- //if (element->FindElement("kd")) Kd = element->FindElementValueAsNumber("kd");
if (element->FindElement("trigger")) {
Trigger = PropertyManager->GetNode(element->FindElementValue("trigger"));
}
else
cout << " INPUT: " << InputNodes[0]->getName() << endl;
- if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
+ if (IsOutput) {
+ for (unsigned int i=0; i<OutputNodes.size(); i++)
+ cout << " OUTPUT: " << OutputNodes[i]->getName() << endl;
+ }
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification