We will be performing a major infrastructure and web site ugprades on Friday, September 27th 8:00 am - 5:00 pm MST (UTC -7).

The website will be down during that time.

Support with MATLAB modification

  • Alfred
  • Topic Author
More
30 Jul 2020 06:51 #8500 by Alfred
Support with MATLAB modification was created by Alfred
I am trying to edit the SAM generated MATLAB code. Such that I create script (SIF) of mine separately with inputs I want to change on the Sam MATLAB function file.
Aimed to enable making calculations for some properties outside SAM and return the values to the SAM code.
I have created a matfile.Obj which reads the .mat code generated from the script file (SIF).
However, when I make the necessary changes to the SAM code it doesn't seem to give the same results prior to the changes.
To clarify, examples of some changes:
In SIF.m file 
sys_cap = % Nameplate capacity 
RFA= 513.6 %Reflective aperture area m^2
Dvar = 7   %Design turbine gross output MW
DNI_des = 950 % Design point solar irradiation  W/m^2
are all stored to a  SIF.mat file and a matfileObj is created  ==> matfileObj = matfile ('SIF.mat'); to read and obtain the variables as needed. using
b= matfileObj.sys_cap;
ssccall('data_set_number', data, 'system_capacity', 'b');
j= matfileObj.I_bn_des;
ssccall('data_set_number', data, 'I_bn_des', 'j');
A_aperture =[ matfileObj.RFA ; matfileObj.RFA ]; 
ssccall( 'data_set_matrix', data, 'A_aperture', A_aperture );
etc
While the command for matfileObj seem to work correctly. The SAM function code appears to give wrong results.
N.B: Changing the number directly in the SAM code appears to work fine. Also I tried changing the ssccall command for number to array (i.e. 'data_set_number' to either  'data_set_array' or  'data_set_matrix') but as expected it did not work due to the code constraints

tcslinear_fresnel errors:
precheck input: variable 'demand_var' (<array>) of wrong type, <number> required.

tcslinear_fresnel errors:
precheck input: variable 'demand_var' (<matrix>) of wrong type, <number> required.

I have also added the edited code.

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum