-
Notifications
You must be signed in to change notification settings - Fork 90
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
Specifing fluid with custom engine and non-standard fluid specification #597
Comments
Hi @LoGaL93, in principle you should be able to just handle that mixture thing inside your custom
From the tespy point of view your fluid will be a pure fluid, which is fine if
Does that work for you? Best Francesco |
Ok I see, so it is possible to provide as input an instance of the custom wrapper class, rather than the class itself. From the custom engine tutorial, it seemed you imported the class and gave that as input without creating a new object. Well, for the time being it is fine.However, is there a way to give custom mixing functions? (where one would create a mixture object and the extract the properties). I guess that could be useful also with refprop or coolprop |
ok, seems it is possible? In principle I would just need to add the custom "fake" mixing rule functions to those dictionaries at the end of fluid_properties/mixtures.py? |
Not sure if I got this: if you do all the mixture property handling inside your own class, and make the fluid "pure" for tespy with the mixture being the only component, then you do not need to add anything to the mixing rules of tespy. Those rules are only applied to fluids which are not "pure" from tespy's perspective (i.e. more than one component in the fluid vector specified to a connection). |
Ah I see, you are likely correct here, I did not think of that. A quite hacky way to inject your mixture parameters would be to "hide" them inside the string fluid name and then split the string inside the Would it be possible for you to share a minimal example here? |
Yes, I eventually came up with quite a hacky fluid name that hides all the relevant information. It is not elegant but it works (at least I could validate with the basic heat pump model using butane).
Then eventually in the wrapper I split everything again:
I believe it could also be possible to implement fake mixing rules, whereby instead of evaluating the property of each mixture component and then applying a mixing rule, a pseudo-pure mixture is created starting from some data stored in the wrapper of each component. This is then directly used to calculate the requested property. In this way there's no need of treating the mixture as a pure fluid with concentration 1. |
Hello,
I would like to integrate our fluid properties libraries with Tespy. I understand it is necessary to create a custom wrapper, with all the necessary functions to calculate Temperature ecc. This is fine.
I am having issues with the specification of the fluid itself. As far as I understand by digging around, it is somehow hard coded that the input format must be fluid = {'Component1' : Conc1, 'Component2': Conc2} and fluid_engine = customengine.
Some of our libraries specify the fluid as a set of molecular groups instead, for instance n-Butane would be defined as 2CH3 + 2CH2, or as 2 arrays: V1 = [CH2, CH3], V2 = [2,2]. A mixture of n-components would instead require 2 2D arrays + an additional 1D array for the concentrations. Speaking of mixtures, I don't want to use mixing rules, as our models directly compute mixture properties.
Isn't it possible to somehow pass an instance of the wrapper? As an example:
Any other solution (apart from coming up with a very long fluid name string containing all the info :D) would be also nice :)
Thanks,
Lorenzo
The text was updated successfully, but these errors were encountered: