| @@ -21,12 +21,12 @@ T2 = T/2; | |||||
| T15 = 3*T/2; | T15 = 3*T/2; | ||||
| drv=[]; | drv=[]; | ||||
| for t=0:T/50:2*T; | |||||
| if (t<T/2) drv=[drv -B+rc*t]; end; | |||||
| if (T/2<=t)&(t<T) drv=[drv 3*B-rc*t]; end; | |||||
| if (T<=t)&(t<T15) drv=[drv -5*B+rc*t]; end; | |||||
| if (T15<=t) drv=[drv 7*B-rc*t]; end; | |||||
| end; | |||||
| for t=tv | |||||
| if (t<T2) drv=[drv -B+rc*t]; end | |||||
| if (T2<=t)&&(t<T) drv=[drv 3*B-rc*t]; end | |||||
| if (T<=t)&&(t<T15) drv=[drv -5*B+rc*t]; end | |||||
| if (T15<=t) drv=[drv 7*B-rc*t]; end | |||||
| end | |||||
| epdhv = ehv + dhv; | epdhv = ehv + dhv; | ||||
| epdpvhv = epdhv + vhv; | epdpvhv = epdhv + vhv; | ||||
| @@ -15,6 +15,7 @@ classdef Channel | |||||
| probe | probe | ||||
| label | label | ||||
| type | type | ||||
| probeunit | |||||
| end | end | ||||
| methods | methods | ||||
| @@ -50,6 +51,14 @@ classdef Channel | |||||
| function out = get.type(ch) | function out = get.type(ch) | ||||
| out = ch.CHAN('type?'); | out = ch.CHAN('type?'); | ||||
| end | end | ||||
| function out = get.probeunit(ch) | |||||
| out = ch.scope.query(['PROB',num2str(ch.channelnumber),':SET:ATT:UNIT?']); | |||||
| end | |||||
| function out = get.probe(ch) | |||||
| out = ch.scope.query(['PROB',num2str(ch.channelnumber),':SET:ATT:MAN?']); | |||||
| end | |||||
| function ch = set.state(ch,in) | function ch = set.state(ch,in) | ||||
| ch.CHAN('state',in); | ch.CHAN('state',in); | ||||
| @@ -107,6 +116,14 @@ classdef Channel | |||||
| out = str2double(ch.MEAS('phas')); | out = str2double(ch.MEAS('phas')); | ||||
| end | end | ||||
| function ch = set.probeunit(ch,unit) | |||||
| ch.scope.write(['PROB',num2str(ch.channelnumber),':SET:ATT:UNIT ', unit]); | |||||
| end | |||||
| function ch = set.probe(ch,man) | |||||
| ch.scope.write(['PROB',num2str(ch.channelnumber),':SET:ATT:MAN ', man]); | |||||
| end | |||||
| function data = waveform(ch,window) | function data = waveform(ch,window) | ||||
| ch.scope.single; | ch.scope.single; | ||||
| if nargin < 2 | if nargin < 2 | ||||
| @@ -240,8 +240,8 @@ classdef Equipment < handle | |||||
| methods (Access = protected, Hidden) | methods (Access = protected, Hidden) | ||||
| function setPrologix(ecq) | function setPrologix(ecq) | ||||
| fprintf(ecq.tcp, '++mode 1'); %set device in controller mode | |||||
| fprintf(ecq.tcp, '++auto 0'); %disable automatic datapull. this avoids errors on equipment. | |||||
| ecq.write_unsafe('++mode 1'); %set device in controller mode | |||||
| ecq.write_unsafe('++auto 0'); %disable automatic datapull. this avoids errors on equipment. | |||||
| end | end | ||||
| function delete(ecq) | function delete(ecq) | ||||
| @@ -265,10 +265,10 @@ classdef Equipment < handle | |||||
| persistent tcpconnection; %make variable persistent to share tcp-handles across multiple function calls. | persistent tcpconnection; %make variable persistent to share tcp-handles across multiple function calls. | ||||
| if isempty(tcpconnection) | if isempty(tcpconnection) | ||||
| %if the tcpconnection is empty (first time function | |||||
| %call) make a struct in the variable. | |||||
| tcpconnection = struct; | |||||
| end | |||||
| %if the tcpconnection is empty (first time function | |||||
| %call) make a struct in the variable. | |||||
| tcpconnection = struct; | |||||
| end | |||||
| [ipname,ipAddress] = Equipment.ip2structname(ipAddress,abs(port)); %Get a structname and a cleaned ipaddress. | [ipname,ipAddress] = Equipment.ip2structname(ipAddress,abs(port)); %Get a structname and a cleaned ipaddress. | ||||
| if port > 0 %if port number is positive a connection is made. | if port > 0 %if port number is positive a connection is made. | ||||