Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCDDS-core
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
SPC
SCDDS
SCDDS-core
Commits
11949f62
Commit
11949f62
authored
4 years ago
by
Federico Felici
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master' into DMmag
parents
21b5a080
379d7d9f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/classes/SCDclass_taskmdsloadprevADC.m
+89
-88
89 additions, 88 deletions
code/classes/SCDclass_taskmdsloadprevADC.m
with
89 additions
and
88 deletions
code/classes/SCDclass_taskmdsloadprevADC.m
+
89
−
88
View file @
11949f62
...
...
@@ -7,6 +7,10 @@ classdef SCDclass_taskmdsloadprevADC < SCDclass_task
workspacedatabasestructure
end
properties
(
Access
=
private
)
logdecimate
end
methods
function
obj
=
SCDclass_taskmdsloadprevADC
(
id
,
varargin
)
...
...
@@ -25,18 +29,24 @@ classdef SCDclass_taskmdsloadprevADC < SCDclass_task
obj
.
workspacedatabasestructure
=
''
;
end
obj
.
classname
=
mfilename
;
obj
.
logdecimate
=
20
;
end
function
init
(
obj
,
shot
)
mdsconnect
(
obj
.
mdsserver
);
mdsopen
(
obj
.
mdstree
,
shot
);
switch
(
obj
.
node
)
case
1
obj
.
actualizeNode01
(
shot
);
case
2
obj
.
actualizeNode02
(
shot
);
end
try
switch
(
obj
.
node
)
case
1
obj
.
actualizeNode
(
shot
,
96
);
case
2
obj
.
actualizeNode
(
shot
,
192
);
end
catch
fprintf
(
'\n'
);
warning
(
'SCDclass_taskmdsloadprevADC:init'
,
'Error initializing ADC bus for node %d.'
,
obj
.
node
);
end
end
function
[
obj
,
value
]
=
getdata
(
obj
,
shot
)
...
...
@@ -47,10 +57,12 @@ classdef SCDclass_taskmdsloadprevADC < SCDclass_task
case
1
[
~
,
value
]
=
obj
.
getdataNode01ACQ196
(
shot
);
case
2
% Here we need to switch betweeen old and new acquisition unit
% TODO: add tcv standard in case data is not available
if
shot
<
65113
[
~
,
value
]
=
obj
.
getdataNode02ACQ196
(
shot
);
%% Here we need to switch betweeen old and new acquisition unit and tcv standard also
[
~
,
value
]
=
obj
.
getdataNode02ACQ196
(
shot
);
else
[
~
,
value
]
=
obj
.
getdataNode02
tst
(
shot
);
%% Here we need to switch betweeen old and new acquisition unit and tcv standard also
[
~
,
value
]
=
obj
.
getdataNode02
ACQ2106
(
shot
);
end
end
end
...
...
@@ -70,146 +82,135 @@ classdef SCDclass_taskmdsloadprevADC < SCDclass_task
methods
(
Access
=
private
)
function
obj
=
actualizeNode
01
(
obj
,
shot
)
function
obj
=
actualizeNode
(
obj
,
shot
,
nadcs
)
dd
=
SCDconf_getdatadict
(
obj
.
datadictionary
);
adcbus
=
dd
.
getEntry
(
obj
.
modelbus
)
.
getValue
;
[
~
,
data
]
=
obj
.
getdata
(
shot
);
T
=
timeseries
;
if
obj
.
verbose
==
1
fprintf
(
'Actualizing data for bus:
''
%s
''
(%s, shot %d) '
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
fprintf
(
'Actualizing data for bus:
''
%s
''
(%s, shot %d)
0%%
'
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
end
for
ii
=
1
:
96
for
ii
=
1
:
nadcs
T
.
Time
=
data
.
Time
;
T
.
Data
=
int16
(
data
.
Data
(:,
ii
));
assignin
(
'base'
,
'temp'
,
T
);
assigncmd
=
sprintf
(
'%s.%s=temp;'
,
obj
.
workspacedatabasestructure
,
adcbus
.
Elements
(
ii
)
.
Name
);
evalin
(
'base'
,
assigncmd
);
if
obj
.
verbose
==
1
&&
mod
(
ii
,
4
)
==
0
fprintf
(
'
.'
);
if
obj
.
verbose
==
1
&&
mod
(
ii
,
obj
.
logdecimate
)
==
0
fprintf
(
'
%.0f%% '
,
ii
/
nadcs
*
100
);
end
end
evalin
(
'base'
,
'clear temp'
);
if
obj
.
verbose
==
1
fprintf
(
'\n'
);
fprintf
(
'
100%%
\n'
);
end
end
function
obj
=
actualizeNode02
(
obj
,
shot
)
dd
=
SCDconf_getdatadict
(
obj
.
datadictionary
);
adcbus
=
dd
.
getEntry
(
obj
.
modelbus
)
.
getValue
;
[
~
,
data
]
=
obj
.
getdata
(
shot
);
T
=
timeseries
;
%%
% Node 01 loading functions
function
[
obj
,
value
]
=
getdataNode01ACQ196
(
obj
,
shot
)
T
=
timeseries
;
timebase
=
mdsvalue
(
'dim_of(\top.crpprt01.board1.adc_01)'
);
%% TODO: check with marte
d_time
=
double
(
mdsvalueraw
(
'\top.crpprt01.params:d_time'
))
*
1.0e-6
;
%timebase = round(timebase.*1/d_time)*d_time-d_time/2;
timebase
=
round
(
timebase
.*
1
/
d_time
)
*
d_time
-
d_time
/
100
;
T
.
Time
=
timebase
;
T
.
Data
=
zeros
(
numel
(
timebase
),
96
);
datamatrix
=
zeros
(
numel
(
timebase
),
96
);
if
obj
.
verbose
==
1
fprintf
(
'
Actualiz
ing data for bus:
''
%s
''
(%s, shot %d) '
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
fprintf
(
'
Gett
ing data for bus:
''
%s
''
(%s, shot %d)
0%%
'
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
end
for
ii
=
1
:
192
T
.
Time
=
data
.
Time
;
T
.
Data
=
int16
(
data
.
Data
(:,
ii
));
assignin
(
'base'
,
'temp'
,
T
);
assigncmd
=
sprintf
(
'%s.%s=temp;'
,
obj
.
workspacedatabasestructure
,
adcbus
.
Elements
(
ii
)
.
Name
);
evalin
(
'base'
,
assigncmd
);
if
obj
.
verbose
==
1
&&
mod
(
ii
,
4
)
==
0
fprintf
(
'
.'
);
for
ii
=
1
:
96
% Node 01 data are loaded in the stored order since
% up to now there is only old node 01
channelstr
=
sprintf
(
'\\top.crpprt01.board1.adc_%02d.raw'
,
physical2logical
(
ii
)
);
datamatrix
(:,
ii
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
obj
.
logdecimate
)
==
0
fprintf
(
'
%.0f%% '
,
ii
/
96
*
100
);
end
end
evalin
(
'base'
,
'clear temp'
);
T
.
Data
=
datamatrix
;
% this speeds up a lot the loading
value
=
T
;
if
obj
.
verbose
==
1
fprintf
(
'\n'
);
end
fprintf
(
'
100%%
\n'
);
end
end
%%
% Node 02 loading functions
function
[
obj
,
value
]
=
getdataNode02ACQ196
(
obj
,
shot
)
T
=
timeseries
;
timebase
=
mdsvalue
(
'dim_of(\top.crpprt02.board1.adc_01)'
);
%% TODO: check with marte
timebase
=
mdsvalue
(
'dim_of(\top.crpprt02.board1.adc_01)'
);
d_time
=
double
(
mdsvalueraw
(
'\top.crpprt02.params:d_time'
))
*
1.0e-6
;
%timebase = round(timebase.*1/d_time)*d_time-d_time/2;
timebase
=
round
(
timebase
.*
1
/
d_time
)
*
d_time
-
d_time
/
100
;
T
.
Time
=
timebase
;
T
.
Data
=
zeros
(
numel
(
timebase
),
192
);
datamatrix
=
zeros
(
numel
(
timebase
),
192
);
if
obj
.
verbose
==
1
fprintf
(
'Getting data for bus:
''
%s
''
(%s, shot %d) '
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
fprintf
(
'Getting data for bus:
''
%s
''
(%s, shot %d)
0%%
'
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
end
for
ii
=
1
:
96
% NOTE: physical2logical remapping is only for
% data acquired with the present ACQ196 system
% it must go away when using the new ACQ2106 system
%fprintf('Loading channel %d:%d ...\r',1,physical2logical(ii));
% data acquired with the ACQ196 system, not for the new
% 2106 based one
channelstr
=
sprintf
(
'\\top.crpprt02.board1.adc_%02d.raw'
,
physical2logical
(
ii
));
T
.
Data
(:,
ii
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
4
)
==
0
fprintf
(
'
.'
);
datamatrix
(:,
ii
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
obj
.
logdecimate
)
==
0
fprintf
(
'
%.0f%% '
,
ii
/
192
*
100
);
end
end
for
ii
=
1
:
96
%fprintf('Loading channel %d:%d ...\r',2,physical2logical(ii));
channelstr
=
sprintf
(
'\\top.crpprt02.board2.adc_%02d.raw'
,
physical2logical
(
ii
));
T
.
Data
(:,
ii
+
96
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
4
)
==
0
fprintf
(
'
.'
);
datamatrix
(:,
ii
+
96
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
obj
.
logdecimate
)
==
0
fprintf
(
'
%.0f%% '
,
(
ii
+
96
)/
192
*
100
);
end
end
T
.
Data
=
datamatrix
;
% this speeds up a lot the loading
value
=
T
;
if
obj
.
verbose
==
1
fprintf
(
'\n'
);
fprintf
(
'
100%%
\n'
);
end
end
function
[
obj
,
value
]
=
getdataNode02tst
(
obj
,
shot
)
% TODO: this should go away as soon as we use the official rtc
% tree
mdsopen
(
'rtctst'
,
shot
);
function
[
obj
,
value
]
=
getdataNode02ACQ2106
(
obj
,
shot
)
if
shot
>
65826
mdsnodename
=
'node02'
;
else
mdsnodename
=
'tcvrt02'
;
end
mdsopen
(
'rtc'
,
shot
);
T
=
timeseries
;
timebase
=
mdsvalue
(
'dim_of(\top.
tcvrt02
.adc.adc_001)'
);
%% TODO: check with marte
d_time
=
double
(
mdsvalueraw
(
'\top.
tcvrt02
.params:d_time'
))
*
1.0e-6
;
timebase
=
mdsvalue
(
[
'dim_of(\top.
'
mdsnodename
'
.adc.adc_001)'
]
);
d_time
=
double
(
mdsvalueraw
(
[
'\top.
'
mdsnodename
'
.params:d_time'
]
))
*
1.0e-6
;
%timebase = round(timebase.*1/d_time)*d_time-d_time/2;
timebase
=
round
(
timebase
.*
1
/
d_time
)
*
d_time
-
d_time
/
100
;
T
.
Time
=
timebase
;
T
.
Data
=
zeros
(
numel
(
timebase
),
192
);
datamatrix
=
zeros
(
numel
(
timebase
),
192
);
if
obj
.
verbose
==
1
fprintf
(
'Getting data for bus:
''
%s
''
(%s, shot %d) '
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
fprintf
(
'Getting data for bus:
''
%s
''
(%s, shot %d)
0%%
'
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
end
for
ii
=
1
:
192
channelstr
=
sprintf
(
'\\top.tcvrt02.adc.adc_%03d.raw'
,
ii
);
T
.
Data
(:,
ii
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
4
)
==
0
fprintf
(
'.'
);
channelstr
=
sprintf
([
'\\top.'
mdsnodename
'.adc.adc_%03d.raw'
],
ii
);
%T.Data(:,ii)=int16(mdsvalue(channelstr));
%T.Data(:,ii)=int16(mdsvalueraw(channelstr));
datamatrix
(:,
ii
)
=
int16
(
mdsvalueraw
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
obj
.
logdecimate
)
==
0
fprintf
(
'%.0f%% '
,
ii
/
192
*
100
);
end
end
T
.
Data
=
datamatrix
;
% this speeds up a lot the loading
value
=
T
;
if
obj
.
verbose
==
1
fprintf
(
'\n'
);
fprintf
(
'
100%%
\n'
);
end
end
function
[
obj
,
value
]
=
getdataNode01ACQ196
(
obj
,
shot
)
T
=
timeseries
;
timebase
=
mdsvalue
(
'dim_of(\top.crpprt01.board1.adc_01)'
);
%% TODO: check with marte
d_time
=
double
(
mdsvalueraw
(
'\top.crpprt01.params:d_time'
))
*
1.0e-6
;
%timebase = round(timebase.*1/d_time)*d_time-d_time/2;
timebase
=
round
(
timebase
.*
1
/
d_time
)
*
d_time
-
d_time
/
100
;
T
.
Time
=
timebase
;
T
.
Data
=
zeros
(
numel
(
timebase
),
96
);
if
obj
.
verbose
==
1
fprintf
(
'Getting data for bus:
''
%s
''
(%s, shot %d) '
,
obj
.
modelbus
,
obj
.
classname
,
shot
);
end
for
ii
=
1
:
96
% Node 01 data are loaded in the stored order since
% up to now there is only old node 01
channelstr
=
sprintf
(
'\\top.crpprt01.board1.adc_%02d.raw'
,
physical2logical
(
ii
));
T
.
Data
(:,
ii
)
=
int16
(
mdsvalue
(
channelstr
));
if
obj
.
verbose
==
1
&&
mod
(
ii
,
4
)
==
0
fprintf
(
'.'
);
end
end
value
=
T
;
if
obj
.
verbose
==
1
fprintf
(
'\n'
);
end
end
end
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