Using .mexw64 in a Matlab function
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ana Fernandez Guillamon
el 13 de Nov. de 2015
Respondida: Shruti Sapre
el 17 de Nov. de 2015
Hi,
I'm trying to simulate a Rankine Cycle in Matlab. To calculate the water properties, I'm using the coolprop package http://www.coolprop.org/coolprop/wrappers/MATLAB/index.html#matlab.
I wrote a script (see below) and it works perfectly. Now, I want to rewrite it into a Matlab function in orden to simulate the cycle with the Simulink block MATLAB function, but it doesn't work: "Only MATLAB files are supported for code generation. Unsupported file extension 'mexw64' for C:\....".
What can I do?
Here's the script I want to rewrite into a function:
clear all
clc
close all
%COOLPROP
addpath('C:\Program Files\MATLAB\R2015b')
% 1:
P1 = 8e6
Q1 = 1
H1 = CoolProp.PropsSI('H','P',P1,'Q',Q1,'Water')
S1 = CoolProp.PropsSI('S','P',P1,'Q',Q1,'Water')
T1 = CoolProp.PropsSI('T','P',P1,'Q',Q1,'Water')
% 2:
display('Propiedades del agua a la entrada del condensador')
S2 = S1
P2 = 0.008e6
T2 = CoolProp.PropsSI('T','P',P2,'S',S2,'Water')
H2 = CoolProp.PropsSI('H','P',P2,'S',S2,'Water')
% 3:
P3 = P2
Q3 = 0
H3 = CoolProp.PropsSI('H','P',P3,'Q',Q3,'Water')
S3 = CoolProp.PropsSI('S','P',P3,'Q',Q3,'Water')
T3 = CoolProp.PropsSI('T','P',P3,'Q',Q3,'Water')
% 4:
S4 = S3
P4 = P1
H4 = CoolProp.PropsSI('H','P',P4,'S',S4,'Water')
T4 = CoolProp.PropsSI('T','P',P4,'S',S4,'Water')
% MORE
Wt_m = H1 - H2;
Wp_m = H4 - H3;
Qin = H1 - H4;
Wc = 100e6*3600;
nu = 100 * (Wc/Qin)
0 comentarios
Respuestas (1)
Shruti Sapre
el 17 de Nov. de 2015
Hi Ana,
The below link may be helpful to resolve the issue. The functions may need to be declared using coder.extrinsic since the coolprop package seems to use mex files:
Hope this helps!
-Shruti
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Compiler en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!