Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsbsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SASC
jsbsim
Commits
b3505fe0
Commit
b3505fe0
authored
14 years ago
by
James Goppert
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up stream output.
parent
791a9ad0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
scicoslab/test.cos
+0
-0
0 additions, 0 deletions
scicoslab/test.cos
src/Trim.cpp
+23
-6
23 additions, 6 deletions
src/Trim.cpp
src/math/FGStateSpace.cpp
+38
-15
38 additions, 15 deletions
src/math/FGStateSpace.cpp
src/math/FGStateSpace.h
+1
-0
1 addition, 0 deletions
src/math/FGStateSpace.h
with
62 additions
and
21 deletions
scicoslab/test.cos
+
0
−
0
View file @
b3505fe0
No preview for this file type
This diff is collapsed.
Click to expand it.
src/Trim.cpp
+
23
−
6
View file @
b3505fe0
...
...
@@ -19,6 +19,7 @@
#include
"initialization/FGTrimmer.h"
#include
"math/FGStateSpace.h"
#include
<iomanip>
#include
<fstream>
#include
"models/FGAircraft.h"
#include
"models/propulsion/FGEngine.h"
#include
"models/propulsion/FGTurbine.h"
...
...
@@ -238,12 +239,28 @@ int main (int argc, char const* argv[])
ss
.
linearize
(
x0
,
u0
,
y0
,
A
,
B
,
C
,
D
);
std
::
cout
<<
std
::
scientific
;
std
::
cout
<<
"
\n
A
\n
"
<<
A
<<
std
::
endl
;
std
::
cout
<<
"
\n
B
\n
"
<<
B
<<
std
::
endl
;
std
::
cout
<<
"
\n
C
\n
"
<<
C
<<
std
::
endl
;
std
::
cout
<<
"
\n
D
\n
"
<<
D
<<
std
::
endl
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
10
);
std
::
cout
<<
std
::
scientific
<<
"
\n
A=
\n
"
<<
A
<<
"
\n
B=
\n
"
<<
B
<<
"
\n
C=
\n
"
<<
C
<<
"
\n
D=
\n
"
<<
D
<<
std
::
fixed
<<
std
::
endl
;
// write scicoslab file
std
::
ofstream
scicos
(
std
::
string
(
aircraft
+
"_lin.sce"
).
c_str
());
scicos
.
precision
(
10
);
scicos
<<
std
::
scientific
<<
aircraft
<<
".x0=..
\n
"
<<
x0
<<
";
\n
"
<<
aircraft
<<
".u0=..
\n
"
<<
u0
<<
";
\n
"
<<
aircraft
<<
".sys = syslin('c',..
\n
"
<<
A
<<
",..
\n
"
<<
B
<<
",..
\n
"
<<
C
<<
",..
\n
"
<<
D
<<
");
\n
"
<<
aircraft
<<
".tfm = ss2tf("
<<
aircraft
<<
".sys);
\n
"
<<
std
::
endl
;
}
// vim:ts=4:sw=4
This diff is collapsed.
Click to expand it.
src/math/FGStateSpace.cpp
+
38
−
15
View file @
b3505fe0
...
...
@@ -98,39 +98,62 @@ std::ostream &operator<<( std::ostream &out, const FGStateSpace::Component &c )
{
out
<<
"
\t
"
<<
c
.
getName
()
<<
"
\t
"
<<
c
.
getUnit
()
<<
"
\t
:
\t
"
<<
c
.
get
()
<<
std
::
ends
;
<<
"
\t
:
\t
"
<<
c
.
get
();
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
FGStateSpace
::
ComponentVector
&
v
)
{
for
(
int
i
=
0
;
i
<
v
.
getSize
();
i
++
)
{
out
<<
*
(
v
.
getComp
(
i
))
<<
std
::
endl
;
}
out
<<
std
::
ends
;
for
(
int
i
=
0
;
i
<
v
.
getSize
();
i
++
)
{
out
<<
*
(
v
.
getComp
(
i
))
<<
"
\n
"
;
}
out
<<
""
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
FGStateSpace
&
ss
)
{
out
<<
"
\n
X:
\n
"
<<
ss
.
x
<<
"
\n
U:
\n
"
<<
ss
.
u
<<
"
\n
Y:
\n
"
<<
ss
.
y
<<
std
::
ends
;
<<
"
\n
Y:
\n
"
<<
ss
.
y
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
std
::
vector
<
std
::
vector
<
double
>
>
&
vec2d
)
{
for
(
int
i
=
0
;
i
<
vec2d
.
size
();
i
++
)
int
nI
=
vec2d
.
size
();
out
<<
"["
;
for
(
int
i
=
0
;
i
<
nI
;
i
++
)
{
for
(
int
j
=
0
;
j
<
vec2d
[
0
].
size
();
j
++
)
int
nJ
=
vec2d
[
i
].
size
();
for
(
int
j
=
0
;
j
<
nJ
;
j
++
)
{
out
<<
"
\t
"
<<
vec2d
[
i
][
j
];
if
(
j
==
vec2d
[
0
].
size
()
-
1
)
out
<<
";"
;
else
out
<<
","
;
out
<<
vec2d
[
i
][
j
];
if
(
j
==
nJ
-
1
)
{
if
(
i
==
nI
-
1
)
{
out
<<
"]"
;
}
else
out
<<
";
\n
"
;
}
else
out
<<
",
\t
"
;
}
out
<<
std
::
endl
;
out
<<
""
;
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
std
::
vector
<
double
>
&
vec
)
{
int
nI
=
vec
.
size
();
out
<<
"["
;
for
(
int
i
=
0
;
i
<
nI
;
i
++
)
{
out
<<
vec
[
i
];
if
(
i
==
nI
-
1
)
{
out
<<
"]"
;
}
else
out
<<
";
\n
"
;
}
out
<<
std
::
ends
;
}
...
...
This diff is collapsed.
Click to expand it.
src/math/FGStateSpace.h
+
1
−
0
View file @
b3505fe0
...
...
@@ -638,6 +638,7 @@ std::ostream &operator<<(std::ostream &out, const FGStateSpace::Component &c );
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
FGStateSpace
::
ComponentVector
&
v
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
FGStateSpace
&
ss
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
std
::
vector
<
std
::
vector
<
double
>
>
&
vec2d
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
std
::
vector
<
double
>
&
vec
);
}
// JSBSim
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment