0001 function fmdl = fmdl_model_device(fmdl,device, opt);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if ischar(fmdl) && strcmp(fmdl,'UNIT_TEST'); do_unit_test(); return; end
0020
0021 if nargin<3; opt=struct(); end
0022
0023 switch lower(device)
0024 case {'draeger','dräger','pulmovista500'}
0025 fmdl=mdl_normalize(fmdl,true);
0026 mA = 0.01;
0027 fmdl.stimulation = mk_stim_patterns(16,1, ...
0028 [0,1],[0,1],{'no_meas_current','rotate_meas'},mA);
0029
0030 case {'sentec','swisstom'}
0031
0032 if ~isfield(opt,'skip'); opt.skip = 4; end
0033 if ~isfield(opt,'next'); opt.next = 1; end
0034 fmdl=mdl_normalize(fmdl,false);
0035 mA = 0.01;
0036 SS = [0,opt.skip+1];
0037 fmdl.stimulation = mk_stim_patterns(32,1, ...
0038 SS,SS,{sprintf('no_meas_current_next%d',opt.next)},mA);
0039
0040 otherwise error('No information about device');
0041 end
0042
0043 function do_unit_test
0044 fmdl = getfield(mk_common_model('a2c2',16), ...
0045 'fwd_model');
0046 ssmm = stim_meas_list(fmdl.stimulation);
0047 unit_test_cmp('Init',ssmm([8,35],:), [
0048 1 2 11 10; 3 4 13 12]);
0049
0050 fmdl = fwd_model_device(fmdl,'Draeger');
0051 ssmm = stim_meas_list(fmdl.stimulation);
0052 unit_test_cmp('Draeger',size(ssmm,1),208);
0053 unit_test_cmp('Draeger',ssmm([8,35],:), [
0054 1 2 11 10; 3 4 14 13]);
0055 unit_test_cmp('Draeger',fmdl.normalize_measurements, true);
0056
0057
0058 fmdl = getfield(mk_common_model('b2c2',32), ...
0059 'fwd_model');
0060 fmdl = fwd_model_device(fmdl,'Sentec');
0061 ssmm = stim_meas_list(fmdl.stimulation);
0062 unit_test_cmp('Sentec',size(ssmm,1),736);
0063 unit_test_cmp('Sentec',ssmm([8,35],:), [
0064 1 6 18 13; 2 7 23 18]);
0065 unit_test_cmp('Sentec',fmdl.normalize_measurements, false);
0066
0067 opt.skip=2;
0068 fmdl = fwd_model_device(fmdl,'Sentec',opt);
0069 ssmm = stim_meas_list(fmdl.stimulation);
0070 unit_test_cmp('Sentec',size(ssmm,1),736);
0071 unit_test_cmp('Sentec',ssmm([8,35],:), [
0072 1 4 16 13; 2 5 21 18]);
0073
0074 opt.next=2;
0075 fmdl = fwd_model_device(fmdl,'Sentec',opt);
0076 ssmm = stim_meas_list(fmdl.stimulation);
0077 unit_test_cmp('Sentec',size(ssmm,1),672);
0078 unit_test_cmp('Sentec',ssmm([8,35],:), [
0079 1 4 17 14; 2 5 24 21]);