PROFIBUS over 802.11b

by

 

03 Nov 2003 (Updated )

Polling based PROFIBUS MAC layer over a 802.11 PHY.

wPROFIBUS_global_init(Block, action, varargin)
function varargout = wPROFIBUS_global_init(Block, action, varargin)

s = 'wPROFIBUS_Init';

% -- Get variables from mask
En   = get_param(Block, 'MaskEnables');
Vis  = get_param(Block, 'MaskVisibilities');
Vals = get_param(Block, 'MaskValues');

% -- Set Index to Mask parameters
setfieldindexnumbers(Block);

switch (action)
    
	case 'init'
        disp('Set global Channel Parameters')
        % -- Set Channel Type 
        set_param([gcs '/Channel'], 'BlockChoice', Vals{idxChannel_type});
        evalin('base','Chiprate=11e6;');
        evalin('base', ['EsNo=' num2str(Vals{idxEsNo}) ';']);
        evalin('base', ['T_d =' num2str(Vals{idxTransport_delay}) ';']);
        evalin('base', ['Freespace_loss =' num2str(Vals{idxFreespace_loss}) ';']);

	%*********************************************************************
	% Switch:           cbShowChannel
	% Description:       
	%*********************************************************************
	case 'cbShowChannel'
        % -- Set Index to Mask parameters
        setfieldindexnumbers(Block);
        
        % -- Set Visibilities
         switch(Vals{idxCH_preferences})        
            case 'on'
                switch(Vals{idxChannel_type})
                    case 'Cable'
                        idxOn   = [idxChannel_type];
                        idxOff  = [idxEsNo idxPath_Channel_Coeff idxTransport_delay idxFreespace_loss];
                        
                    case 'Cable with Delay'
                        idxOn   = [idxChannel_type idxTransport_delay];
                        idxOff  = [idxEsNo idxPath_Channel_Coeff idxFreespace_loss];
                        
                    case 'AWGN with Delay'
                        idxOn   = [idxChannel_type idxEsNo idxTransport_delay];
                        idxOff  = [idxPath_Channel_Coeff idxFreespace_loss];
                        
                    case 'AWGN with Delay and Attenuation'
                        idxOn   = [idxChannel_type idxTransport_delay idxEsNo idxFreespace_loss];
                        idxOff  = [idxPath_Channel_Coeff];
                        
                    case {'LOS Fading' , 'NLOS Fading'}
                        idxOn   = [idxChannel_type idxPath_Channel_Coeff];
                        idxOff  = [idxEsNo idxTransport_delay idxFreespace_loss];
                        
                    end
                    [Vis{idxOn}, En{idxOn}]     = deal('on');
                    [Vis{idxOff}, En{idxOff}]   = deal('off');
                    
            case 'off'
                idxOff = [idxChannel_type idxEsNo idxPath_Channel_Coeff idxTransport_delay];
                [En{idxOff}, Vis{idxOff}]  = deal('off');        
            end
        
        % --- Update parameters
        set_param(Block, 'MaskVisibilities',Vis, 'MaskEnables',En);
 
        
    case 'set_EsNo'        
        evalin('base', ['EsNo=' num2str(Vals{idxEsNo}) ';']);

end



Contact us