Highlights from
Embedded Coder Support Package for Green Hills MULTI IDE (R2012b)

image thumbnail

Embedded Coder Support Package for Green Hills MULTI IDE (R2012b)

by

 

Embedded Coder integration for creating models that run directly in Green Hills MULTI IDE

getBlockInfo_multilink_getSimPriority(modelName, moduleName, sysPriority)
function simPriority = getBlockInfo_multilink_getSimPriority(modelName, moduleName, sysPriority)
% simPriority = getBlockInfo_multilink_getSimPriority(moduleStr, moduleName, biosPriority)


% If the baseRate is specified then set the simPriority to sysPriority
% else map sys 7 to sim 40 (default) 
% and calculate HWI relative to that scale.
% moduleName = 'IDL' or 'HWI'
% 

% Copyright 2005-2011 The MathWorks, Inc.

% Retrieve sim. config parameters
cs = getActiveConfigSet(modelName);
solverType = get_param(cs, 'SolverType');
if ( ~strcmp(solverType, 'Fixed-step')  )
    simPriority = sysPriority;
    return
end

sampleTimeConst = get_param(cs, 'SampleTimeConstraint');
BaseRateTskPriority = 7;
specified = strcmp(sampleTimeConst, 'Specified');
if ( specified )
    % Priorities are specified by the user and we always ensure that
    % these lie in between 1-15 (TSK)
    sampleTimeProp = get_param(cs,'SampleTimeProperty');
    BaseRateTskPriority = sampleTimeProp.Priority;
end

switch moduleName
    case 'IDL'
        % 15
        maxSys = max(sysPriority);
        simPriority = sysPriority - (maxSys +1);
                
    case 'HWI'
        % HWI priority in this case ranges from 0 to 15
        if ( any(sysPriority < 0) || any(sysPriority > 15) )
            error(message('GHSMULTIEXT:util:InvalidInterruptRange'));
        end
        if (specified)
            simPriority = sysPriority;
        else
            simPriority = sysPriority + (40 - BaseRateTskPriority);
        end
    otherwise
        error(message('GHSMULTIEXT:util:InvalidModuleName'));
end
        
    

Contact us