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
90b1689a
Commit
90b1689a
authored
1 month ago
by
Marco Luigi Gaibotti
Browse files
Options
Downloads
Patches
Plain Diff
[coeff-transport][Wind] Added internal griddedInterpolant to wind
parent
089ef921
No related branches found
Branches containing commit
No related tags found
1 merge request
!21
Implemented coefficient transport on rocket data
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
classes/misc/Wind.m
+69
-47
69 additions, 47 deletions
classes/misc/Wind.m
with
69 additions
and
47 deletions
classes/misc/Wind.m
+
69
−
47
View file @
90b1689a
...
...
@@ -9,6 +9,7 @@ classdef Wind < Config
% - mission: Mission, mission object
% - varIn: (optional) config source. Alternative to config.m
% file
properties
(
Dependent
)
altitudes
(
1
,
:)
...
...
@@ -25,6 +26,9 @@ classdef Wind < Config
end
properties
(
Access
=
private
)
isReady
(
1
,
1
)
logical
% true if all properties are set
dataInerpolant
(
1
,
1
)
griddedInterpolant
% [-] Interpolates [magnitude, azimuth, elevation]
ALTITUDES
MAGNITUDE_DISTRIBUTION
=
''
...
...
@@ -41,77 +45,71 @@ classdef Wind < Config
elevation
magnitude
end
properties
(
Access
=
private
)
checks
(
1
,
3
)
logical
% true if #[magnitude, azimuth, elevation] == #altitudes
end
properties
(
Constant
,
Access
=
protected
)
configName
=
'windConfig.m'
variableName
=
'windCustom'
end
methods
% Getters / Setters
function
obj
=
set
.
altitudes
(
obj
,
value
)
if
length
(
value
)
~=
length
(
obj
.
ALTITUDES
)
obj
.
ALTITUDES
=
value
;
obj
.
magnitude
=
obj
.
updateDistribution
(
obj
.
MAGNITUDE_DISTRIBUTION
,
obj
.
MAGNITUDE_PARAMETERS
);
obj
.
azimuth
=
obj
.
updateDistribution
(
obj
.
AZIMUTH_DISTRIBUTION
,
obj
.
AZIMUTH_PARAMETERS
);
obj
.
elevation
=
obj
.
updateDistribution
(
obj
.
ELEVATION_DISTRIBUTION
,
obj
.
ELEVATION_PARAMETERS
);
else
obj
.
ALTITUDES
=
value
;
end
methods
% Getters
function
value
=
get
.
altitudes
(
obj
),
value
=
obj
.
ALTITUDES
;
end
function
value
=
get
.
magnitudeDistribution
(
obj
),
value
=
obj
.
MAGNITUDE_DISTRIBUTION
;
end
function
value
=
get
.
azimuthDistribution
(
obj
),
value
=
obj
.
AZIMUTH_DISTRIBUTION
;
end
function
value
=
get
.
elevationDistribution
(
obj
),
value
=
obj
.
ELEVATION_DISTRIBUTION
;
end
function
value
=
get
.
magnitudeParameters
(
obj
),
value
=
obj
.
MAGNITUDE_PARAMETERS
;
end
function
value
=
get
.
azimuthParameters
(
obj
),
value
=
obj
.
AZIMUTH_PARAMETERS
;
end
function
value
=
get
.
elevationParameters
(
obj
),
value
=
obj
.
ELEVATION_PARAMETERS
;
end
end
obj
.
checks
(
1
)
=
length
(
obj
.
magnitude
)
==
length
(
obj
.
ALTITUDES
);
obj
.
checks
(
2
)
=
length
(
obj
.
azimuth
)
==
length
(
obj
.
ALTITUDES
);
obj
.
checks
(
3
)
=
length
(
obj
.
elevation
)
==
length
(
obj
.
ALTITUDES
);
methods
% Setters
function
obj
=
set
.
altitudes
(
obj
,
value
)
obj
.
ALTITUDES
=
value
;
obj
=
obj
.
updateAll
();
end
function
obj
=
set
.
magnitudeDistribution
(
obj
,
value
)
obj
.
MAGNITUDE_DISTRIBUTION
=
value
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
.
magnitude
=
obj
.
updateDistribution
(
value
,
obj
.
MAGNITUDE_PARAMETERS
);
obj
.
checks
(
1
)
=
length
(
obj
.
magnitude
)
==
length
(
obj
.
ALTITUDES
);
obj
=
obj
.
updateInterpolant
(
);
end
function
obj
=
set
.
magnitudeParameters
(
obj
,
value
)
obj
.
MAGNITUDE_PARAMETERS
=
value
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
.
magnitude
=
obj
.
updateDistribution
(
obj
.
MAGNITUDE_DISTRIBUTION
,
value
);
obj
.
checks
(
1
)
=
length
(
obj
.
magnitude
)
==
length
(
obj
.
ALTITUDES
);
obj
=
obj
.
updateInterpolant
(
);
end
function
obj
=
set
.
azimuthDistribution
(
obj
,
value
)
obj
.
AZIMUTH_DISTRIBUTION
=
value
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
.
azimuth
=
obj
.
updateDistribution
(
value
,
obj
.
AZIMUTH_PARAMETERS
);
obj
.
checks
(
2
)
=
length
(
obj
.
azimuth
)
==
length
(
obj
.
ALTITUDES
);
obj
=
obj
.
updateInterpolant
(
);
end
function
obj
=
set
.
azimuthParameters
(
obj
,
value
)
obj
.
AZIMUTH_PARAMETERS
=
value
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
.
azimuth
=
obj
.
updateDistribution
(
obj
.
AZIMUTH_DISTRIBUTION
,
value
);
obj
.
checks
(
2
)
=
length
(
obj
.
azimuth
)
==
length
(
obj
.
ALTITUDES
);
obj
=
obj
.
updateInterpolant
(
);
end
function
obj
=
set
.
elevationDistribution
(
obj
,
value
)
obj
.
ELEVATION_DISTRIBUTION
=
value
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
.
elevation
=
obj
.
updateDistribution
(
value
,
obj
.
ELEVATION_PARAMETERS
);
obj
.
checks
(
3
)
=
length
(
obj
.
elevation
)
==
length
(
obj
.
ALTITUDES
);
obj
=
obj
.
updateInterpolant
(
);
end
function
obj
=
set
.
elevationParameters
(
obj
,
value
)
obj
.
ELEVATION_PARAMETERS
=
value
;
obj
.
isReady
=
obj
.
checkProperties
();
obj
.
elevation
=
obj
.
updateDistribution
(
obj
.
ELEVATION_DISTRIBUTION
,
value
);
obj
.
checks
(
3
)
=
length
(
obj
.
elevation
)
==
length
(
obj
.
ALTITUDES
);
obj
=
obj
.
updateInterpolant
(
);
end
function
value
=
get
.
altitudes
(
obj
),
value
=
obj
.
ALTITUDES
;
end
function
value
=
get
.
magnitudeDistribution
(
obj
),
value
=
obj
.
MAGNITUDE_DISTRIBUTION
;
end
function
value
=
get
.
azimuthDistribution
(
obj
),
value
=
obj
.
AZIMUTH_DISTRIBUTION
;
end
function
value
=
get
.
elevationDistribution
(
obj
),
value
=
obj
.
ELEVATION_DISTRIBUTION
;
end
function
value
=
get
.
magnitudeParameters
(
obj
),
value
=
obj
.
MAGNITUDE_PARAMETERS
;
end
function
value
=
get
.
azimuthParameters
(
obj
),
value
=
obj
.
AZIMUTH_PARAMETERS
;
end
function
value
=
get
.
elevationParameters
(
obj
),
value
=
obj
.
ELEVATION_PARAMETERS
;
end
end
methods
...
...
@@ -123,18 +121,8 @@ classdef Wind < Config
obj
@
Config
(
mission
,
varIn
);
end
function
obj
=
updateAll
(
obj
)
obj
.
magnitude
=
obj
.
updateDistribution
(
obj
.
MAGNITUDE_DISTRIBUTION
,
obj
.
MAGNITUDE_PARAMETERS
);
obj
.
azimuth
=
obj
.
updateDistribution
(
obj
.
AZIMUTH_DISTRIBUTION
,
obj
.
AZIMUTH_PARAMETERS
);
obj
.
elevation
=
obj
.
updateDistribution
(
obj
.
ELEVATION_DISTRIBUTION
,
obj
.
ELEVATION_PARAMETERS
);
obj
.
checks
(
1
)
=
length
(
obj
.
magnitude
)
==
length
(
obj
.
ALTITUDES
);
obj
.
checks
(
2
)
=
length
(
obj
.
azimuth
)
==
length
(
obj
.
ALTITUDES
);
obj
.
checks
(
3
)
=
length
(
obj
.
elevation
)
==
length
(
obj
.
ALTITUDES
);
end
function
[
uw
,
vw
,
ww
]
=
getVels
(
obj
,
z
)
if
~
all
(
obj
.
checks
)
if
~
obj
.
isReady
error
([
'Parameters and distributions must be the same '
...
'size as altitudes or scalar'
]);
end
...
...
@@ -144,18 +132,52 @@ classdef Wind < Config
vw
=
round
(
-
obj
.
magnitude
*
sin
(
obj
.
azimuth
)
*
cos
(
obj
.
elevation
),
6
);
ww
=
round
(
-
obj
.
magnitude
*
(
-
sin
(
obj
.
elevation
)),
6
);
else
mag
=
interpLinear
(
obj
.
altitudes
,
obj
.
magnitude
,
z
,
true
);
az
=
interpLinear
(
obj
.
altitudes
,
obj
.
azimuth
,
z
,
true
);
el
=
interpLinear
(
obj
.
altitudes
,
obj
.
elevation
,
z
,
true
);
data
=
obj
.
dataInerpolant
(
z
);
mag
=
data
(
1
);
az
=
data
(
2
);
el
=
data
(
3
);
uw
=
round
(
-
mag
*
cos
(
az
)
*
cos
(
el
),
6
);
vw
=
round
(
-
mag
*
sin
(
az
)
*
cos
(
el
),
6
);
ww
=
round
(
-
mag
*
(
-
sin
(
el
)),
6
);
end
end
function
obj
=
updateAll
(
obj
)
obj
.
magnitude
=
obj
.
updateDistribution
(
obj
.
MAGNITUDE_DISTRIBUTION
,
obj
.
MAGNITUDE_PARAMETERS
);
obj
.
azimuth
=
obj
.
updateDistribution
(
obj
.
AZIMUTH_DISTRIBUTION
,
obj
.
AZIMUTH_PARAMETERS
);
obj
.
elevation
=
obj
.
updateDistribution
(
obj
.
ELEVATION_DISTRIBUTION
,
obj
.
ELEVATION_PARAMETERS
);
obj
.
isReady
=
obj
.
checkProperties
();
obj
=
obj
.
updateInterpolant
();
end
function
obj
=
updateInterpolant
(
obj
)
% UPDATEINTERPOLANT: Interpolates [magnitude; azimuth; elevation] based on altitude
%
% Returns:
% - interpolant: griddedInterpolant for [magnitude; azimuth; elevation]
if
~
obj
.
isReady
,
return
;
end
if
isscalar
(
obj
.
ALTITUDES
),
return
;
end
% Prepare data for interpolation
data
=
[
obj
.
magnitude
;
obj
.
azimuth
;
obj
.
elevation
];
gridVec
=
obj
.
ALTITUDES
;
% Create gridded interpolant
obj
.
dataInerpolant
=
griddedInterpolant
(
gridVec
,
data
', '
linear
', '
nearest
'
);
end
end
methods
(
Access
=
private
)
function
ready
=
checkProperties
(
obj
)
% Check if STATIC, DYNAMIC, GEOMETRY, and STATE are non-empty
ready
=
...
length
(
obj
.
magnitude
)
==
length
(
obj
.
ALTITUDES
)
&&
...
length
(
obj
.
azimuth
)
==
length
(
obj
.
ALTITUDES
)
&&
...
length
(
obj
.
elevation
)
==
length
(
obj
.
ALTITUDES
);
end
function
vec
=
updateDistribution
(
obj
,
dist
,
parameters
)
s
=
length
(
obj
.
ALTITUDES
);
vec
=
[];
...
...
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