Closed wangzizhe closed 1 year ago
Dear Mr. Wang, we are glad you decided to explore the TransiEnt-Library.
In the TransiEnt-Library there are different connectors for gas components defined. This includes one connector for real gas components:
• TransiEnt.Basics.Interfaces.Gas.RealGasPort, and two connectors for ideal gas components • TransiEnt.Basics.Interfaces.Gas.IdealGasEnthPort, • TransiEnt.Basics.Interfaces.Gas.IdealGasTempPort.
When connecting two components in Modelica the connectors of both components must use the same variables. In your example, this is not the case as one connector uses the specific enthalpy and the other the temperature. Most of the components in the gas sector are using the RealGasPort (TransiEnt.Basics.Interfaces.Gas.RealGasPort) as a connector because it is more accurate for modelling high pressure grids. This connector declares the variables h_outlfow, m_flow, xi_outflow and p. From a thermodynamic point of view, it is favourable to use the specific enthalpy as a state variable. That is why the IdealGasTempPort is barely used in the library. However, there are several models which are designed for the use of ideal gas. For example:
• TransiEnt.Producer.Combined.SmallScaleCHP.CHP_ice • TransiEnt.Producer.Heat.Gas2Heat.SmallGasBoiler.Gasboiler_dynamic_L2 • TransiEnt.Components.Boundaries.Gas.BoundaryIdealGas_pTxi
These models are tested in their check models and used in an example model: • TransiEnt.Examples.Coupled.Coupled_SmallScale.
The models you refer to in your post use the IdealGasTempPort and were probably created to be combined with models of the ClaRa-Library like it was done in the check model • TransiEnt.Components.Electrical.FuelCellSystems.FuelCell.Check.TestSOFC.
If you want to combine these components with models using real gas connectors one way would be to create an adapter model like it was done in: • TransiEnt.Basics.Adapters.Gas.Ideal_to_Real Exchanging the ideal gas port and adapting the equations accordingly should do the trick. If you have any further questions feel free to message me. I hope I could help you with your issue and wish you good luck with your work!
Dear Mr. Westphal (that's very german I would say...),
thank you for your quick and kind reply!
I saw some models using ideal gas, as you mentioned. But they all use IdealGasEnthPort
, there is no gas component in the entire TransiEnt library which outputs the parameter temperature (except fuel cell stack), or to say, IdealGasTempPort
has not been used anymore (except only in fuel cell stack).
It made me confused, I don't quite understand why...
Yes, the only problem is the fuel cell stack. Since fuel cell stack is a common component, and it uses ideal gas with temperature as inputs. I guess fuel cell stack must be implemented by someone before.
I wonder how he/she/they connected it with other gas components?
I tried to build an adapter with the same idea as the apater "real_to_ideal". So my adapter should transfer real gas with h, p, xi, m_flow into idea gas with T, p, xi, m_flow. As this screenshot shows:
There are the parameters and equations of these two ports:
protected
// Input port
TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluid_ph gasIn(
vleFluidType=real,
computeSurfaceTension=false,
deactivateDensityDerivatives=true,
h=inStream(gasPortIn.h_outflow),
p=gasPortIn.p,
xi=inStream(gasPortIn.xi_outflow),
deactivateTwoPhaseRegion=true)
annotation (Placement(transformation(extent={{-70,-10},{-50,10}})));
// Output port
TILMedia.Gas_pT gasOut(
gasType=ideal,
T=20.15, // Hydrogen has to be cooled to -253°C (20.15K) and stored in insulated tanks to
maintain this low temperature and minimize evaporation
p=gasPortOut.p,
xi=gasPortOut.xi_outflow) annotation (Placement(transformation(extent={{50,-12},{70,8}})));
equation
gasPortIn.p=gasPortOut.p;
gasPortIn.m_flow+gasPortOut.m_flow=0;
gasPortIn.xi_outflow=inStream(gasPortOut.xi_outflow);
gasPortOut.xi_outflow=inStream(gasPortIn.xi_outflow);
gasPortOut.T_outflow=-253+273.15;
The model check works pretty fine, no error detected.
But when I insert the adapter into my model, I get the same problem as I described at the beginning:
I wonder why adding the parameter T into the output still doesn't work... I am very confused.
Maybe that is the reason why IdealGasTempPort
has been barely used?
I will send you my models via email. Thank you very much!
Have a nice day and see you soon! Zizhe
Dear all,
THANKS a lot for all of your helps and supports. Especially thank you for your quick response - I really appreciate you getting back to me so soon!!!
Thank you for organizing the TransiEnt Workshop last week. After that Dr. Brunnemann helped me with building an adapter and modifying my model. My model works now!
I learned one important and very tricky equation in the adapter is:
gasPortIn.h_outflow=gasOut.T
I'm still wondering how this equation works with enthalpy in the left and temperature in the right...
And sometimes the difference between gasIn
and gasPortIn
also makes me confused.
I think I could discuss with Dr. Brunnemann and experts this week in Dresden.
I also leanred that a third gas model e.g. besides gasModel1
and gasModel3
the gasModel4
is necessary for the adapter and the fuel cell stack.
And I got a much deeper understanding of the TransiEnt library during the past months with my hundreds of tries and failures...
I am also willing to help the people who face this issue in the future.
I will now close this issue with many thanks!
To cover this gap a new adapter has been modified and a Pull Request has been created. For more details please check: https://github.com/TransiEnt-official/transient-lib/pull/10
Dear all,
I have a concrete question about gas types, especially real and ideal gas in the TransiEnt library.
Background:
I noticed that almost all of components in TransiEnt which include gas have been modeled as real gas. One exception is the fuel cell stack (e.g.
TransiEnt.Components.Electrical.FuelCellSystems.FuelCell.SOFC
). This component has been modeled using ideal gas as input and output.I noticed that all components which conclude gas have used the gas ports from the TILMedia library, which is shown in the following screenshot.
Problems:
1: Not a single component with ideal gas of all the examples
In the TransiEnt library there are several examples. All the examples which include gas are using real gas. I haven't find any part/component which used ideal gas inside of all the examples from the library. I don't know why.
Do you have any examples which conclude components with ideal gas?
2: Components which have ideal gas and real gas can not be connected
Say that I want to model a system which has a eletrolyser and a fuel cell stack, here is where the problem occurs: the hydrogen produced from the eletrolyser has been modeled as real gas, but the fuel cell stack needs ideal gas as input.
Yes, there are adapters (
TransiEnt.Basics.Icons.RealToIdealAdapter
). But the problem is: the input port of fuel cell stack is using "_GaspT" which has 4 parameters (_T,p,xi,mflow). The output port of electrolyser is using "_VLEFluidph" which has 4 parameters (_h,p,xi,mflow). The output of hydrogen from the electrolyser has one parameter h (enthalpy) which the input port of fuel cell stack does not need. However the fuel cell stack has one parameter T (temperature) but the output parameters do not have T. This made these two components unable to be connected, and this apater only transfers real - ideal gas to each other but with the same parameters.This screenshot can conclude this question:
Error message during simulation is this because of different gas types and parameters:
I wonder if there is any solutions to this problem? Or more simpler, how could one connect fuel cell stack to other gas components? Because fuel cell stack is the single component I found which uses ideal gas.
Summary
Vielen Dank im Voraus!
Viele Grüße aus Dresden Zizhe Wang