Perfected the WASPCN for Matlab again

Source: Internet
Author: User

A few times ago a number of users asked how to use WASPCN (water and Steam properties calculation software) in 64-bit MATLAB, has not been able to give a solution.

A recent project has also needed to solve the problem by using WASPCN (water and steam nature calculation software) in 64-bit MATLAB.


The whole process is really not easy.

Need to first modify the original WASPCN.dll 64-bit version of the DLL, because the original DLL was developed by Delphi, 64-bit version of the modification process encountered some technical problems have not been solved, and finally have to give up, use VC to re-DLL.

Fortunately before there is a foundation, the first 32-bit DLL programming language from Delphi to VC, debugging by obtaining the Waspcn32.dll, and the software testing. And then to the 64-bit version of the, compiled to obtain the Waspcn64.dll.

Finally, complete the update of the Mex extension library, and write the 32-bit version of the waspcnmex32.mexw32 and the 64-bit version of waspcnmex64.mexw64, respectively.

There are now two ways to load the WASPCN Compute library in MATLAB.


Method One: Load the Mex expansion library mode.
Method Two: Load the normal DLL library mode.

First, the use of "water and Steam Properties Calculation" (WASPCN) method in MATLAB (using MEX mode). --------------------------------------(32-bit MATLAB)----------------------------(1) Ensure that the Waspcn32.dll is in the operating system's search path (for example: D : \program Files\matlab\r2011b\runtime\win32), or MATLAB in the searchable path. (Can be viewed through the path command.) )。 (2) Copy the Mex extension Library WASPCNMEX32.dll file to the UserPath path of MATLAB (for example: C:\Users\WASPCN\Documents\MATLAB). (Can be viewed through the UserPath command.) In order to be compatible with high-version matlab (such as Matlab R2008), you need to change the WASPCNMEX32.dll extension from DLL to MEXW32 (that is, waspcnmex32.mexw32). (3) in the Command window of MATLAB Enter the following form of command to calculate (note that WASPCNMEX32 must be uppercase, other functions can be mixed in case). %a. Input 4 parameters, output 2 parameters [N,r] = WASPCNMEX32 (' pt2n ', 16.67,535.0,0.00001)    %b. Input 3 parameters, output 2 parameters [H,r] = WASPCNMEX32 (' pt2h ', 16.67,535.0)     %c. Input 2 parameter, output 2 parameter [t,r] = WASPCNMEX32 (' p2t ', 10.0)%d. Input 3 parameter, Output 1 parameter H     = Waspcnmex (' pt2h ', 16.67,535.0)%e. Input 3 parameters, Output 1 parameters T     = WASPCNMEX32 (' p2t ', 10.0)%f. Input 3 parameters, output 7 parameters [P,t,h,s,v,x,r] = WASPCNMEX32 (' PT ', 16.67,535.0)


--------------------------------------(64-bit MATLAB)----------------------------(1) Ensure that the Waspcn64.dll is in the operating system's search path (for example: D : \program Files\matlab\r2011b\runtime\win64), or MATLAB in the searchable path. (Can be viewed through the path command.) )。 (2) Copy the Mex extension Library WASPCNMEX64.dll file to the UserPath path of MATLAB (for example: C:\Users\WASPCN\Documents\MATLAB). (Can be viewed through the UserPath command.) In order to be compatible with high-version matlab (such as Matlab R2008), you need to change the WASPCNMEX64.dll extension from DLL to MEXW64 (that is, waspcnmex64.mexw64). (3) in the Command window of MATLAB Enter the following form of command to calculate (note that WASPCNMEX64 must be uppercase, other functions can be mixed in case).      %a. Input 4 parameters, output 2 parameters [N,r] = WASPCNMEX64 (' pt2n ', 16.67,535.0,0.00001)%b. Input 3 parameters, output 2 parameters [H,r] = WASPCNMEX64 (' pt2h ', 16.67,535.0) %c. Input 2 parameter, output 2 parameter [t,r] = WASPCNMEX64 (' p2t ', 10.0)%d. Enter 3 parameters, Output 1 parameter H = WASPCNMEX64 (' pt2h ', 16.67,535.0)%e. Input 3 parameter, output 1 parameter T = WASPCNMEX64 (' p2t ', 10.0)%f. Input 3 parameter, output 7 parameter [p,t,h,s,v,x,r] = WASPCNMEX64 (' PT ', 16.67,535.0)

Second, the use of the "water and Steam Property calculation" (WASPCN) method in MATLAB (using LoadLibrary mode).

---------------------------32-bit MATLAB----------------

(1) Ensure that the Waspcn32.dll is in the system search path of the operating system (for example: D:\Program Files (x86) \matlab\r2014a\runtime\win32) or in the searchable path of MATLAB. (Can be viewed through the path command.) ) (2) Copy the WASPCN32.h file to the UserPath path of MATLAB (for example: C:\Users\WASPCN\Documents\MATLAB). (Can be viewed through the UserPath command.) ) or create a custom directory (for example: D:\Program Files (x86) \MATLAB\R2014A\TOOLBOX\WASPCN) and add to the system path% to add the created directory to the system path Addpath (The Genpath (' D : \program Files (x86) \MATLAB\R2014A\TOOLBOX\WASPCN '));  % save path Savepath; (3) in the Command window of MATLAB, enter the following form of command to invoke the function in WASPCN. % Load function library (LoadLibrary DLL filename h file name) LoadLibrary WASPCN32 WASPCN32.h; % Call function calllib (' DLL filename ', ' t_p97 ', 16.0) t=calllib (' WASPCN32 ', ' t_p97 ', 16.0)% p=calllib (' WASPCN32 ', ' p_t97 ', 300.0)% h= Calllib (' WASPCN32 ', ' h_pt97 ', 16.0,535.0)% unload function Unloadlibrary WASPCN32---------------------------64-bit MATLAB------- ---------


WIN7 64-bit system installs 64-bit MATLAB (1) To ensure that Waspcn64.dll is in the system search path of the operating system (for example: D:\Program Files\matlab\r2011b\runtime\win64) Or in a searchable path to MATLAB. (Can be viewed through the path command.) ) (2) Copy the WASPCN64.h file to the UserPath path of MATLAB (for example: C:\Users\WASPCN\Documents\MATLAB). (Can be viewed through the UserPath command.) or create a custom directory (for example: D:\Program FILES\MATLAB\R2011B\TOOLBOX\WASPCN) and add to the system path% to add the created directory to the system path Addpath (Genpath (' D:\ Program FILES\MATLAB\R2011B\TOOLBOX\WASPCN '));  % save path Savepath; (3) in the Command window of MATLAB, enter the following form of command to invoke the function in WASPCN. % Load function library (LoadLibrary DLL filename h file name) LoadLibrary WASPCN64 WASPCN64.h; % Call function calllib (' DLL filename ', ' t_p97 ', 16.0) t=calllib (' WASPCN64 ', ' t_p97 ', 16.0)% p=calllib (' WASPCN64 ', ' p_t97 ', 300.0)% h= Calllib (' WASPCN64 ', ' h_pt97 ', 16.0,535.0)% unload function Unloadlibrary WASPCN64

Of course, these two waspcn for MATLAB interfaces can be downloaded from scyangyu.ys168.com.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.