From 96e614f188bf3d031e837b5d3426f9ea2a9da0f0 Mon Sep 17 00:00:00 2001
From: Federico Felici <federico.felici@epfl.ch>
Date: Mon, 22 Nov 2021 17:59:26 +0100
Subject: [PATCH] Update node masks to show correct node info

---
 code/functions/SCDconf_maskstring.m | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 code/functions/SCDconf_maskstring.m

diff --git a/code/functions/SCDconf_maskstring.m b/code/functions/SCDconf_maskstring.m
new file mode 100644
index 0000000..1e96bf8
--- /dev/null
+++ b/code/functions/SCDconf_maskstring.m
@@ -0,0 +1,28 @@
+function str = SCDconf_maskstring(nodenr)
+
+varname    = sprintf('SCDnode%02dparams',nodenr);
+try
+  nodeparams = Simulink.data.evalinGlobal('tcv',varname);
+  varalgo = Simulink.data.evalinGlobal('tcv','SCDvaralgo');
+catch ME
+  if ~isequal(ME.identifier,'SLDD:sldd:InvalidEvalinCommand'), rethrow(ME); end
+  str = 'Expcode not setup yet'; return;
+end
+
+stract     = sprintf('Node %02d: ONLINE\n',nodenr);
+if nodeparams.active
+  strthreads = 'CPU Ts [ms]:';
+  stralgos   = 'ALGOCODES: ';
+  for threadnr = 1:numel(nodeparams.timing.thperiod)
+    thper = nodeparams.timing.thperiod(threadnr);
+    varalgonr  = varalgo.(sprintf('algo%02d%02d',nodenr,threadnr));
+    strthreads = sprintf('%s %3.1f,',strthreads,thper*1000);
+    stralgos   = sprintf('%s %3d ,',stralgos,varalgonr);
+  end
+  strthreads = strthreads(1:end-1);
+  stralgos   = stralgos(1:end-1);
+  str = strcat(stract,'\n',strthreads,'\n',stralgos);
+else
+  str = sprintf('Node %02d: OFFLINE',nodenr);
+end
+end
\ No newline at end of file
-- 
GitLab