Hi,
I am going to bring up an old familiar topic - SIMULTANEOUS. I have a mind-numbing loop I am trying to find my way around. In this scenario, I have an injection temperature, a thermal response, and a subsequent production temperature. There is definite feedback, but I cannot simplify the thermal response, which increases or decreases the temperature of production based on a rather large pool of other variables. These three variables are wholly dependent on each other, so I would like to delay the production temperature then use it in the next time step in an effort to break the simultaneous loop. Unfortunately, whenever I try to do this, I cannot workaround the SIMULTANEOUS errors. I have tried DELAY Information, N, 1, etc. When I try to INTEG() the production temperature, the integration response time cannot match the output. If I try to use a factor on the INTEG() to amplify the response, I incidentally amplify the injection temperature and the model quickly crashes. I am looking for tips and tricks in a workaround way.
Thank you!
Simultaneous workaround
-
- Senior Member
- Posts: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Simultaneous workaround
I would be inclined to solve the system simultaneously. Often FIND ZERO is a better option than SIMULTANEOUS for this. Would have to see the equations to say more.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Simultaneous workaround
I used the FIND ZERO function once. In that case I was searching for a zero/minimum to appropriately set friction factor values. I guess I am not sure how I would use FIND ZERO in this case. In other words, what am I minimizing?
Here are the equations, that do not work.
injection temperature=
IF THEN ELSE(include cooling=1 :AND: cooling demand>heating demand, production temperature
+cooling temperature differential
, production temperature-heating temperature differential)
Units: Celsius
checked
production temperature=
temp outlet
Units: Celsius
check
temp outlet=
injection temperature - (total heat extraction rate / (MAX(mass flow in borehole
, 0.01) * specific heat of water
*1000 ))
Units: Celsius
Here are the equations, that do not work.
injection temperature=
IF THEN ELSE(include cooling=1 :AND: cooling demand>heating demand, production temperature
+cooling temperature differential
, production temperature-heating temperature differential)
Units: Celsius
checked
production temperature=
temp outlet
Units: Celsius
check
temp outlet=
injection temperature - (total heat extraction rate / (MAX(mass flow in borehole
, 0.01) * specific heat of water
*1000 ))
Units: Celsius
-
- Senior Member
- Posts: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Simultaneous workaround
Hi Tom, I did "successfully" implement a tradeoff between a variable for the outlet temperature and the FIND ZERO outlet temperature, but I had to set the production temperature to a constant. I am not sure that was your intent or thought process here. The production temperature, if set to the FIND ZERO result, however, still causes a simultaneous error - as expected I suppose.
FIND ZERO outlet temp=
FIND ZERO( injection temp scale , temp outlet , zscale , initial outlet temp
, n outlet , skip outlet , tolerance outlet , outlet iterations , outlet method
)
Units: Celsius
injection temperature=
IF THEN ELSE(include cooling=1 :AND: cooling demand>heating demand, production temperature
+cooling temperature differential
, production temperature-heating temperature differential)
Units: Celsius
checked
production temperature=
20
Units: Celsius
check
temp outlet=
FIND ZERO outlet temp-(injection temperature - (total heat extraction rate
/ (MAX(mass flow in borehole, 0.01) * specific heat of water
*1000 )))
Units: Celsius
FIND ZERO outlet temp=
FIND ZERO( injection temp scale , temp outlet , zscale , initial outlet temp
, n outlet , skip outlet , tolerance outlet , outlet iterations , outlet method
)
Units: Celsius
injection temperature=
IF THEN ELSE(include cooling=1 :AND: cooling demand>heating demand, production temperature
+cooling temperature differential
, production temperature-heating temperature differential)
Units: Celsius
checked
production temperature=
20
Units: Celsius
check
temp outlet=
FIND ZERO outlet temp-(injection temperature - (total heat extraction rate
/ (MAX(mass flow in borehole, 0.01) * specific heat of water
*1000 )))
Units: Celsius
Re: Simultaneous workaround
Simultaneous and find zero work like a black box because you don't see the intermediate results that lead to eventual convergence or not.
I often prefer to use a vector in which I store the intermediate results that I calculate myself so that they converge.
In short, I make my own simultaneous or find zero.
JJ
I often prefer to use a vector in which I store the intermediate results that I calculate myself so that they converge.
In short, I make my own simultaneous or find zero.
JJ
-
- Super Administrator
- Posts: 4827
- Joined: Wed Mar 05, 2003 3:10 am
Re: Simultaneous workaround
When increasing temperature, the response is never instant, there is always a delay between applying heat and the temperature increasing. Is the "thermal response" a delay? That would break the simultaneous problem. I don't think I've ever used the SIMULTANEOUS function in any model.geo_curious wrote: ↑Sun Nov 10, 2024 3:17 amI am going to bring up an old familiar topic - SIMULTANEOUS. I have a mind-numbing loop I am trying to find my way around. In this scenario, I have an injection temperature, a thermal response, and a subsequent production temperature. There is definite feedback, but I cannot simplify the thermal response, which increases or decreases the temperature of production based on a rather large pool of other variables. These three variables are wholly dependent on each other, so I would like to delay the production temperature then use it in the next time step in an effort to break the simultaneous loop. Unfortunately, whenever I try to do this, I cannot workaround the SIMULTANEOUS errors. I have tried DELAY Information, N, 1, etc. When I try to INTEG() the production temperature, the integration response time cannot match the output. If I try to use a factor on the INTEG() to amplify the response, I incidentally amplify the injection temperature and the model quickly crashes. I am looking for tips and tricks in a workaround way.
Make sure you have units in the model as well, those will often show up any errors in logic.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Simultaneous workaround
I generally avoid using simultaneous or find zero because it contradicts the principle of SD which describes a dynamic between steps and not within a step. In this case I would divide the step by 2, using half hours as step for example or half minutes as recommended by the administrator and using the traditional SD integration.
JJ
JJ
-
- Senior Member
- Posts: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Simultaneous workaround
I would agree with Administrator on this, that there should be a delay in the temperature response. This, however, has not successfully avoided simultaneous errors at all by using delay. If I use delay and integration, the production temperature collapses quickly and the model will not run. I am not going to change the timestep of the model for one variable in this instance. I believe that RK4 is basically the midpoint search integration method anyway, so changing the integration method is probably more appropriate; e.g. Euler to RK2/4.
Whatever the case, this still does not work. The equations above are still the ones that I am working with.
Whatever the case, this still does not work. The equations above are still the ones that I am working with.
-
- Senior Member
- Posts: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Simultaneous workaround
After thinking about this more, I believe that solving the circularity does not necessarily mean much here. The thermal response and subsequent outlet temperature can be calculated separately from the production temperature to determine other consumptive costs in the model. If I swap 'temp outlet' for all other occurrences of 'production temperature' except the demand differential between production and injection, it works as expected. I have to think about this more, but this circularity is what I would consider impossible to solve in realistic terms in Vensim. Perhaps avoiding it altogether is a solution, which makes production temperature a constant with injection temperature responsive to demand=Q, then separately calculates the temp outlet for use in the rest of the model.
Re: Simultaneous workaround
If you can post a reduced model, containing just the simultaneous loop and enough context to attempt a run (but for the simultaneity), I can probably construct a solution.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/