Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aerodynamics_2_graphviz #1126

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/input_output/FGScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ class FGScript : public FGJSBBase

void ResetEvents(void);

std::string GetScriptName() { return ScriptName; }

double GetStartTime() { return StartTime; }

double GetEndTime() { return EndTime; }

private:
enum eAction {
FG_RAMP = 1,
Expand Down
14 changes: 14 additions & 0 deletions src/math/FGFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,19 @@ void FGFunction::Load(Element* el, FGPropertyValue* var, FGFDMExec* fdmex,
const string& Prefix)
{
Name = el->GetAttributeValue("name");
JSBSim::Element* parent = el->GetParent();
std::string parent_name = parent->GetAttributeValue("name");
Parameter_Name = parent->GetName();
if (parent_name.size() > 0) {
Parameter_Name += "_" + parent_name;
}
Parameter_Name += "_" + el->GetName();
if (Name.size() > 0) {
Parameter_Name += "_" + Name;
}

Parameter_Description = el->GetAttributeValue("description");
Parameter_LineNumber = el->GetLineNumber();
Element* element = el->GetElement();

auto sum = [](const decltype(Parameters)& Parameters)->double {
Expand All @@ -322,6 +335,7 @@ void FGFunction::Load(Element* el, FGPropertyValue* var, FGFDMExec* fdmex,

while (element) {
string operation = element->GetName();
Function_Operation = operation;

// data types
if (operation == "property" || operation == "p") {
Expand Down
7 changes: 7 additions & 0 deletions src/math/FGFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,10 @@ class FGFunction : public FGParameter, public FGJSBBase

enum class OddEven {Either, Odd, Even};

const std::vector <FGParameter_ptr> GetParameters(void) const { return Parameters; }
const FGPropertyNode_ptr GetFGPropertyNode(void) const { return pNode; }
const std::string GetFunctionOperation(void) const { return Function_Operation; }

protected:
bool cached;
double cachedValue;
Expand All @@ -829,6 +833,9 @@ class FGFunction : public FGParameter, public FGJSBBase
void CheckOddOrEvenArguments(Element* el, OddEven odd_even);
std::string CreateOutputNode(Element* el, const std::string& Prefix);

protected:
std::string Function_Operation = "";

private:
std::string Name;
FGPropertyNode_ptr pCopyTo; // Property node for CopyTo property string
Expand Down
9 changes: 9 additions & 0 deletions src/math/FGParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ class JSBSIM_API FGParameter : public SGReferenced
virtual ~FGParameter(void) {};
virtual double GetValue(void) const = 0;
virtual std::string GetName(void) const = 0;

virtual std::string GetParameterName(void) const { return Parameter_Name; }
virtual std::string GetParameterDescription(void) const { return Parameter_Description; }
virtual int GetParameterLineNumber(void) const { return Parameter_LineNumber; }
virtual bool IsConstant(void) const { return false; }

// SGPropertyNode impersonation.
double getDoubleValue(void) const { return GetValue(); }

protected:
std::string Parameter_Name = "";
std::string Parameter_Description = "";
int Parameter_LineNumber = 0;
};

typedef SGSharedPtr<FGParameter> FGParameter_ptr;
Expand Down
1 change: 1 addition & 0 deletions src/math/FGPropertyValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ FGPropertyValue::FGPropertyValue(const std::string& propName,

if (PropertyManager->HasNode(PropertyName)) {
PropertyNode = PropertyManager->GetNode(PropertyName);
Parameter_Name = PropertyName;

assert(PropertyNode);
XML_def = nullptr; // Now that the property is bound, we no longer need that.
Expand Down
4 changes: 3 additions & 1 deletion src/math/FGRealValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class JSBSIM_API FGRealValue : public FGParameter
{
public:

explicit FGRealValue(double val) : Value(val) {}
explicit FGRealValue(double val) : Value(val) {
Parameter_Name = "constant value :" + std::to_string(val);
}

double GetValue(void) const override { return Value; };
std::string GetName(void) const override;
Expand Down
15 changes: 15 additions & 0 deletions src/math/FGTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ FGTable::FGTable(std::shared_ptr<FGPropertyManager> pm, Element* el,
// Is this an internal lookup table?

Name = el->GetAttributeValue("name"); // Allow this table to be named with a property
JSBSim::Element* parent = el->GetParent();
std::string parent_name = parent->GetAttributeValue("name");
Parameter_Name = parent->GetName();
if (parent_name.size() > 0) {
Parameter_Name += "_" + parent_name;
}
Parameter_Name += "_" + el->GetName();
if (Name.size() > 0) {
Parameter_Name += "_" + Name;
}

Parameter_Description = el->GetAttributeValue("description");
Parameter_LineNumber = el->GetLineNumber();
Function_Operation = "table";
string call_type = el->GetAttributeValue("type");
if (call_type == "internal") {
internal = true;
Expand Down Expand Up @@ -159,6 +173,7 @@ FGTable::FGTable(std::shared_ptr<FGPropertyManager> pm, Element* el,

FGPropertyValue_ptr node = new FGPropertyValue(property_string,
PropertyManager, axisElement);
Parameters.push_back(node);
string lookup_axis = axisElement->GetAttributeValue("lookup");
if (lookup_axis == string("row")) {
lookupProperty[eRow] = node;
Expand Down
17 changes: 14 additions & 3 deletions src/math/FGTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SENTRY
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#include "FGParameter.h"
#include "FGFunction.h"
#include "math/FGPropertyValue.h"

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -230,7 +230,7 @@ combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

class JSBSIM_API FGTable : public FGParameter, public FGJSBBase
class JSBSIM_API FGTable : public FGFunction
{
public:
/// Destructor
Expand Down Expand Up @@ -308,13 +308,24 @@ class JSBSIM_API FGTable : public FGParameter, public FGJSBBase
{ lookupProperty[eColumn] = new FGPropertyValue(node); }

unsigned int GetNumRows() const {return nRows;}
const std::vector<FGPropertyValue_ptr> GetLookupProperty(void) const {
auto v = std::vector<FGPropertyValue_ptr>();
for (unsigned int i = 0; i < 3; i++) {
v.push_back(lookupProperty[i]);
}
return v;
}

void Print(void);

std::string GetName(void) const {return Name;}

enum type {tt1D, tt2D,tt3D};

type GetType(void) const { return Type; }

private:
enum type {tt1D, tt2D, tt3D} Type;
type Type;
enum axis {eRow=0, eColumn, eTable};
bool internal = false;
std::shared_ptr<FGPropertyManager> PropertyManager; // Property root used to do late binding.
Expand Down
5 changes: 4 additions & 1 deletion src/models/FGFCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ class JSBSIM_API FGFCS : public FGModel
@return a string containing the descriptive names for all components */
std::string GetComponentStrings(const std::string& delimiter) const;

typedef std::vector <FGFCSChannel*> Channels;

const Channels GetSystemChannels(void) const { return SystemChannels; }

/** Retrieves all component outputs for inclusion in output stream
@param delimiter either a tab or comma string depending on output type
@return a string containing the numeric values for the current set of
Expand Down Expand Up @@ -589,7 +593,6 @@ class JSBSIM_API FGFCS : public FGModel
int ChannelRate;
FGFDMExec* fdmex;

typedef std::vector <FGFCSChannel*> Channels;
Channels SystemChannels;
void bind(void);
void bindThrottle(unsigned int);
Expand Down
4 changes: 3 additions & 1 deletion src/models/FGFCSChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FGFCSChannel {
FCSComponents.clear();
}
/// Retrieves the name of the channel
std::string GetName() {return Name;}
std::string GetName() const {return Name;}

/// Adds a component to a channel
void Add(FGFCSComponent* comp) {
Expand Down Expand Up @@ -138,6 +138,8 @@ class FGFCSChannel {
/// Get the channel rate
int GetRate(void) const { return ExecRate; }

const FCSCompVec GetFCSComponents(void) const { return FCSComponents; }

private:
FGFCS* fcs;
FCSCompVec FCSComponents;
Expand Down
2 changes: 1 addition & 1 deletion src/models/FGLGear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void FGLGear::CrashDetect(void)
SinkRate > 1.4666*30 ) && !fdmex->IntegrationSuspended())
{
if (debug_lvl > 0) {
cout << "*CRASH DETECTED* " << fdmex->GetSimTime() << " seconds: " << name;
cout << "*CRASH DETECTED* " << fdmex->GetSimTime() << " seconds: " << name << endl;
}

// fdmex->SuspendIntegration();
Expand Down
4 changes: 4 additions & 0 deletions src/models/flight_control/FGFCSComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class FGFCSComponent : public FGJSBBase
virtual double GetOutputPct(void) const { return 0; }
virtual void ResetPastStates(void);

const std::vector <FGPropertyValue_ptr>& GetInitNodes(void) const { return InitNodes;}
const std::vector <FGPropertyValue_ptr>& GetInputNodes(void) const { return InputNodes; }
const std::vector <FGPropertyNode_ptr>& GetOutputNodes(void) const { return OutputNodes; }

protected:
FGFCS* fcs;
std::vector <FGPropertyNode_ptr> OutputNodes;
Expand Down
Loading