Unit error

Use this forum to post Vensim related questions.
Post Reply
walin
Junior Member
Posts: 15
Joined: Mon Jul 05, 2010 11:59 am

Unit error

Post by walin »

He everyone,

I have build a model with some 10 unit errors in it. But since the model seems to work just fine, is this a problem?
walin
Junior Member
Posts: 15
Joined: Mon Jul 05, 2010 11:59 am

Post by walin »

I added the model here. It is my first Vensim model, so every feedback is welcome!
thanks in advance
Attachments
Vensim Tryout.mdl
(20.56 KiB) Downloaded 872 times
Administrator
Super Administrator
Posts: 4841
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

It's very good practice to enter units. It's very easy to ignore them, but they do give a measure of confidence that the model is dimensionally correct.

A common problem is when dealing with times. It's easy to say a duration is in weeks and use it in a model, without the units checking you may be using the number as "months" instead of weeks.

task duration = duration plan + duration build (months)
duration plan = 4 (weeks)
duration build = 8 (months)

Vensim would warn you that you were adding weeks to months (task duration) which is incorrect. The actual equation would be

task duration = duration plan / weeks per month + duration build
duration plan = 4 (weeks)
duration build = 8 (months)

Personally, I will not even work with or believe any results from a model if it is not dimensionally correct.

Tony.

[Edited on 15-7-2010 by Administrator]
walin
Junior Member
Posts: 15
Joined: Mon Jul 05, 2010 11:59 am

Post by walin »

Thanks for the reply, but in my model I have a hot water buffer (in Joule) which is filled at a certain (constant) rate in Joules/Minute. But as the buffer is not emptied at a specific rate but rather at specific moments in time (orininating from a excel sheet) the outflow has to be in Joule. But the model does not quite understand that, although I think I got it right?
tomfid
Administrator
Posts: 3995
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

In a continuous model, even a discrete event (emptying the buffer) has units with time in the denominator.

Conceptually, any change in the state of a system has to occur over some time. The relationship between a state (stock) and its rate (flow) is x = integral( dx * dt ) - the presence of time (dt) on the right hand side requires the presence of time in the denominator of dx to balance units.

A discrete event is a change in state that occurs from an infinitely fast flow, for an infinitely short time (see the unit impulse function, http://en.wikipedia.org/wiki/Dirac_delta_function ). An infinitely short time in a model is represented by the TIME STEP.

Therefore, if you want to empty a stock at an instant in time, or perform some other discrete event, the flow will generally be written as
stuff_in_stock/TIME STEP
which has the stock's units, divided by time.

The PULSE function is often used as the event trigger. For example, to represent a discrete deposit to a bank account,
bankBalance = INTEG( depositing - withdrawing, initBankBal) ~ $
withdrawing = ...
depositing = PULSE( depositTime, TIME STEP)*amountDeposited/TIME STEP ~ $/month
amountDeposited = 100 ~ $

Hope this helps.

Tom
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post by LAUJJL »

If the level is in Joule, the outflow must be in joules/min. If you want to diminish the level with X joules, you will have to set the rate to -X/time step during the time step when occurs the specific moment. The level will be diminished by (-X/time step) * time step = -X.
Regards.
JJ
walin
Junior Member
Posts: 15
Joined: Mon Jul 05, 2010 11:59 am

Post by walin »

Makes sense what you are saying. I changed the model and The Units are okay at the moment. I only don't completely understand your Pulse function as the event trigger.
At the moment I have two outflows of my buffer, one being the heat demand of the household and the other being the tap water demand.
The heat demand is determined by the difference between outside and inside temperature (~degree) times a constant (~Joule/Degree) which devided by the TIME STEP gives an outflow in Joule/Minute.
But for the Hot water demand I use a excelinput which determines the amount of tapwater used at a five minute interval in Joules. Does vensim allow to spread this over the five minutes? Or do I need to manually change my excel sheet...

thanks again,

Wouter
Attachments
Vensim Tryout.mdl
(7.79 KiB) Downloaded 848 times
tomfid
Administrator
Posts: 3995
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

Looking at the model, heat demand doesn't strike me as the kind of thing that I would model as a discrete/instantaneous event. Presumably the heating system has finite capacity to deliver heat, and therefore space heating occurs only slowly.

It looks like ((Room temperature HP-Outside temperature HP)*Heating constant HP) is the rate of heat loss to the outside (a function of temperature difference and thermal conductance of the room). In that case, Heating Constant HP should have units of watt/degree or joule/minute/degree, in which case you don't need TIME STEP in the equation for Heat demand hh HP.

However, I think it's also important to recognize that the heating delivered might be different from the heating desired, for example because the buffer is empty or the demand exceeds device capacity.

Thus you might do something like,
heat in room = INTEG( heat delivery - heat loss, initial heat in room)
heat loss = (Room temperature HP-Outside temperature HP)*Heating constant HP
Room Temperature HP = heat in room/room heat capacity
Heating constant HP = room heat capacity*thermal conductance
heat delivery = MIN( max heat delivery, desired heat delivery)
desired heat delivery = MAX(0,desired room temperature-Room Temperature HP)*room heat capacity/desired time to heat
max heat delivery = buffer HP/minimum time to deliver buffer heat

minimum time to deliver buffer heat could be set to TIME STEP, or something longer, depending on the limits of the device.

Tom
Post Reply