 function excel2wkspbms_DGM()
% 将excel_file中的数据导入到workspace中
  xlsName='DD_DGM.xlsx';
% 每个Feature都有三个sheet,分别为Signals,Calibrations,Constants

% excel中各栏对应的内容
nc_var_name = 1;
nc_initial_value = 2;
nc_min_value = 3;
nc_max_value = 4;
nc_data_type = 5;
nc_uints = 6;
nc_description = 7;

% supplier=evalin('base','supplier');
supplier='UAES';
DTC_num=0;
%% %%%%%%%%%%%%%%%%%%%%%%% UAES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if strcmp(supplier,'UAES')
%% 标定量
        [~,~,raw] = xlsread(xlsName,'Calibrations');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    verName=raw{i,nc_var_name};
                    
                    dataName= evalin('base',['ai_',supplier,'.Parameter']);
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.Value=raw{i,nc_initial_value};
                    else
                       dataName.Value=eval(raw{i,nc_initial_value});
                    end
                    dataName.CoderInfo.StorageClass = 'Custom';
                    
                    %联电标定量的存储类需要根据数据类型设定
                        if strcmp(raw{i,nc_data_type},'AgsPstn_pct')||...
                           strcmp(raw{i,nc_data_type},'uint8')||...
                           strcmp(raw{i,nc_data_type},'boolean')||...
                           strncmp(raw{i,nc_data_type},'enum',4)||...
                           strncmp(raw{i,nc_data_type},'fixdt(0,8,',10)||...
                           strncmp(raw{i,nc_data_type},'fixdt(1,8,',10)
                           dataName.CoderInfo.CustomStorageClass = 'ConstVolatile_8';
                        elseif strcmp(raw{i,nc_data_type},'Milag_km')||...
                                strcmp(raw{i,nc_data_type},'Engy_Wh')||...
                                strcmp(raw{i,nc_data_type},'uint32')||...
                                strncmp(raw{i,nc_data_type},'fixdt(0,32,',11)||...
                                strncmp(raw{i,nc_data_type},'fixdt(1,32,',11)
                            dataName.CoderInfo.CustomStorageClass = 'ConstVolatile_32';
                        else
                            dataName.CoderInfo.CustomStorageClass = 'ConstVolatile_16';
                        end 
                        
                    dataName.CoderInfo.CustomAttributes.HeaderFile = '';
                    dataName.CoderInfo.CustomAttributes.DefinitionFile = '';
                    dataName.Description = num2str(raw{i,nc_description});
                    
                    datatypes_raw=char(raw{i,nc_data_type});
                    
                    if strncmp(datatypes_raw,'enm',3)
                       dataName.DataType = ['Enum:',datatypes_raw];
                    else
                       dataName.DataType = datatypes_raw;
                    end
                    
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end
                    
                    dataName.DocUnits = char(raw{i,nc_uints});

                    assignin('base',verName,dataName);
                end 
            end 
%% 观测量
        [~,~,raw] = xlsread(xlsName,'Signals');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    verName=raw{i,nc_var_name};
                    
                    dataName= evalin('base',['ai_',supplier,'.Signal']);
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName.InitialValue=raw{i,nc_initial_value};
                    end
                    
                    if strncmp(verName,'Ve',2)||strncmp(verName,'DFC',3)%Ve或Le开头的为应用层软件变量规则,不满足此要求的为底层软件定义的变量
                       dataName.CoderInfo.StorageClass = 'ExportedGlobal';
                    else
                       dataName.CoderInfo.StorageClass = 'Custom';
                       dataName.CoderInfo.CustomStorageClass = 'Signal_Volatile';
                    end
                    dataName.Description = num2str(raw{i,nc_description});
                    
                    datatypes_raw=char(raw{i,nc_data_type});
                    if strncmp(datatypes_raw,'enm',3)
                       dataName.DataType = ['Enum:',datatypes_raw];
                    else
                       dataName.DataType = datatypes_raw;
                    end
                    
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end
                    dataName.DocUnits = char(raw{i,nc_uints});

                    assignin('base',verName,dataName);
                end 
            end    
%% 常量
% 存储类为'Auto'
        [~,~,raw] = xlsread(xlsName,'Constants');
        nRaw = size(raw);
        for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    
                    verName=raw{i,nc_var_name};
                    
                    dataName= evalin('base',['ai_',supplier,'.Parameter']);
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.Value=raw{i,nc_initial_value};
                    else
                       dataName.Value=eval(raw{i,nc_initial_value});
                    end
                    dataName.CoderInfo.StorageClass = 'Auto';
                    
                    dataName.Description = num2str(raw{i,nc_description});
                    
                    datatypes_raw=char(raw{i,nc_data_type});
                    if strncmp(datatypes_raw,'enm',3)
                       dataName.DataType = ['Enum:',datatypes_raw];
                    else
                       dataName.DataType = datatypes_raw;
                    end
                    
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end
                    
                    dataName.DocUnits = char(raw{i,nc_uints});

                    assignin('base',verName,dataName);
                end
        end
%% IOS Inputs 和 Outputs
% 输入接口变量为parameter,同时增加观测量,观测量名为 [接口变量名+'_BSW']
% 输出接口变量为Signal
% 增加EE接口的支持, 'EE_XXXX'的变量识别为EE变量

% 只有IOS和DGM模块与底层软件有交互
 if contains(xlsName,'IOS')||contains(xlsName,'DGM')
    % 输入
    [~,~,raw] = xlsread(xlsName,'Inputs');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    clear dataName_signal;
                    fun_flg=false;%默认为全局变量接口
                    Param=[];%默认是无参数的
                    
                    verName=raw{i,nc_var_name};
                    verName_signal=[verName,'_BSW'];
                    % 接口可能为function,需要去除"()"
                    if contains(verName,'(')
                       Param_cell=regexp(verName,'\((.*)\)','tokens');
                       Param=Param_cell{1}{1};
                       Fun=regexprep(verName,'\(.*\)','');
                       verName=regexprep(verName,'\(|\)','');
                       verName_signal=regexprep(verName_signal,'\(|\)','');
                       fun_flg=true;
                    end

                    %输入接口变量为parameter
                    dataName= evalin('base',['ai_',supplier,'.Parameter']);
                    %如果是变量接口,存储类为ImportedExtern
                    %如果是函数接口,存储类为GetSet
                    %StorageClass
                    if fun_flg
                        dataName.CoderInfo.StorageClass = 'Custom';
                        if isempty(Param)
                            dataName.CoderInfo.CustomStorageClass = 'GetSet';
                        else
                            dataName.CoderInfo.CustomStorageClass = 'GetParam';
                        end
                        dataName.CoderInfo.CustomAttributes.GetFunction = Fun;
                        dataName.CoderInfo.CustomAttributes.SetFunction = Param;
                    else
                        dataName.CoderInfo.StorageClass = 'ImportedExtern';
                    end
                    %Description
                    dataName.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName.DocUnits = char(raw{i,nc_uints});
                    %Value
                    if isnumeric(raw{i,nc_initial_value})
                        dataName.Value=raw{i,nc_initial_value}; 
                    else
                        dataName.Value=str2num(raw{i,nc_initial_value});
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                        dataName.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                        dataName.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                        dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                        dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end

                    
                    %输入接口变量的观测量为signal
                    dataName_signal=evalin('base',['ai_',supplier,'.Signal']);
                    %StorageClass
                    dataName_signal.CoderInfo.StorageClass = 'ExportedGlobal';
                    %Description
                    dataName_signal.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName_signal.DocUnits = char(raw{i,nc_uints});
                    %Initial value
                    if isnumeric(raw{i,nc_initial_value})
                       dataName_signal.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName_signal.InitialValue=raw{i,nc_initial_value};
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                       dataName_signal.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                       dataName_signal.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                       dataName_signal.Min = raw{i,nc_min_value};
                    else
                        dataName_signal.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                       dataName_signal.Max = raw{i,nc_max_value};
                    else
                        dataName_signal.Max = eval(raw{i,nc_max_value});
                    end

                    assignin('base',verName,dataName);
                    assignin('base',verName_signal,dataName_signal);
                end 
            end 
    % 输出     
    [~,~,raw] = xlsread(xlsName,'Outputs');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    fun_flg=false;%默认为全局变量接口
                    Param=[];%默认是无参数的
                    
                    verName=raw{i,nc_var_name};
                    % 接口可能为function,需要去除"()"
                    if contains(verName,'(')
                       Param_cell=regexp(verName,'\((.*)\)','tokens');
                       Param=Param_cell{1}{1};
                       Fun=regexprep(verName,'\(.*\)','');
                       verName=regexprep(verName,'\(|\)','');
                       verName_signal=regexprep(verName_signal,'\(|\)','');
                       fun_flg=true;
                    end
                    
                    dataName= evalin('base',['ai_',supplier,'.Signal']);
                    %如果为'EE_XXXX',则需要使用'EE'
                    %StorageClass
                    if fun_flg
                        dataName.CoderInfo.StorageClass = 'Custom';
                        if isempty(Param)
                            dataName.CoderInfo.CustomStorageClass = 'GetSet';
                        else
                           dataName.CoderInfo.CustomStorageClass = 'SetParam';
                        end
                        dataName.CoderInfo.CustomAttributes.GetFunction = Param;
                        dataName.CoderInfo.CustomAttributes.SetFunction = Fun;
                    elseif strncmp(verName,'EE_',3)
                        dataName.CoderInfo.StorageClass = 'Custom';
                        dataName.CoderInfo.CustomStorageClass = 'EE';
%                     elseif strncmp(verName,'DTC_',4)
%                         DTC_num=DTC_num+1;
%                         dataName.CoderInfo.StorageClass = 'Custom';
%                         dataName.CoderInfo.CustomStorageClass = 'SetParamDtc';
%                         dataName.CoderInfo.CustomAttributes.GetFunction = ['DemConf_DemEventParameter_DFC_VeDGM_DTC_',num2str(DTC_num)];
%                         dataName.CoderInfo.CustomAttributes.SetFunction = 'Dem_SetEventStatus';
                    elseif strncmp(verName,'COMR_DFC_',9)%Ve或Le开头的为应用层软件变量规则,不满足此要求的为底层软件定义的变量
                       dataName.CoderInfo.StorageClass = 'ExportedGlobal';
                    else
                        dataName.CoderInfo.StorageClass = 'ImportedExtern';
                    end
                    %Description
                    dataName.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName.DocUnits = char(raw{i,nc_uints});
                    %InitialValue
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName.InitialValue=raw{i,nc_initial_value};
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                       dataName.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                       dataName.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end

                    assignin('base',verName,dataName);
                end 
            end   
 
 
   % OSP    
    [~,~,raw] = xlsread(xlsName,'ISP');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    fun_flg=false;%默认为全局变量接口
                    Param=[];%默认是无参数的
                    
                    verName=raw{i,nc_var_name};
                    % 接口可能为function,需要去除"()"
                    if contains(verName,'(')
                       Param_cell=regexp(verName,'\((.*)\)','tokens');
                       Param=Param_cell{1}{1};
                       Fun=regexprep(verName,'\(.*\)','');
                       verName=regexprep(verName,'\(|\)','');
                       verName_signal=regexprep(verName_signal,'\(|\)','');
                       fun_flg=true;
                    end
                    
                    dataName= evalin('base',['ai_',supplier,'.Signal']);
                    %如果为'EE_XXXX',则需要使用'EE'
                    %StorageClass
                    if fun_flg
                        dataName.CoderInfo.StorageClass = 'Custom';
                        if isempty(Param)
                            dataName.CoderInfo.CustomStorageClass = 'GetSet';
                        else
                           dataName.CoderInfo.CustomStorageClass = 'SetParam';
                        end
                        dataName.CoderInfo.CustomAttributes.GetFunction = Param;
                        dataName.CoderInfo.CustomAttributes.SetFunction = Fun;
                    elseif strncmp(verName,'EE_',3)
                        dataName.CoderInfo.StorageClass = 'Custom';
                        dataName.CoderInfo.CustomStorageClass = 'EE';
%                     elseif strncmp(verName,'DTC_',4)
%                         DTC_num=DTC_num+1;
%                         dataName.CoderInfo.StorageClass = 'Custom';
%                         dataName.CoderInfo.CustomStorageClass = 'SetParamDtc';
%                         dataName.CoderInfo.CustomAttributes.GetFunction = ['DemConf_DemEventParameter_DFC_VeDGM_DTC_',num2str(DTC_num)];
%                         dataName.CoderInfo.CustomAttributes.SetFunction = 'Dem_SetEventStatus';
                    elseif strncmp(verName,'hld_Private',11)
                        dataName.CoderInfo.StorageClass = 'ImportedExtern';
                    else
                        dataName.CoderInfo.StorageClass = 'Custom';
                        dataName.CoderInfo.CustomStorageClass = 'Signal_Volatile';
                    end
                    %Description
                    dataName.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName.DocUnits = char(raw{i,nc_uints});
                    %InitialValue
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName.InitialValue=raw{i,nc_initial_value};
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                       dataName.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                       dataName.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end

                    assignin('base',verName,dataName);
                end 
            end   
 end

%% %%%%%%%%%%%%%%%%%%%%%%% HASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif strcmp(supplier,'HASE')
%% 标定量
        [~,~,raw] = xlsread(xlsName,'Calibrations');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    verName=raw{i,nc_var_name};
                    
                    dataName= evalin('base',['ai_',supplier,'.Parameter']);
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.Value=raw{i,nc_initial_value};
                    else
                       dataName.Value=eval(raw{i,nc_initial_value});
                    end
                    dataName.CoderInfo.StorageClass = 'Custom';
                    dataName.CoderInfo.CustomStorageClass = 'ConstVolatile';
                    dataName.CoderInfo.CustomAttributes.HeaderFile = '';
                    dataName.CoderInfo.CustomAttributes.DefinitionFile = '';
                    dataName.Description = num2str(raw{i,nc_description});
                    
                    datatypes_raw=char(raw{i,nc_data_type});
                    
                    if strncmp(datatypes_raw,'enm',3)
                       dataName.DataType = ['Enum:',datatypes_raw];
                    else
                       dataName.DataType = datatypes_raw;
                    end
                    
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end
                    
                    dataName.DocUnits = char(raw{i,nc_uints});

                    assignin('base',verName,dataName);
                end 
            end 
%% 观测量
        [~,~,raw] = xlsread(xlsName,'Signals');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    verName=raw{i,nc_var_name};
                    
                    dataName= evalin('base',['ai_',supplier,'.Signal']);
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName.InitialValue=raw{i,nc_initial_value};
                    end
                    
                    if strncmp(verName,'Ve',2)||strncmp(verName,'Le',2)%Ve或Le开头的为应用层软件变量规则,不满足此要求的为底层软件定义的变量
                       dataName.CoderInfo.StorageClass = 'ExportedGlobal';
                    else
                       dataName.CoderInfo.StorageClass = 'ImportedExtern';
                    end
                    dataName.Description = num2str(raw{i,nc_description});
                    
                    datatypes_raw=char(raw{i,nc_data_type});
                    if strncmp(datatypes_raw,'enm',3)
                       dataName.DataType = ['Enum:',datatypes_raw];
                    else
                       dataName.DataType = datatypes_raw;
                    end
                    
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end
                    dataName.DocUnits = char(raw{i,nc_uints});

                    assignin('base',verName,dataName);
                end 
            end    
%% 常量
% 存储类为'Auto'
        [~,~,raw] = xlsread(xlsName,'Constants');
        nRaw = size(raw);
        for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    
                    verName=raw{i,nc_var_name};
                    
                    dataName= evalin('base',['ai_',supplier,'.Parameter']);
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.Value=raw{i,nc_initial_value};
                    else
                       dataName.Value=eval(raw{i,nc_initial_value});
                    end
                    dataName.CoderInfo.StorageClass = 'Auto';
                    
                    dataName.Description = num2str(raw{i,nc_description});
                    
                    datatypes_raw=char(raw{i,nc_data_type});
                    if strncmp(datatypes_raw,'enm',3)
                       dataName.DataType = ['Enum:',datatypes_raw];
                    else
                       dataName.DataType = datatypes_raw;
                    end
                    
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end
                    
                    dataName.DocUnits = char(raw{i,nc_uints});

                    assignin('base',verName,dataName);
                end
        end
%% IOS Inputs 和 Outputs
% 输入接口变量为parameter,同时增加观测量,观测量名为 [接口变量名+'_BSW']
% 输出接口变量为Signal
% 增加EE接口的支持, 'EE_XXXX'的变量识别为EE变量

% 只有IOS和DGM模块与底层软件有交互
 if contains(xlsName,'IOS')||contains(xlsName,'DGM')
    % 输入
    [~,~,raw] = xlsread(xlsName,'Inputs');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    clear dataName_signal;
                    fun_flg=false;%默认为全局变量接口
                    Param=[];%默认是无参数的
                    
                    verName=raw{i,nc_var_name};
                    verName_signal=[verName,'_BSW'];
                    % 接口可能为function,需要去除"()"
                    if contains(verName,'(')
                       Param_cell=regexp(verName,'\((.*)\)','tokens');
                       Param=Param_cell{1}{1};
                       Fun=regexprep(verName,'\(.*\)','');
                       verName=regexprep(verName,'\(|\)','');
                       verName_signal=regexprep(verName_signal,'\(|\)','');
                       fun_flg=true;
                    end

                    %输入接口变量为parameter
                    dataName= evalin('base',['ai_',supplier,'.Parameter']);
                    %如果是变量接口,存储类为ImportedExtern
                    %如果是函数接口,存储类为GetSet
                    %StorageClass
                    if fun_flg
                        dataName.CoderInfo.StorageClass = 'Custom';
                        if isempty(Param)
                            dataName.CoderInfo.CustomStorageClass = 'GetSet';
                        else
                            dataName.CoderInfo.CustomStorageClass = 'GetParam';
                        end
                        dataName.CoderInfo.CustomAttributes.GetFunction = Fun;
                        dataName.CoderInfo.CustomAttributes.SetFunction = Param;
                    else
                        dataName.CoderInfo.StorageClass = 'ImportedExtern';
                    end
                    %Description
                    dataName.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName.DocUnits = char(raw{i,nc_uints});
                    %Value
                    if isnumeric(raw{i,nc_initial_value})
                        dataName.Value=raw{i,nc_initial_value}; 
                    else
                        dataName.Value=str2num(raw{i,nc_initial_value});
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                        dataName.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                        dataName.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                        dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                        dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end

                    
                    %输入接口变量的观测量为signal
                    dataName_signal=evalin('base',['ai_',supplier,'.Signal']);
                    %StorageClass
                    dataName_signal.CoderInfo.StorageClass = 'ExportedGlobal';
                    %Description
                    dataName_signal.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName_signal.DocUnits = char(raw{i,nc_uints});
                    %Initial value
                    if isnumeric(raw{i,nc_initial_value})
                       dataName_signal.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName_signal.InitialValue=raw{i,nc_initial_value};
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                       dataName_signal.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                       dataName_signal.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                       dataName_signal.Min = raw{i,nc_min_value};
                    else
                        dataName_signal.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                       dataName_signal.Max = raw{i,nc_max_value};
                    else
                        dataName_signal.Max = eval(raw{i,nc_max_value});
                    end

                    assignin('base',verName,dataName);
                    assignin('base',verName_signal,dataName_signal);
                end 
            end 
    % 输出        
    [~,~,raw] = xlsread(xlsName,'Outputs');
        nRaw = size(raw);
            for i = 2 : nRaw
                if ~isnan(raw{i,nc_var_name})
                    clear dataName;
                    fun_flg=false;%默认为全局变量接口
                    Param=[];%默认是无参数的
                    
                    verName=raw{i,nc_var_name};
                    % 接口可能为function,需要去除"()"
                    if contains(verName,'(')
                       Param_cell=regexp(verName,'\((.*)\)','tokens');
                       Param=Param_cell{1}{1};
                       Fun=regexprep(verName,'\(.*\)','');
                       verName=regexprep(verName,'\(|\)','');
                       verName_signal=regexprep(verName_signal,'\(|\)','');
                       fun_flg=true;
                    end
                    
                    dataName= evalin('base',['ai_',supplier,'.Signal']);
                    %如果为'EE_XXXX',则需要使用'EE'
                    %StorageClass
                    if fun_flg
                        dataName.CoderInfo.StorageClass = 'Custom';
                        if isempty(Param)
                            dataName.CoderInfo.CustomStorageClass = 'GetSet';
                        else
                           dataName.CoderInfo.CustomStorageClass = 'SetParam';
                        end
                        dataName.CoderInfo.CustomAttributes.GetFunction = Param;
                        dataName.CoderInfo.CustomAttributes.SetFunction = Fun;
                    elseif strncmp(verName,'EE_',3)
                        dataName.CoderInfo.StorageClass = 'Custom';
                        dataName.CoderInfo.CustomStorageClass = 'EE';
                    else
                        dataName.CoderInfo.StorageClass = 'ImportedExtern';
                    end
                    %Description
                    dataName.Description = num2str(raw{i,nc_description});
                    %DocUnits
                    dataName.DocUnits = char(raw{i,nc_uints});
                    %InitialValue
                    if isnumeric(raw{i,nc_initial_value})
                       dataName.InitialValue=num2str(raw{i,nc_initial_value});
                    else
                       dataName.InitialValue=raw{i,nc_initial_value};
                    end
                    %DataType
                    if strncmp(char(raw{i,nc_data_type}),'enm',3)
                       dataName.DataType = ['Enum:',char(raw{i,nc_data_type})];
                    else
                       dataName.DataType = char(raw{i,nc_data_type});
                    end
                    %Min
                    if isnumeric(raw{i,nc_min_value})
                       dataName.Min = raw{i,nc_min_value};
                    else
                        dataName.Min = eval(raw{i,nc_min_value});
                    end
                    %Max
                    if isnumeric(raw{i,nc_max_value})
                       dataName.Max = raw{i,nc_max_value};
                    else
                        dataName.Max = eval(raw{i,nc_max_value});
                    end

                    assignin('base',verName,dataName);
                end 
            end  
 end
 end
%%%%%%% EOF %%%%%%%%%%

