Skip to content

Commit

Permalink
Removed the useless member IsOutput.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Apr 28, 2019
1 parent e4ea6fc commit 511869e
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 108 deletions.
2 changes: 1 addition & 1 deletion src/models/flight_control/FGAccelerometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool FGAccelerometer::Run(void )

ProcessSensorSignal();

if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGActuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool FGActuator::Run(void )
}
}

if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGAngles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool FGAngles::Run(void )
else Output = -angle_to_heading_rad * output_unit;

Clip();
if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGDeadBand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool FGDeadBand::Run(void)
}

Clip();
if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
7 changes: 2 additions & 5 deletions src/models/flight_control/FGFCSComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)
Input = Output = delay_time = 0.0;
delay = index = 0;
ClipMin = ClipMax = nullptr;
IsOutput = clip = cyclic_clip = false;
clip = cyclic_clip = false;
dt = fcs->GetChannelDeltaT();

PropertyManager = fcs->GetPropertyManager();
Expand Down Expand Up @@ -128,7 +128,6 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)

Element *out_elem = element->FindElement("output");
while (out_elem) {
IsOutput = true;
string output_node_name = out_elem->GetDataLine();
FGPropertyNode* OutputNode = PropertyManager->GetNode( output_node_name, true );
OutputNodes.push_back(OutputNode);
Expand Down Expand Up @@ -257,10 +256,8 @@ void FGFCSComponent::bind(Element* el)

FGPropertyNode* node = PropertyManager->GetNode(tmp, true);

if (node) {
if (node)
OutputNodes.push_back(node);
IsOutput = true;
}
else {
cerr << el->ReadFrom()
<< "Could not get or create property " << tmp << endl;
Expand Down
1 change: 0 additions & 1 deletion src/models/flight_control/FGFCSComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class FGFCSComponent : public FGJSBBase
unsigned int delay;
int index;
double dt;
bool IsOutput;
bool clip, cyclic_clip;

void Delay(void);
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGFCSFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ bool FGFCSFunction::Run(void )
}

Clip();
if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ bool FGFilter::Run(void)
PreviousInput1 = Input;

Clip();
if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGGain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ bool FGGain::Run(void )
}

Clip();
if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
22 changes: 9 additions & 13 deletions src/models/flight_control/FGGyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
------------- Copyright (C) 2009 -------------
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
Foundation; either version 2 of the License, or (at your option) any later
version.
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
Further information about the GNU Lesser General Public License can also be
found on the world wide web at http://www.gnu.org.
FUNCTIONAL DESCRIPTION
--------------------------------------------------------------------------------
Expand All @@ -37,11 +37,7 @@ COMMENTS, REFERENCES, and NOTES
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#include <iostream>

#include "FGGyro.h"
#include "models/FGPropagate.h"
#include "input_output/FGXMLElement.h"
#include "models/FGFCS.h"

using namespace std;
Expand Down Expand Up @@ -83,7 +79,7 @@ bool FGGyro::Run(void )

ProcessSensorSignal();

if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
30 changes: 14 additions & 16 deletions src/models/flight_control/FGGyro.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
------------- Copyright (C) 2009 -------------
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
Foundation; either version 2 of the License, or (at your option) any later
version.
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
Further information about the GNU Lesser General Public License can also be
found on the world wide web at http://www.gnu.org.
HISTORY
--------------------------------------------------------------------------------
Expand All @@ -38,8 +38,6 @@ INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#include "FGSensor.h"
#include "math/FGColumnVector3.h"
#include "math/FGMatrix33.h"
#include "FGSensorOrientation.h"

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -91,10 +89,10 @@ CLASS DOCUMENTATION
For noise, if the type is PERCENT, then the value supplied is understood to be a
percentage variance. That is, if the number given is 0.05, the the variance is
understood to be +/-0.05 percent maximum variance. So, the actual value for the gyro
will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
time.
understood to be +/-0.05 percent maximum variance. So, the actual value for the
gyro will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any
time - even varying all the way from 0.95 to 1.05 in adjacent frames - whatever
the delta time.
@author Jon S. Berndt
@version $Revision: 1.7 $
Expand All @@ -110,15 +108,15 @@ class FGGyro : public FGSensor, public FGSensorOrientation
FGGyro(FGFCS* fcs, Element* element);
~FGGyro();

bool Run (void);
bool Run (void) override;

private:
FGPropagate* Propagate;
FGColumnVector3 Rates;
FGColumnVector3 vRates;
void CalculateTransformMatrix(void);

void Debug(int from);
void Debug(int from) override;
};
}
#endif
5 changes: 3 additions & 2 deletions src/models/flight_control/FGKinemat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ bool FGKinemat::Run(void )

if (DoScale) Input *= Detents.back();

if (IsOutput) Output = OutputNodes[0]->getDoubleValue();
if (!OutputNodes.empty())
Output = OutputNodes[0]->getDoubleValue();

Input = Constrain(Detents.front(), Input, Detents.back());

Expand Down Expand Up @@ -151,7 +152,7 @@ bool FGKinemat::Run(void )
}

Clip();
if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGLinearActuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ bool FGLinearActuator::Run(void )
previousLagOutput = Output;
}

if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
60 changes: 28 additions & 32 deletions src/models/flight_control/FGMagnetometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
------------- Copyright (C) 2009 -------------
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
Foundation; either version 2 of the License, or (at your option) any later
version.
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
Further information about the GNU Lesser General Public License can also be
found on the world wide web at http://www.gnu.org.
FUNCTIONAL DESCRIPTION
--------------------------------------------------------------------------------
Expand All @@ -37,14 +37,10 @@ COMMENTS, REFERENCES, and NOTES
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#include <ctime>
#include <cstdlib>
#include <iostream>

#include "FGMagnetometer.h"
#include "simgear/magvar/coremag.hxx"
#include "input_output/FGXMLElement.h"
#include "models/FGFCS.h"
#include "models/FGMassBalance.h"

using namespace std;

Expand All @@ -55,18 +51,22 @@ CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/


FGMagnetometer::FGMagnetometer(FGFCS* fcs, Element* element) : FGSensor(fcs, element),
FGSensorOrientation(element),
counter(0),
INERTIAL_UPDATE_RATE(1000)
FGMagnetometer::FGMagnetometer(FGFCS* fcs, Element* element)
: FGSensor(fcs, element), FGSensorOrientation(element), counter(0),
INERTIAL_UPDATE_RATE(1000)
{
Propagate = fcs->GetExec()->GetPropagate();
MassBalance = fcs->GetExec()->GetMassBalance();
Inertial = fcs->GetExec()->GetInertial();

Element* location_element = element->FindElement("location");
if (location_element) vLocation = location_element->FindElementTripletConvertTo("IN");
else {cerr << "No location given for magnetometer. " << endl; exit(-1);}
if (location_element)
vLocation = location_element->FindElementTripletConvertTo("IN");
else {
cerr << element->ReadFrom()
<< "No location given for magnetometer. " << endl;
throw("Malformed magnetometer specification.");
}

vRadius = MassBalance->StructuralToBody(vLocation);

Expand Down Expand Up @@ -100,18 +100,14 @@ void FGMagnetometer::updateInertialMag(void)
counter++;
if (counter > INERTIAL_UPDATE_RATE)//dont need to update every iteration
{
counter = 0;

usedLat = (Propagate->GetGeodLatitudeRad());//radians, N and E lat and long are positive, S and W negative
usedLon = (Propagate->GetLongitude());//radians
usedAlt = (Propagate->GetGeodeticAltitude()*fttom*0.001);//km

//this should be done whenever the position changes significantly (in nTesla)
calc_magvar( usedLat,
usedLon,
usedAlt,
date,
field );
counter = 0;

usedLat = (Propagate->GetGeodLatitudeRad());//radians, N and E lat and long are positive, S and W negative
usedLon = (Propagate->GetLongitude());//radians
usedAlt = (Propagate->GetGeodeticAltitude()*fttom*0.001);//km

//this should be done whenever the position changes significantly (in nTesla)
calc_magvar( usedLat, usedLon, usedAlt, date, field );
}
}

Expand All @@ -135,7 +131,7 @@ bool FGMagnetometer::Run(void )

ProcessSensorSignal();

if (IsOutput) SetOutput();
SetOutput();

return true;
}
Expand Down
Loading

0 comments on commit 511869e

Please sign in to comment.