-
Notifications
You must be signed in to change notification settings - Fork 11
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
Molar Specific Heat Units Don't Match #19
Comments
Great videos! Thanks for taking your time to deep dive into this package! It is very helpful for us to get the feedback you provide on youtube. In short you got the underlaying mathematic correct, you just needed the correct symbol. You could do it this way in C#: var unit1 = new UnitSystem(EnergyUnit.Kilojoule/AmountOfSubstanceUnit.Kilomole, $"{EnergyUnit.Kilojoule}/{AmountOfSubstanceUnit.Kilomole}");
var unit2 = new UnitSystem(EnergyUnit.SI/AmountOfSubstanceUnit.SI, $"{EnergyUnit.SI}/{AmountOfSubstanceUnit.SI}");
|
To answer some of your questions from your videos: The //Creating a unit that is not yet cast to a specific unit
UnknownUnit unknown = Energy.FromSI(10) / Duration.FromSI(10);
// {1 W}
//You could cast it to BaseUnit but you lose the nice looking symbols
BaseUnit baseunit = (BaseUnit)unknown;
// {1 kgm²/s³}
//Casting it to a specifig unit. It runs the check and will throw an error if the user set it to a wrong unit
Power power = unknown;
//{1 W}
//Trying to cast to a wrong unit
Energy energy = unknown;
//WrongUnitException |
Hello MadsKirkFoged, Thank you for getting back to me promptly! Appreciate your answers Yeah i think for fluids mechanics and heat transfer, heat capacity is good. Thought I saw that entropy has the same units in another issue post. However, units for empirical correlations can take any kind of form. They aren't standard per se. For example, temperature correlations for Therminol VP-1 are temperature related, or for air as well. Heat capacity correlations can be cubic as shown in the video. Also, for equations of state such as peng robinson and soave redlich kwong, the constants used have units, but are not standard units as well. I don't know if adding the units of these constants in is worth your time really. Because as you would know, the correlations in engineering can take so many forms. So having the howto guide on making custom units is perhaps the thing i'd ask for. How to typecast those custom units, and convert them back to say heat capacity or viscosity etc... The alternative is to have the user use the BaseUnit Class directly as i was doing. It provides a convenient return type since almost every engineeringUnit derives from it. I was making an IEnumerable for example in my interfaces so that I can populate the List or Enumerable with various kinds of data from an xml library, eg. critical temperature, critical pressure, critical volume, heat capacity constants, viscosity constants etc. Let me know what you think? |
Hi MadsKirkFoged, jumping onto this issue as you mentioned above that you wanted to add a HowTo on creating custom units without inheriting from BaseUnit... are you still planning to do that? I was using some custom units that I thought were probably not necessary for your average user and/or would have needed a little more work from your side to add in a clean way (see below), so I never wanted to open a request to add those. I was able to define these without any issues by inheriting from BaseUnit and taking inspiration from the generated code of existing units. After the recent code changes however, this is no longer possible as easily as some used methods are now internal. I got everything to work by cloning your repo, adding these units in there and using my own custom dll, but as you can imagine, this can get a little tedious... So this is what I was doing: I had a model where the result would among other things be a cost effectiveness comparison. E.g. you want to know the energy specific cost of a power plant in say M$/GWh, an input parameter to the model might be the mass specific cost of a certain material needed for construction, say in $/kg, etc. For this, I created a new base unit The reason I didn't ask for this to be added was that I think it is probably not great to hard-code this to be Dollar-based. You certainly don't want to deal with currency conversions but maybe there is an easy way to let the user choose the currency to be used for all cost-based calculations. If so (or if you think it's fine to hard-code Dollars for now), then maybe you could add these new units (with "SI" units): Looking forward to hearing your thoughts. Let me know if you want to discuss Cost in a separate issue. |
@mschmitz2 |
Hello, thanks for making this great package,
I'm trying to make custom units for heat capacity using BaseUnit Class
I find that when i do:
Console.WriteLine(EnergyUnit.Kilojoule/AmountOfSubstanceUnit.Kilomole)
Console.WriteLine(EnergyUnit.SI/AmountOfSubstanceUNit.SI)
They are not equivalent.
I'm making a video guide on how to use your unit package, but the bug is at
https://youtu.be/R_2DvEKXpac
12:00 approx onwards.
I will stick to SI for now, but could you check this out? Thank you so much!
The text was updated successfully, but these errors were encountered: