Skip to content
Snippets Groups Projects
Commit df0aca77 authored by Cristian Galperti's avatar Cristian Galperti
Browse files

Merge remote-tracking branch 'origin/master' into fix-RAPTOR-build

parents 04581217 3467ac7b
No related branches found
No related tags found
No related merge requests found
/*
Retrieves signal corresponding to named mem/stat signal in RTC tree
call:
_sig = rtc_get(_type, _name, [_inode,[_ithread]])
arguments:
_type: "mem" or "stat"
_name: name of the signal to retrieve
_inode: [optional] retrieve dictionary from this rt-node only
_ithread: [optional] retrieve dictionary from this thread only
(must be used together with _inode)
returns:
_sig: Signal (node reference) corresponding to _name with type _type
This function requires an rtc tree to be open.
If _inode and _ithread are absent then the global dictionary is queried.
For debugging puposes a dictionary can be given as a 5th argument and it
will be used in place of the one stored in the tree.
*/
FUN PUBLIC rtc_get(_type, _name, optional _inode, optional _ithread, optional _dict)
{
_has_inode = present(_inode ) && KIND(_inode )>0;
_has_ithread = present(_ithread) && KIND(_ithread)>0;
_has_dict = present(_dict ) && KIND(_dict )>0;
if (!_has_dict)
{
_nodestr= ($SHOT>65700 || $SHOT==-1) ? "node" : "tcvrt";
_thread = _has_ithread ? ".thread"//iii(_ithread,2)//"." : "";
_node = _has_inode ? _nodestr //iii(_inode ,2)//"." : "";
_base = "\\rtc::top."//_node//_thread//"dicts:"//_type//"s";
_dict = build_path(_base);
}
_mem = size(_dict)>0 ? _dict[_name] : abort();
if (dim_of(_mem) != _name) { abort();}
return(BUILD_PATH(data(_mem)));
}
/*
Creates dictionary of mem or stat signals for the RTC tree
call:
_dict = rtc_make_dict(_type, [_inode,[_ithread]])
arguments:
_type: "mem" or "stat"
_inode: [optional] restrict dictionary to signals from this rt-node
_ithread: [optional] restrict dictionary to signals from this thread
(must be used together with _inode)
returns:
_dict: signal with node addresses as data and mem/stat names as dimension.
_dict[_name] then yields the node address corresponding to the mem named _name
*/
FUN PUBLIC rtc_make_dict(_type, optional _inode, optional _ithread)
{
_nodestr= ($SHOT>65700 || $SHOT==-1) ? "node" : "tcvrt";
_thread = present(_ithread) ? ".thread"//iii(_ithread,2) : "";
_node = present(_inode ) ? "."//_nodestr//iii(_inode,2) : "";
_base = "\\rtc::top"//_node//_thread//"***:"//_type//"_%%%";
_nids = TreeFindNodeWild(_base);
_path = getnci(_nids,"PATH");
if (size(_path)>0)
{
_len = getnci(adjustl(adjustr(_path)//":raw"),"LENGTH");
_path = pack(_path,_len>0);
}
if (size(_path)>0)
{
_name = getnci(adjustl(adjustr(_path)//":name"),"record");
_order = sort(_name);
_dict = MAKE_SIGNAL(_path[_order],*,_name[_order]);
}
else
{
_dict = MAKE_SIGNAL([],*,[]);
}
return(_dict);
}
/*
Retrieves signal corresponding to named mem signal in RTC tree
call:
_sig = rtc_mem(_name, [_inode,[_ithread]])
arguments:
_name: name of the mem signal to retrieve
_inode: [optional] retrieve dictionary from this rt-node only
_ithread: [optional] retrieve dictionary from this thread only
(must be used together with _inode)
returns:
_sig: Signal (node reference) corresponding to mem named _name
See also: rtc_get
*/
FUN PUBLIC rtc_mem(_name, optional _inode, optional _ithread, optional _dict)
{
Return(rtc_get("mem", "mem."//_name, _inode, _ithread, _dict));
}
/*
Builds a jScope plottable profile
out of a MDS+ node stored
with MARTe2 (i.e. with only the temporal
dimension available). This works only for
2D signals.
call:
_sig = rtc_profile(_s)
arguments:
_s input MDS+ channel containing
a time dependent profile in this form:
- data shape is [profile points, times]
- the first dimension is time
returns:
a jScope plottable build_signal
expression to plot the profile
with live update capability (ctrl-Y in jScope)
*/
FUN PUBLIC rtc_profile(_s)
{
/* Leave second dimension empty, MDSplus will return 0:size-1 when asked for it */
Return(build_param(build_signal(transpose(DATA(_s)), *, DIM_OF(_s), *),help_of(_s),1));
}
/*
Retrieves signal corresponding to named stat signal in RTC tree
call:
_sig = rtc_stat(_name, [_inode,[_ithread]])
arguments:
_name: name of the stat signal to retrieve
_inode: [optional] retrieve dictionary from this rt-node only
_ithread: [optional] retrieve dictionary from this thread only
(must be used together with _inode)
returns:
_sig: Signal (node reference) corresponding to stat named _name
See also: rtc_get
*/
FUN PUBLIC rtc_stat(_name, optional _inode, optional _ithread, optional _dict)
{
Return(rtc_get("stat", _name, _inode, _ithread, _dict));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment