xxsimProcessModel - Processes the active 20-sim model. Syntax: [result, info, warning, errors] = xxsimProcessModel() result = xxsimProcessModel() Inputs: takes no arguments. Outputs: result = returns true if the model processes with out error. info = returns a struct with information on processing model e.g constraints, states, variables, algebraic loop variables. warning = warning(s) during processing model, if any. errors = error(s) during processing model, if any. Examples: [result, info, warning, errors] = xxsimProcessModel() Process model and get the result boolean plus all messages (errors, warnings, and info). result = xxsimProcessModel() Process model and only get the result boolean. See also: xxsimGetActiveModel, xxsimRun Author: Controllab Products B.V. email: info@controllab.nl Website: http://www.controllab.nl November 2015
0001 function [result, info, warnings, errors] = xxsimProcessModel() 0002 % xxsimProcessModel - Processes the active 20-sim model. 0003 % 0004 % Syntax: 0005 % [result, info, warning, errors] = xxsimProcessModel() 0006 % result = xxsimProcessModel() 0007 % 0008 % Inputs: 0009 % takes no arguments. 0010 % 0011 % Outputs: 0012 % result = returns true if the model processes with out error. 0013 % info = returns a struct with information on processing model 0014 % e.g constraints, states, variables, algebraic loop variables. 0015 % warning = warning(s) during processing model, if any. 0016 % errors = error(s) during processing model, if any. 0017 % 0018 % Examples: 0019 % [result, info, warning, errors] = xxsimProcessModel() 0020 % Process model and get the result boolean plus all messages (errors, warnings, and info). 0021 % result = xxsimProcessModel() 0022 % Process model and only get the result boolean. 0023 % 0024 % See also: xxsimGetActiveModel, xxsimRun 0025 % 0026 % Author: Controllab Products B.V. 0027 % email: info@controllab.nl 0028 % Website: http://www.controllab.nl 0029 % November 2015 0030 0031 %------------- BEGIN CODE -------------- 0032 0033 if(nargin>0) 0034 error('Too many input arguments: xxsimProcessModel does not expect any input arguments.'); 0035 end; 0036 0037 global xxsim; 0038 xxsimVerbose = 0; 0039 if exist('xxsim') 0040 xxsimVerbose = xxsim.verbose; 0041 end 0042 0043 if( xxsimVerbose ) 0044 fprintf('Processing model : '); 0045 end 0046 0047 % 0048 % make the call to process the model 0049 % 0050 processResult = xrlinvoke('xxsim.model.process'); 0051 0052 % return results in the info structure 0053 if isfield(processResult, 'results') 0054 info = processResult.results; 0055 else 0056 info = []; 0057 end 0058 0059 %optionally return the outputs as the third variable 0060 if isfield(processResult, 'warnings') 0061 warnings = processResult.warnings; 0062 else 0063 warnings = []; 0064 end 0065 0066 if isfield(processResult, 'errors') 0067 errors = processResult.errors; 0068 else 0069 errors = []; 0070 end 0071 0072 if length(errors) == 0 0073 result = 1; 0074 else 0075 result = 0; 0076 end 0077 0078 if( xxsimVerbose ) 0079 if( result ) 0080 fprintf('Success\n'); 0081 else 0082 fprintf('Failure\n'); 0083 end 0084 0085 % print the errors and warnings 0086 for i = 1:length(processResult.errors) 0087 fprintf('\t%s\n',processResult.errors{i}); 0088 end 0089 for i = 1:length(processResult.warnings) 0090 fprintf('\t%s\n', processResult.warnings{i}); 0091 end 0092 for i=1:length(processResult.results) 0093 fprintf('\t%s : %s\n', processResult.results(i).key, processResult.results(i).value); 0094 end 0095 0096 fprintf('\tProcessing: %d error(s), %d warning(s)\n', length(processResult.errors), length(processResult.warnings)); 0097 end 0098 0099 end 0100 %------------- END OF CODE --------------