Make functions unreadable to end-user
Show older comments
I have a complete program to perform phase equilibrium calculations at fixed temperature and pressure using an equation of state (EOS). The structure of the code is as follows.
TPflash_Main.m is the main file that calls the following:
1. "INPUTS.m" is a script that gathers all possible parameters from an EXCEL file and creates DATA.mat
2. "EOSparameters.m" is a function that gathers only relevant variables from DATA.mat (based on inputs to the function)
- [normalizedComposition, EOSprops] = EOSparameters(Components, Composition, EOS)
3. "TPflash.m" is a function that computes equilibrium properties and calls the equation of state that corresponds to the input "EoS".
- [eqProps] = TPflash(T,P,normalizedComposition,EOSprops,EOS)
I want the code to be packaged in such a way that the end-user cannot see the internals of the code. I have made INPUTS.m into an executable, but this isn't really what I want because I want the user to be able to pass inputs to the function to be able to change the source EXCEL file.
Additionally, there is a function file that is called by TPflash.m that I want the end-user to be able to replace with their own. If you have familiarity with flash calculations, then this is the file that outputs compressibility (Z) and fugacity (PHI) depending on the equation of state. I have coded the cubic equations of state and it is called by TPflash.m by:
- [Z, PHI] = cubicEOS(T,P,Compositions,EOSprops)
I want the user to be able to replace my "cubicEOS.m" function with one of their own where I require that they output the same properties [Z,PHI] as "cubicEOS.m"
I'm a long-time user of MATLAB, so I have checked all the usual places to get help on this issue. I know the answer will be obvious, but I'm tired of looking. Thank you for any help!
Accepted Answer
More Answers (0)
Categories
Find more on Just for fun in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!