Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MechaRaptor - Data Processing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
Aerospace and Mechanical Engineering
tlambert
MechaRaptor - Data Processing
Commits
8820a868
Verified
Commit
8820a868
authored
2 years ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
feat(static): add support for static results
parent
38fbab25
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
processall.m
+29
-23
29 additions, 23 deletions
processall.m
utils/loadtunnel.m
+6
-2
6 additions, 2 deletions
utils/loadtunnel.m
utils/savecsv.m
+21
-12
21 additions, 12 deletions
utils/savecsv.m
with
56 additions
and
37 deletions
processall.m
+
29
−
23
View file @
8820a868
...
...
@@ -55,40 +55,43 @@ function ExpData = processall(idFile)
ExpData
(
iTest
)
.
freq
=
idTable
(
iTest
,
:)
.
freq
;
fprintf
(
'Processing file: %s\n'
,
ExpData
(
iTest
)
.
tunnelFile
);
% Load and clean experimental data
[
arduShort
,
arduFull
]
=
loadardu
(
ExpData
(
iTest
)
.
arduFile
);
% Load, clean and sync experimental data
tunnelData
=
loadtunnel
(
ExpData
(
iTest
)
.
tunnelFile
,
...
CUTOFF_MULTIPLIER
*
idTable
(
iTest
,
:)
.
freq
);
% Sync the two data sources
[
arduShort
,
tunnelData
,
ExpData
(
iTest
)
.
arduStart
,
ExpData
(
iTest
)
.
tunnelStart
]
=
...
syncdata
(
arduShort
,
tunnelData
);
% Save the cleaned data
savecsv
(
ExpData
(
iTest
),
arduShort
,
tunnelData
);
% TODO
if
~
isempty
(
ExpData
(
iTest
)
.
arduFile
)
% Not for static tests (no ardu data)
[
arduShort
,
~
]
=
loadardu
(
ExpData
(
iTest
)
.
arduFile
);
[
arduShort
,
tunnelData
,
ExpData
(
iTest
)
.
arduStart
,
ExpData
(
iTest
)
.
tunnelStart
]
=
...
syncdata
(
arduShort
,
tunnelData
);
% Save stuff for later use
ExpData
(
iTest
)
.
time
=
arduShort
(:,
1
);
ExpData
(
iTest
)
.
Front
.
angles
=
arduShort
(:,
2
);
ExpData
(
iTest
)
.
Front
.
power
=
arduShort
(:,
4
);
ExpData
(
iTest
)
.
Aft
.
power
=
arduShort
(:,
5
);
else
arduShort
=
[];
arduFull
=
[];
% Save stuff for later use
ExpData
(
iTest
)
.
time
=
0
:
1
/
1000
:(
size
(
tunnelData
,
1
)
-
1
)
/
1000
;
% FIXME: no magic NB
ExpData
(
iTest
)
.
Front
.
angles
=
ones
(
size
(
ExpData
(
iTest
)
.
time
))
*
...
idTable
(
iTest
,
:)
.
Angles1
;
ExpData
(
iTest
)
.
Aft
.
angles
=
ones
(
size
(
ExpData
(
iTest
)
.
time
))
*
...
idTable
(
iTest
,
:)
.
Angles2
;
ExpData
(
iTest
)
.
Front
.
power
=
[];
ExpData
(
iTest
)
.
Aft
.
power
=
[];
% Split datasets between front and aft [FIXME]: Get rid of old deprecated variables
ExpData
(
iTest
)
.
front
.
arduFull
=
arduFull
(:,
[
1
:
3
,
6
]);
ExpData
(
iTest
)
.
aft
.
arduFull
=
arduFull
(:,
[
1
,
4
:
5
,
7
]);
ExpData
(
iTest
)
.
front
.
arduShort
=
arduShort
(:,
[
1
:
2
,
4
]);
ExpData
(
iTest
)
.
aft
.
arduShort
=
arduShort
(:,
[
1
,
3
,
5
]);
ExpData
(
iTest
)
.
front
.
tunnelData
=
tunnelData
(:,
1
:
6
);
ExpData
(
iTest
)
.
aft
.
tunnelData
=
tunnelData
(:,
7
:
end
);
end
% Better variables
ExpData
(
iTest
)
.
time
=
arduShort
(:,
1
);
ExpData
(
iTest
)
.
sampling
=
1
/
diff
(
ExpData
(
iTest
)
.
time
(
1
:
2
));
ExpData
(
iTest
)
.
Front
.
angles
=
arduShort
(:,
2
);
ExpData
(
iTest
)
.
Front
.
forces
=
tunnelData
(:,
1
:
3
);
ExpData
(
iTest
)
.
Front
.
moments
=
tunnelData
(:,
4
:
6
);
ExpData
(
iTest
)
.
Front
.
power
=
arduShort
(:,
4
);
ExpData
(
iTest
)
.
Aft
.
angles
=
arduShort
(:,
3
);
ExpData
(
iTest
)
.
Aft
.
forces
=
tunnelData
(:,
6
+
(
1
:
3
));
ExpData
(
iTest
)
.
Aft
.
moments
=
tunnelData
(:,
6
+
(
4
:
6
));
ExpData
(
iTest
)
.
Aft
.
power
=
arduShort
(:,
5
);
ExpData
(
iTest
)
.
Testcase
.
dx
=
idTable
(
iTest
,
:)
.
dstX
;
ExpData
(
iTest
)
.
Testcase
.
airspeed
=
idTable
(
iTest
,
:)
.
v_air
;
...
...
@@ -100,6 +103,9 @@ function ExpData = processall(idFile)
plottime
(
ExpData
(
iTest
),
'arduShort'
,
false
);
end
% Save the cleaned data
savecsv
(
ExpData
(
iTest
),
arduShort
,
tunnelData
);
end
% Save ExpData structure to MAT file
...
...
This diff is collapsed.
Click to expand it.
utils/loadtunnel.m
+
6
−
2
View file @
8820a868
...
...
@@ -41,8 +41,12 @@ function tunnelData = loadtunnel(tunnelFile, cutoff)
% Convert into table
raw
=
table2array
(
tunnelTable
);
% Filter
filtered
=
filterwt
(
raw
,
cutoff
,
SAMPLING
);
% Filter flapping signal, not needed in static
if
cutoff
~=
0
filtered
=
filterwt
(
raw
,
cutoff
,
SAMPLING
);
else
filtered
=
raw
;
end
% Calibrate
calibrated
=
calibrate
(
filtered
);
...
...
This diff is collapsed.
Click to expand it.
utils/savecsv.m
+
21
−
12
View file @
8820a868
...
...
@@ -11,9 +11,22 @@ function savecsv(ExpData, arduShort, tunnelData)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Constants and defaults
TABLE_HEADER
=
{
'Time'
,
'Angle1'
,
'Angle2'
,
'Power1'
,
'Power2'
,
...
'Fx1'
,
'Fy1'
,
'Fz1'
,
'Mx1'
,
'My1'
,
'Mz1'
,
...
'Fx2'
,
'Fy2'
,
'Fz2'
,
'Mx2'
,
'My2'
,
'Mz2'
};
FULL_TABLE_HEADER
=
{
'Time'
,
'Angle1'
,
'Angle2'
,
'Power1'
,
'Power2'
,
...
'Fx1'
,
'Fy1'
,
'Fz1'
,
'Mx1'
,
'My1'
,
'Mz1'
,
...
'Fx2'
,
'Fy2'
,
'Fz2'
,
'Mx2'
,
'My2'
,
'Mz2'
};
STATIC_TABLE_HEADER
=
{
'Time'
,
...
'Fx1'
,
'Fy1'
,
'Fz1'
,
'Mx1'
,
'My1'
,
'Mz1'
,
...
'Fx2'
,
'Fy2'
,
'Fz2'
,
'Mx2'
,
'My2'
,
'Mz2'
};
SAMPLING
=
1000
;
if
isempty
(
arduShort
)
tableHeader
=
STATIC_TABLE_HEADER
;
time
=
(
0
:
1
/
SAMPLING
:(
size
(
tunnelData
,
1
)
-
1
)
/
SAMPLING
)
'
;
else
tableHeader
=
FULL_TABLE_HEADER
;
time
=
arduShort
(:,
1
);
end
% Make filename
[
path
,
~
]
=
fileparts
(
ExpData
.
tunnelFile
);
...
...
@@ -25,18 +38,14 @@ function savecsv(ExpData, arduShort, tunnelData)
if
~
exist
(
string
(
savefile
),
'file'
)
% Merges the two arrays together and put it in table
cleanedArray
=
formatarrays
(
arduShort
,
tunnelData
);
size
(
time
);
size
(
arduShort
);
size
(
tunnelData
);
cleanedArray
=
[
time
,
arduShort
,
tunnelData
];
cleanedTable
=
array2table
(
cleanedArray
,
...
'VariableNames'
,
TABLE_HEADER
);
'VariableNames'
,
tableHeader
);
% Write table to file
writetable
(
cleanedTable
,
string
(
savefile
));
end
end
function
merged
=
formatarrays
(
arduShort
,
tunnelData
)
% FORMATTABLE Merges and reformat the two arrays into a single one
merged
=
[
arduShort
,
tunnelData
];
end
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