Skip to content
Snippets Groups Projects
Commit d106e4b8 authored by Luke Simons's avatar Luke Simons
Browse files

Changed comments. Added calculation for epoch time in ns

parent 8ff7659f
No related branches found
No related tags found
1 merge request!196Resolve "Add dataset_description IDS"
Pipeline #266136 passed
...@@ -64,11 +64,11 @@ ids_dataset_description.pulse=shot; ...@@ -64,11 +64,11 @@ ids_dataset_description.pulse=shot;
% Attempt to fill information about pulse time % Attempt to fill information about pulse time
% FIXME: How to get pulse_time_end? Simply = pulse_time_begin + X seconds? % FIXME: How to get pulse_time_end? Simply = pulse_time_begin + X seconds?
[pulse_time_begin,pulse_time_begin_epoch]= ... [pulse_time_begin,pulse_time_begin_epoch,pulse_time_begin_epoch_ns]= ...
get_mds_node_info('\VSYSTEM:TIMERS.VALUES',shot); get_mds_node_info('\VSYSTEM:TIMERS.VALUES',shot);
ids_dataset_description.pulse_time_begin=pulse_time_begin; ids_dataset_description.pulse_time_begin=pulse_time_begin;
ids_dataset_description.pulse_time_begin_epoch.seconds=pulse_time_begin_epoch; ids_dataset_description.pulse_time_begin_epoch.seconds=pulse_time_begin_epoch;
ids_dataset_description.pulse_time_begin_epoch.nanoseconds=pulse_time_begin_epoch.*1e9; ids_dataset_description.pulse_time_begin_epoch.nanoseconds=pulse_time_begin_epoch_ns;
% ids_dataset_description.pulse_time_end_epoch.seconds= % ids_dataset_description.pulse_time_end_epoch.seconds=
% ids_dataset_description.pulse_time_end_epoch.nanoseconds= % ids_dataset_description.pulse_time_end_epoch.nanoseconds=
% ids_dataset_description.pulse_processing_time_begin=node_time % ids_dataset_description.pulse_processing_time_begin=node_time
......
function [node_time, node_epoch_time, node_owner] = get_mds_node_info(node_str, shot) function [node_time, node_epoch_time, node_epoch_time_ns, node_owner] = get_mds_node_info(node_str, shot)
%GET_MDS_NODE_INFO Retrieves insertion time and owner of a node in MDSplus % [node_time, node_epoch_time, node_owner] =
% get_mds_node_info(node_str, shot)
%
% Retrieves insertion time and owner of a node in MDSplus
% %
% [node_time, node_owner] = GET_MDS_NODE_INFO(node_str, shot)
% Inputs: % Inputs:
% node_str - String path to the MDSplus node % node_str - String, path to the MDSplus node
% (e.g. '\\RESULTS::CXRS_001:TI') % (e.g. '\\RESULTS::CXRS_001:TI')
% shot - Shot number to open % shot - Numeric, Shot number to open
% %
% Outputs: % Outputs:
% node_time - Time the node data was inserted % node_time - Numeric, Time the node data was inserted
% node_owner - (Optional) Owner info of the node % node_owner - String, (Optional) Owner info of the node
%
% Date: 20/09/24
% Author: L. Simons
% Open the shot % Open the shot
mdsopen('tcv_shot',shot); mdsopen('tcv_shot',shot);
...@@ -25,7 +30,7 @@ function [node_time, node_epoch_time, node_owner] = get_mds_node_info(node_str, ...@@ -25,7 +30,7 @@ function [node_time, node_epoch_time, node_owner] = get_mds_node_info(node_str,
node_time = [time_str 'Z']; node_time = [time_str 'Z'];
% Convert to Unix Epoch time (seconds since Jan 1, 1970 UTC) % Convert to Unix Epoch time (seconds since Jan 1, 1970 UTC)
node_epoch_time = posixtime(datetime(mds_node_time, 'InputFormat', 'dd-MMM-yyyy HH:mm:ss.SSSSSS', 'TimeZone', 'UTC')); node_epoch_time = posixtime(datetime(mds_node_time, 'InputFormat', 'dd-MMM-yyyy HH:mm:ss.SSSSSS', 'TimeZone', 'UTC'));
node_epoch_time_ns=mod(second(dt),1)*1e9;
% Owner % Owner
tdi_owner = sprintf('owner_ascii("%s")', node_str); tdi_owner = sprintf('owner_ascii("%s")', node_str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment