Error: "The model is structurally singular" Dymola Modelica Solar thermal coupled with hot water tank and floor heating - modelica

Here what I am doing is that using the weather data as input parameter, if the global radiation is higher than 100 W/m^2 open the valve. First solar heat will be released to the hot water tank, and then the heat will be given to the Boundry_pT via heat exchanger. I want to see, how the temperature of Boundry_pt changes resp. time.
I also want to use water as Medium in the internal heat exchanger. For that I edited the text box in Medium in the heat exchanger, as Buildings_Media_Water. Is it correct? Otherweise how can I choose water as a medium in the internal heat exchanger?

It seems that you have two separate fluid-circuits, and you only have one expansion tank (the "exp" component - sorry if I don't have the right terminology).
That means that the flow becomes over-determined in the 2nd circuit - and the pressure under-determined. There are a number of ways of handling it - including adding an expansion tank.

Related

Modelica : Simulation of temperature rise in a cable - How to do?

I am a beginner on modelica. I wanted to transpose a model found on a paper (on internet) to a modelica model.
Here is the paper :
Insulated Cable Temperature Calculation and Numerical Simulation
I am stuck in rewritting the fomulas. Second derivative on a variable different of time --> i don't know how to do.
Another way I was thinking is to use the Thermal/HeatTransfer library. But here too, I don't know how to put the blocks togethers... I think this is due to a big lack in thermodynamic knowledge from my side.
--> I don't know what block to use to simulate the conductor and the insulation layer.
Maybe this is something too difficult ?
If someone has an idea on how to start, it will be a pleasure to read you :)
I tried to use the Thermal library :
Using heat transfert lib.
I have a current source and a resistance.
The resistance will change depending on the temperature involved by the current in the resistance.
I use 0.004 as alpha for the relationship R=R20*(1+alpha(T-Tamb)).
Let's say I have a 1 meter copper conductor with a crossSection of S=16mm² = 15.10^-6m²
then the initial resistance is R = rho.L/S ≃ 1.07mΩ at 20°C
Following this example of cable : Bayka 16mm²
To get 70°C at the surface of the conductor, then the max current for a single 16mm² wire cable is 107A in air, and 160A in earth.
I took, in my example, random value of thermal conductance and capacity to get an approximative temperature near the one given in the table (~70°C).
Is this model is the good one for an insulated cable ? (no considering values)
Or I forgot something? Maybe I am wrong in the position of the blocks ?
What do you think ?
Looks reasonable to me, might be easier to use the same component for heat conduction (heat resistor or heat conductance, not both) in order to be able to compare the two values. The mathematical formulas for radial heat conduction can be found here e.g. https://web2.clarkson.edu/projects/subramanian/ch330/notes/Conduction%20in%20the%20Cylindrical%20Geometry.pdf

Heat Regeneration in Dymola/Modelica

I want to build a system which consists of solar thermal collectors and ground source heat exchanger. I have a whole season weather data, which is connected with solar thermal collectors. I want to see how much heat will be released during the whole season from solar collectors to the ground by ground source heat exchanger respectively borehole, and the increased ground temperature by heat release.
Although I have the same number of unknowns and equations, the singularity error comes up.
Is there any missing process element?
The thermo-hydraulic part of your model needs a "ground" component to provide the reference pressure and enthalpy, since the heat exchanger components only describe changes in pressure/enthalpy.
You could use, e.g., a Modelica.Fluid.Sources.Boundary_pT, Modelica.Fluid.Sources.Boundary_ph or Buildings.Fluid.Storage.ExpansionVessel component for that.

How to add or delete fluid in LBM(lattice boltzmann method)

LBM focuses on fluid clusters, and uses the macro fluid density and velocity to calculate the equilibrium distribution function, and then uses the evolution equation to achieve system iteration. But if we add the same fluid to the lattice grid points in the LBM or reduce the existing fluid continuously, how should we recalculate the macro fluid density and velocity? Or how should the distribution function at the lattice grid point be recalculated? Can LBM simulate a scenario where fluid is continuously added or reduced to the system? For example, water keeps flowing from the tap.
The traditional lattice-Boltzmann method (e.g. the D2Q9 lattice in 2D) can only be applied to incompressible flows. Put in simple terms this means that there can't be more mass entering the domain than exiting it: The mass inside the domain is roughly the same throughout the simulation. This simplification of the generally compressible Navier-Stokes equations can not only be applied to incompressible fluids (such as water) but also to low-Mach number flows like the flow around a car (for more details see here). Yet the traditional lattice-Boltzmann method can't describe multi-phase and free-surface flows as well as flows with sinks and sources (which all result in a change of density of the system).
Any inlet or outlet conditions in the incompressible lattice-Boltzmann method falls in one of the following categories:
Periodic boundaries (the populations that exit the domain on one side enter it again on the other side)
Pressure-drop-periodic boundaries (such as Zhang/Kwok) for periodic flow but with an additional term for compensating for a pressure drop inside the domain due to friction
Velocity and pressure boundaries (generally a velocity inlet and a pressure outlet): There exist various formulations of these to make sure that the moments of the distribution are actually conserved and they have different characteristics regarding numeric stability. Most of them enforce some sort of symmetry and extrapolation of higher moments. The simplest ones are the ones by Zou/He but others like Guo's extrapolation method are significantly more stable for under-resolved and turbulent (high Reynolds number flows). This review discusses different ones in more detail.
You can have a look at this small code I have written in C++ for 2D and 3D simulations if you are interested in more details on how this actually works.
That being said there exist though several variations of lattice-Boltzmann methods in research that allow for multi-component or multi-phase flows (e.g. by introducing additional distributions) or compressible flows (with lattices with more discrete velocities and potentially a second lattice) but they are still exotics and you won't find many implementations around.

How to specify medium in Openmodelica?

I am simulating a heat pump water heating system in Modelica. I have attached the picture of my model. However, when I run the model I get the error "Medium is partial, name lookup is not allowed in partial classes". Can you please let me know:
How should I specify the water in tank, heat pump condenser and pipe?
How should I specify air in heat pump evaporator?
And in general, I did not find any example of modeling thermal systems in Openmodelica, can you suggest a source?
Thanks

Pressure drop in Modelica.Fluid.Pipes.DynamicPipe when dynamic momentum balance is taken into account

I have a problem in understanding the simulation results of a discretized Modelica.Fluid.Pipes.DynamicPipe when using a compressible gas as medium and taking the dynamic momentum balance into account.
To illustrate that I built up a very simple model: pressure source + pipe + pressure sink. The pressure in the pressure source is linearly increased over time. The parameterization of the pipe mainly corresponds to the default values, but the parameter "momentumDynamics" is set to "Modelica.Fluid.Types.Dynamics.FixedInitial".
For lower gas velocities (=smaller inlet pressures) the pressure drop is somehow nearly linear distributed over the discrete elements of the pipe (of course the pressure drop is not the same in every element due to the change in medium properties). As the gas velocity gets higher however, the pressure drop in the last flow model (= resistive element) is dominating by far. The picture below showes the pressures in the different flow models along the pipe. The pressure in the last flow model (green dashed line) corresponds to the constant pressure in the pressure sink.
Actually when looking at the pressure distribution along the pipe it looks as if the pipe was choking. This is however not possible since the velocities are still far below the velocity of sound. The velocity in the last flow model is a lot higher than in the rest of the pipe, because the pressure is a lot lower, since it corresponds to atmospheric pressure. This picture below shows the velocity in the flow models in the pipes as well as the velocities of sound. The velocities of sound are nearly constant at ~330 m/s.
What I do not understand:
Does the simulation result represents the physics correctly? If no, where is the "error" in the equations? If yes, what is the the physical behavior which the model represents here?
What I've tried:
Changing the discretization of the pipe does not change the phenomenom.
It seems to be independent of the medium model, I've also tried it with quite different medium models for compressible gas. (This example shown is using Modelica.Media.Air.ReferenceAir.Air_ph)
It only occurs if the dynamic momentum balance is chosen (since despite the name of this flag, using this flag not only "activates" the dynamic term in the momentum balance but also adds the pressure loss due to acceleration).
I'm looking forward to any hints to explain this issue!