open-ideas / IDEAS

Modelica library allowing simultaneous transient simulation of thermal and electrical systems at both building and feeder level.
133 stars 58 forks source link

Boiler interpolation and rescaling #45

Closed damienpicard closed 6 years ago

damienpicard commented 10 years ago

The boiler model, or rather the IDEAS.Fluid.Production.BaseClasses.HeatSource_CondensingGasBurner it is using, show some problems:

1) the scaling of the Boiler, based on QNom / QNom_init with QNom_init the nominal power for which the power maps are valide is done after the efficiency calculation. The scaling should be applyied on the mass flow rate too for the efficiency calculation.

2) the model use Modelica.Math.Interpolate, which is a not continuous function (and therefore not differenciable). The function: IDEAS.Utilities.Math.Functions.cubicHermiteLinearExtrapolation is more appropriate.

3) an assert should be added for the set point temperature to avoid extrapolation in the power maps.

damienpicard commented 10 years ago

The heat source model uses IDEAS.Utilities.Math.Functions.cubicHermiteLinearExtrapolation on a wrong way, as it does not provide the correct derivatives to the function.

damienpicard commented 10 years ago

Revert to previous implementation and make issue with specific error message.

saroele commented 9 years ago

I missed this issue, and solved it in #167.

See also my small benchmark in #47

I guess this issue can be closed if #167 is merged.

Mathadon commented 9 years ago

@damienpicard ?

damienpicard commented 9 years ago

@arnoutaertgeerts will make a pull request for his new boiler implementation tomorrow.

rubenbaetens commented 9 years ago

How many boiler implementations can there be ?

damienpicard commented 9 years ago

How many do you want? ;)

rubenbaetens commented 9 years ago

I'll rephrase it: How many different ways are there to make a boiler ? And as such, what is there to deny or simplify ?

damienpicard commented 9 years ago

The previous implementation has to interpolate in 3D. This is not efficient especially because no derivatives can be given. Arnoet implemented a polynomial fit to solve that. So no physical differences, just numerical.

arnoutaertgeerts commented 9 years ago

Some clarifications on what I did:

The inputs to a heatsource are always the same (for now):

The Polynomial heatsource still uses an algorithm to calculate the output value of the polynomial to be as generic as possible, currently any polynomial (of any order) can be given to the model. However, this means no derivatives yet. @Mathadon already proposed a solution to this problem by using a vector function to calculate the output. The values of the constants can be calculated using this python module I wrote.

The PerformanceMap heatsource uses a new 3DInterpolationTable model based on data and interpolates the data as @saroele used to do. From now on, if we need to make changes on how the 3D interpolation works, we can just change this model.

Which branch should I use to pull request my changes to?

damienpicard commented 9 years ago

@arnoutaertgeerts you should make a pull request to Annex60 branch. What we normally do is to create a branch issueXX_newBoilerImplementation on open-ideas github and make the pull request from that branch.

arnoutaertgeerts commented 9 years ago

I pushed my changes to https://github.com/open-ideas/IDEAS/tree/issue45BoilerModel which is based on the Annex60 branch. The InterpolationTable3D model can be found in IDEAS.Utilities.Tables

arnoutaertgeerts commented 9 years ago

ah ok :)

rubenbaetens commented 9 years ago

I notice @arnoutaertgeerts that you connect heatSource.heatPort, pipe_HeatPort.heatPort, mDry.heatPort and thermalLosses.heatPort all to each other in IDEAS.Fluid.Production.PerformanceMapProduction and IDEAS.Fluid.Production.PolynomialProduction. I'm wondering: is this correct ? It means you do not define where the heat is going preferrentially. Maybe you should put a resistance between the fluid and the thermal mass.

arnoutaertgeerts commented 9 years ago

This is also something I adopted from the original boiler model but is still a good question. I think this issue is closely related to how the efficiency data is constructed. @saroele what is your take on this?

arnoutaertgeerts commented 9 years ago

I spoke with Roel about this issue.

  1. @rubenbaetens Direct connection to the pipe: The performance map data is static netto data which means it comes from measurements of direct heat provided to the water.
  2. @damienpicard QLossesToCompensate and Environmental losses: The boiler model is a dynamic model with heat losses to the environment when the boiler is on and when the boiler is off. However, when the boiler is on, the heatsource provides heat to the water in the boiler based on the static netto data. Interpreting this data correctly means all this heat is provided to the water and nothing is lost to the environment. In order for the model to be correct in both on and off phase, QLossesToCompensate is added to the netto heat flow when the boiler is on, which is equivalent to the heat lost to the environment.

The heat balance of the boiler is than

rubenbaetens commented 9 years ago

In that case, i would add a resistor between the pipe and the thermal mass in the boiler model, though it's not so easy to define it's R-value.

On Fri, Dec 5, 2014 at 10:24 AM, arnoutaertgeerts notifications@github.com wrote:

I spoke with Roel about this issue.

1.

@rubenbaetens https://github.com/rubenbaetens Direct connection to the pipe: The performance map data is static netto data which means it comes from measurements of direct heat provided to the water. 2.

@damienpicard https://github.com/damienpicard QLossesToCompensate and Environmental losses: The boiler model is a dynamic model with heat losses to the environment when the boiler is on and when the boiler is off. However, when the boiler is on, the heatsource provides heat to the water in the boiler based on the static netto data. Interpreting this data correctly means all this heat is provided to the water and nothing is lost to the environment. In order for the model to be correct in both on and off phase, QLossesToCompensate is added to the netto heat flow when the boiler is on, which is equivalent to the heat lost to the environment.

The heat balance of the boiler is than

  • When the boiler is on: Qwater = QfromData + QLossesToCompensate - QEnvironment = QfromData
  • When the boiler is off: Qwater = - QEnvironment

— Reply to this email directly or view it on GitHub https://github.com/open-ideas/IDEAS/issues/45#issuecomment-65765299.

saroele commented 9 years ago

Such a resistance introduces more complexity (different temperatures for water and thermal mass, so how to determine QLossesToCompensate ?) What issue or problem would that resistance solve?

rubenbaetens commented 9 years ago

It depends on what the additional thermal mass represents: (a) If it represents the piping around the water, i agree it has the same temperature as the water, but there is an mFactor implemented in the fluid MixingVolume for this to increase the thermal mass of the fluid without causing any additional equation. If the thermal mass, however, represents the entire thermal mass of the boiler (b) i'm afraid the response time of the boiler will be too low compared to reality ...

saroele commented 9 years ago

It currently represents something 'lumped' indeed, so between a) and b). Anyway, when there is only manufacturer data, it's impossible to set this value. Only (dynamic) measurements can help to identify this parameter. With such data, it may indeed be possible to introduce an additional parameter for the resistance between the water and the dry mass, but this would still be a simplification because there are multiple dry masses in reality (with each their own resistance).

If the new boiler model uses the mFactor implemented in the fluid MixingVolume we could indeed simplify the model and still be able to compute QLossesToCompensatecorrectly.

arnoutaertgeerts commented 9 years ago

I noticed a bug in the boiler model when there is zero flow: m_flow=0 The required heat is calculated like this:

QAsked = IDEAS.Utilities.Math.Functions.smoothMax(0, m_flow*(Medium.specificEnthalpy(Medium.setState_pTX(Medium.p_default, TSet, Medium.X_default)) -hIn), 10);

This means QAsked=0 when there is no flow. Is this the desired behavior of the boiler? Or should it keep the water mass in the pipe at a constant temperature? @rubenbaetens @damienpicard

rubenbaetens commented 9 years ago

I generally model that when m_flow is zero, QAsked should be zero too by giving the primary circuit pump and the heat production unit the same on-signal. Some (e.g.) heat pumps do have a small internal buffer of (e.g.) 30 liters, but i'm not sure this is kept at a certain temperature (but there to give some inertia to the condensor). We could ask Jan Hoogmartens (?).

Mathadon commented 9 years ago

Is this code not just preventing division by zero when m_flow = 0 ?

rubenbaetens commented 9 years ago

@Mathadon where do you see a division, or is it in Medium.specificEnthalpy( ) or Medium.setState_pTX( ) function ? If so, don't they contain a smoothMax( ) ... ?

Mathadon commented 9 years ago

I agree, my bad.

Then probably it's to avoid having Q < 0 when the flow reverses? The smoothMax makes sure no event is generated. However the transition period of 10 watts could probably better be rewritten to something as a function of m_flow_nominal and cp_nominal to avoid bad behaviour for small components.

arnoutaertgeerts commented 9 years ago

Alright then we leave it this way. What else needs to happen to merge this branch?

saroele commented 9 years ago

QAsked is intentionally zero: boilers and heat pumps cannot produce heat when there is no flow rate.

saroele commented 9 years ago

@arnoutaertgeerts Why did you revert all the changes that I proposed with regard to useTSet and conditional QSet and TSet inputs? I think it happened here: 8e50534d6d0f35a63be6b25ecddb0127bdfb1542

I have updated my branch and now my models don't work anymore :-(
Was there a reason to undo these changes? It was perfectly backwards compatible because the default useTSet = true

I have to advance on these models, so I will try to fix it.

rubenbaetens commented 8 years ago

Let me re-open this issue for #308.

rubenbaetens commented 8 years ago

I would be very happy if we could finalise this issue from ... 13 May 2014 (see #308). I'm working with boiler models for my simulations, which is (kinda) a pain in develop and it's a pitty knowing all the code is here to relieve the pain, but it never made it into the main branch ...

Mathadon commented 7 years ago

@damienpicard I don't think either of us will find time to work on this properly. Can this be closed?

rubenbaetens commented 7 years ago

I would keep it open, the stale label indicates this is LT.

damienpicard commented 7 years ago

I'm actually using this implementation in my version of IDEAS. I think it's worth putting some effort here in the (far) future. Let's keep it open.

Mathadon commented 6 years ago

@damienpicard any updates on this?

PereiraUCD commented 6 years ago

Is it possible to scale up this boiler model for a 3.2MW gas fired boiler (viessmann) on this stage of modifications?

Mathadon commented 6 years ago

@PereiraUCD sorry for the late response. I suggest not using this model since it is not in the main branch. You can use IDEAS.Fluid.HeatExchangers.Heater_T instead :)

Mathadon commented 6 years ago

This development is discontinued.