From 65ad0a0a3d299d690205cfe945e5f02949e7926f Mon Sep 17 00:00:00 2001
From: Cristian Galperti <cristian.galperti@epfl.ch>
Date: Thu, 28 Nov 2019 10:26:44 +0100
Subject: [PATCH] All new node 02 inputs matching with std acq

The only differences are due to ADC calibration
differences
---
 code/classes/SCDclass_taskmdsloadprevADC.m | 33 +++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/code/classes/SCDclass_taskmdsloadprevADC.m b/code/classes/SCDclass_taskmdsloadprevADC.m
index 8720ad9..c3350e4 100644
--- a/code/classes/SCDclass_taskmdsloadprevADC.m
+++ b/code/classes/SCDclass_taskmdsloadprevADC.m
@@ -41,7 +41,11 @@ classdef SCDclass_taskmdsloadprevADC < SCDclass_task
             
             switch(obj.node)
                 case 2
-                    [~,value]=obj.getdataNode02ACQ196(shot); %% Here we need to switch betweeen old and new acquisition unit and tcv standard also
+                    if shot<65113
+                      [~,value]=obj.getdataNode02ACQ196(shot); %% Here we need to switch betweeen old and new acquisition unit and tcv standard also
+                    else
+                      [~,value]=obj.getdataNode02tst(shot); %% Here we need to switch betweeen old and new acquisition unit and tcv standard also
+                    end    
             end                
         end
         
@@ -121,6 +125,33 @@ classdef SCDclass_taskmdsloadprevADC < SCDclass_task
             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);
+            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 = 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);
+            if obj.verbose==1
+               fprintf('Getting data for bus: ''%s'' (%s, shot %d) ', 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('.');
+                end
+            end
+            value=T;
+            if obj.verbose==1
+                fprintf('\n');
+            end              
+        end
+        
     end
 end
 
-- 
GitLab