Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refprop Call #12

Open
JungHulk opened this issue Apr 1, 2024 · 1 comment
Open

Refprop Call #12

JungHulk opened this issue Apr 1, 2024 · 1 comment

Comments

@JungHulk
Copy link
Owner

JungHulk commented Apr 1, 2024

`# -*- coding: utf-8 -*-
"""
Created on Fri Mar 29 13:24:04 2024

@author: 7335898
"""

import os
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
import numpy as np

RP = REFPROPFunctionLibrary(os.environ['RPPREFIX'])
RP.SETPATHdll(os.environ['RPPREFIX'])

SI = RP.GETENUMdll(0,"SI WITH C").iEnum

Prop_list = "P;T;D;H;M;CP;Qmass;VIS;TCX;PRANDTL;KV;Heatvapz_P;Phase;"     # VISCOSITY 는 100만 나누어야 함.
Prop_index = np.array(Prop_list.replace(';',' ').split())

Comp_name =          "Nitrogen;Methane;Ethane;Propane;Butane;Isobutane;Pentane;Isopentane;Oxygen;CO2;Water;"  
Comp_name_index =   np.array(Comp_name.replace(';',' ').split())
Comp_init = np.array([1.0,         0.0,    0,    0,       0,        0,     0,        0,       0,    0,   0]) # pure N2

P = RP.REFPROPdll(Comp_name, "PT" , Prop_list, SI, 1, 0, 0.2, 30, Comp_init).Output[0:len(Prop_index)]
print(P)
`
@JungHulk
Copy link
Owner Author

JungHulk commented Apr 1, 2024

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

# import os
# import sys
# from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary


# BASE_DIR = os.getcwd() ## 현재 스크립트 파일이 저장되 있는 폴더 경로 지정
# Path = BASE_DIR + "\\Refprop" ## 스크립트가 있는 폴더 하위 폴더의 "Refprop" 폴더로 경로 지정

# RP = REFPROPFunctionLibrary(Path) ## REFPROP 라이브러리를 로딩해서 RP 라는 변수에 저장
# RP.SETPATHdll(Path)  ## RP 변수에 저장된 클래스 인스턴스의 SETPATHdll 매서드 호출. SETPATHdll 은 dll 파일의 경로 설정

# SI = RP.GETENUMdll(0, "SI WITH C").iEnum # SI, C 단위계 정의
# # print(get_units("SI with C"))


# Comp_name = "Methane"
# # Prop = "P; T; D; H; M; CP; Phase; Qmass; VIS; TCX; PRANDTL; KV; Heatvapz_P"
# Prop = "P;T;"
# Comp_value = [1]

# Input_prop = "PT" # known value Pressure, Temperature
# Input1 = 0.11 # Input_prop 의 첫번째 항
# Input2 = 30 # Input_prop 의 두번쨰 항

# iMass = 1 # Molar or mass flag 0 : all inputs and outputs are given on a mole basis, 1 : mass basis
# iFlag = 1

# n2 = RP.REFPROPdll(Comp_name, Input_prop, Prop, SI, iMass, iFlag, Input1, Input2, Comp_value).Output
# #[0:Prop.count(';')]
# print(n2)

import os
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
import numpy as np

# BASE_DIR = os.getcwd() ## 현재 스크립트 파일이 저장되 있는 폴더 경로 지정
# Path = BASE_DIR + "\\Refprop" ## 스크립트가 있는 폴더 하위 폴더의 "Refprop" 폴더로 경로 지정

# RP = REFPROPFunctionLibrary(Path) ## REFPROP 라이브러리를 로딩해서 RP 라는 변수에 저장
# RP.SETPATHdll(Path)  ## RP 변수에 저장된 클래스 인스턴스의 SETPATHdll 매서드 호출. SETPATHdll 은 dll 파일의 경로 설정

RP = REFPROPFunctionLibrary(os.environ['RPPREFIX'])
RP.SETPATHdll(os.environ['RPPREFIX'])

SI = RP.GETENUMdll(0,"SI WITH C").iEnum

Prop_list = "P;T;D;H;M;CP;Qmass;VIS;TCX;PRANDTL;KV;Heatvapz_P;Phase;"     # VISCOSITY 는 100만 나누어야 함.
Prop_index = np.array(Prop_list.replace(';',' ').split())

Comp_name =          "Nitrogen;Methane;Ethane;Propane;Butane;Isobutane;Pentane;Isopentane;Oxygen;CO2;Water;"  
Comp_name_index =   np.array(Comp_name.replace(';',' ').split())
Comp_init = np.array([1.0,         0.0,    0,    0,       0,        0,     0,        0,       0,    0,   0]) # pure N2

P = RP.REFPROPdll(Comp_name, "PT" , Prop_list, SI, 1, 0, 0.2, 30, Comp_init).Output[0:len(Prop_index)]
print(P)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant