Problem with Matlab 2019b to access REFPROP10 trought Python 3.7.
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am using Matlab 2019b to access REFPROP10 trought Python 3.7 and I get the following message:
"Unable to resolve the name py.ctREFPROP.ctREFPROP.REFPROPFunctionLibrary".
The script I am using is the following:
close all
clear all
clc
%INPUT section start=========================================
gas='ARGON';
vapor='WATER';
yv=0.001;
T1=300; %K
p1=10e5; %Pa
p2=5.5e5; %Pa
%INPUT section end===========================================
yg=1-yv;
y=[yg,yv];
mix=sprintf("%s;%s",gas,vapor);
RP = py.ctREFPROP.ctREFPROP.REFPROPFunctionLibrary('C:\Program Files (x86)\REFPROP');
%r = RP.REFPROPdll(mix, "PTV","S",RP.MOLAR_BASE_SI,int8(0),int8(0),p1, T1,y);
UNITS = RP.GETENUMdll(int8(0),"MOLAR BASE SI").iEnum;
r = RP.REFPROPdll(mix, "PT","S",UNITS,int8(0),int8(0.),p1, T1,y);
o = double(r.Output);
s1=o(1); %(J/kg)/K
s2=s1;
r = RP.REFPROPdll(mix, "PS","T",UNITS,int8(0),int8(0),p2, s2,y);
o = double(r.Output);
T2=o(1); %K
From the NIST assistance, I have been answerd that the problem is in Matlab, since the following script, using python directly, works:
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
gas='ARGON'
vapor='WATER'
yv=0.001
T1=300 #K
p1=10e5 #Pa
p2=5.5e5 #Pa
yg=1-yv
y=[yg,yv]
mix = gas+';'+vapor
root = 'D:/Program Files (x86)/REFPROP'
RP = REFPROPFunctionLibrary(root)
RP.SETPATHdll(root)
r = RP.REFPROPdll(mix, "PT","S",RP.MOLAR_BASE_SI,0,0,p1, T1, y);
print(r.Output[0])
s2=r.Output[0];
r = RP.REFPROPdll(mix, "PS","T",RP.MOLAR_BASE_SI,0,0,p2, s2, y);
print(r.Output[0])
Is there someone that can help me with this issue?
Thanks
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!