Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Skyward
Matlab dependencies
Common
Commits
eb892189
Commit
eb892189
authored
4 months ago
by
Marco Luigi Gaibotti
Browse files
Options
Downloads
Patches
Plain Diff
[coeff-transpot] Added total coefficients
parent
b426f4da
Branches
Branches containing commit
No related tags found
1 merge request
!21
Implemented coefficient transport on rocket data
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
classes/misc/Coefficient.m
+31
-39
31 additions, 39 deletions
classes/misc/Coefficient.m
with
31 additions
and
39 deletions
classes/misc/Coefficient.m
+
31
−
39
View file @
eb892189
...
...
@@ -10,7 +10,7 @@ classdef Coefficient
% - name: (optional) coefficient name. Used when dynamic
% derivatives are also needed
%
% Coefficients are retrieved from DM in the following format:
% Coefficients are retrieved from D
ATCO
M in the following format:
% Coefficient matrix: double (15, nAlpha, nMach, nBeta, nAlt, nAbk, nXcg)
% Where the 15 coefficients are
% - CA Axial force
...
...
@@ -44,9 +44,7 @@ classdef Coefficient
% dimension, instead of the first, to improve performance
properties
(
Dependent
)
static
double
% Static coefficients: [CA, CY, CN, Cl, Cm, Cn]
dynamic
double
% Dynamic derivatives: [Clp, Cmad, Cmq, Cnr, Cnp]
total
double
% Coefficients stored in DATCOM format
geometry
struct
% Reference geometry
state
struct
% Flight envelope
end
...
...
@@ -55,14 +53,19 @@ classdef Coefficient
finsCN
double
% Fins-only CN
end
properties
(
Dependent
,
SetAccess
=
private
)
static
double
% Static coefficients: [CA, CY, CN, Cl, Cm, Cn]
dynamic
double
% Dynamic derivatives: [Clp, Cmad, Cmq, Cnr, Cnp]
end
properties
(
SetAccess
=
private
)
isReady
(
1
,
1
)
logical
% Whether all coefficients are loaded and of the right size
isDynamic
(
1
,
1
)
logical
% Whether to load dynamic derivatives. Adds XCG dependece
end
properties
(
Access
=
private
)
STATIC
% Cached variable for static coefficients
DYNAMIC
% Cached variable for dynamic derivatives
TOTAL
% Cached variable for total
GEOMETRY
% Cached variable for geometry
STATE
% Cached variable for state
end
...
...
@@ -75,10 +78,12 @@ classdef Coefficient
methods
function
obj
=
Coefficient
(
filePath
,
name
)
arguments
filePath
(
1
,
:)
char
filePath
(
1
,
:)
char
=
''
name
(
1
,
:)
char
=
'generic'
end
if
isempty
(
filePath
),
return
;
end
obj
=
obj
.
loadData
(
filePath
,
name
);
obj
.
isReady
=
obj
.
checkProperties
();
obj
=
obj
.
updateInterpolants
();
...
...
@@ -128,12 +133,17 @@ classdef Coefficient
end
methods
% Getters
function
value
=
get
.
total
(
obj
)
value
=
obj
.
TOTAL
;
end
function
value
=
get
.
static
(
obj
)
value
=
obj
.
STATIC
;
value
=
obj
.
TOTAL
([
1
,
3
,
5
,
6
,
9
,
13
],
:,
:,
:,
:,
:,
1
)
;
end
function
value
=
get
.
dynamic
(
obj
)
value
=
obj
.
DYNAMIC
;
if
~
obj
.
isDynamic
,
value
=
[];
return
;
end
value
=
obj
.
TOTAL
([
7
,
10
,
11
,
14
,
15
],
:,
:,
:,
:,
:,
:);
end
function
value
=
get
.
geometry
(
obj
)
...
...
@@ -146,14 +156,9 @@ classdef Coefficient
end
methods
% Setters
function
obj
=
set
.
static
(
obj
,
value
)
obj
.
STATIC
=
value
(:,
:,
:,
:,
:,
:,
1
);
obj
.
isReady
=
obj
.
checkProperties
();
obj
=
obj
.
updateInterpolants
();
end
function
obj
=
set
.
dynamic
(
obj
,
value
)
obj
.
DYNAMIC
=
value
(:,
:,
:,
:,
:,
:,
:);
function
obj
=
set
.
total
(
obj
,
value
)
obj
.
TOTAL
=
value
;
obj
.
isDynamic
=
size
(
value
,
7
)
~=
1
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
=
obj
.
updateInterpolants
();
end
...
...
@@ -190,25 +195,19 @@ classdef Coefficient
if
~
isfield
(
dataCoeffs
,
name
),
return
;
end
dataCoeffs
=
dataCoeffs
.
(
name
);
obj
.
isDynamic
=
~
strcmp
(
name
,
'generic'
);
obj
.
finsCN
=
dataCoeffs
.
finsCN
;
obj
.
GEOMETRY
=
dataCoeffs
.
geometry
;
obj
.
STATE
=
dataCoeffs
.
state
;
% Load CA, CY, CN, Cl, Cm, Cn
obj
.
STATIC
=
dataCoeffs
.
total
([
1
,
3
,
5
,
6
,
9
,
13
],
:,
:,
:,
:,
:,
:);
if
obj
.
isDynamic
% Load Clp, Cmad, Cmq, Cnr, Cnp
obj
.
DYNAMIC
=
dataCoeffs
.
total
([
7
,
10
,
11
,
14
,
15
],
:,
:,
:,
:,
:,
:);
end
% Load coefficients
obj
.
total
=
dataCoeffs
.
total
;
end
function
ready
=
checkProperties
(
obj
)
% Check if STATIC, DYNAMIC, GEOMETRY, and STATE are non-empty
ready
=
~
isempty
(
obj
.
STATIC
)
&&
...
ready
=
~
isempty
(
obj
.
static
)
&&
...
~
isempty
(
obj
.
GEOMETRY
)
&&
~
isempty
(
obj
.
STATE
)
&&
...
~
(
isempty
(
obj
.
DYNAMIC
)
&&
obj
.
isDynamic
);
~
(
isempty
(
obj
.
dynamic
)
&&
obj
.
isDynamic
);
if
~
ready
,
return
;
end
...
...
@@ -223,14 +222,7 @@ classdef Coefficient
dims
=
cellfun
(
@
(
x
)
length
(
x
),
gridVecs
);
dims
(
dims
==
0
)
=
1
;
% Empty case is the same as scalar case
staticDimsReady
=
all
(
size
(
obj
.
STATIC
,
2
:
6
)
==
dims
(
1
:
end
-
1
));
dynamicDimsReady
=
true
;
if
obj
.
isDynamic
dynamicDimsReady
=
all
(
size
(
obj
.
DYNAMIC
,
2
:
7
)
==
dims
);
end
ready
=
ready
&&
staticDimsReady
&&
dynamicDimsReady
;
ready
=
all
(
size
(
obj
.
total
,
2
:
7
)
==
dims
);
end
function
obj
=
updateInterpolants
(
obj
)
...
...
@@ -255,7 +247,7 @@ classdef Coefficient
gridVecs
(
singletonDims
)
=
deal
({[
0
,
1
]});
%% Create interpolants
staticCoeffs
=
permute
(
obj
.
STATIC
,
[
2
,
3
,
4
,
5
,
6
,
1
]);
staticCoeffs
=
permute
(
obj
.
static
,
[
2
,
3
,
4
,
5
,
6
,
1
]);
staticCoeffs
=
repmat
(
staticCoeffs
,
singletonDims
(
1
:
end
-
1
)
+
1
);
% Exclude xcg for static coefficients
obj
.
staticInterpolant
=
griddedInterpolant
(
gridVecs
(
1
:
end
-
1
),
staticCoeffs
,
'linear'
,
'nearest'
);
...
...
@@ -263,7 +255,7 @@ classdef Coefficient
if
~
obj
.
isDynamic
,
return
;
end
%% Handle dynamic derivatives
dynamicCoeffs
=
permute
(
obj
.
DYNAMIC
,
[
2
,
3
,
4
,
5
,
6
,
7
,
1
]);
dynamicCoeffs
=
permute
(
obj
.
dynamic
,
[
2
,
3
,
4
,
5
,
6
,
7
,
1
]);
% Flip xcg in case of descending order
if
~
isscalar
(
xcg
)
&&
xcg
(
2
)
<
xcg
(
1
)
...
...
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