seasonal variation

Use this forum to post Vensim related questions.
Post Reply
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

seasonal variation

Post by sintef »

Could anyone please help me with the problem?

I want to build a model based on year, but with seasonal variation. Would vensim be possible to implement the idea and how?
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post by LAUJJL »

Of course it is possible, and much more too, but to be practical, it would be better to be more precise, on what you want to do.
Regards.
J.J. Laublé
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

Hope my explanation below would be clear.

I want to build a model whose time unit is year for simulating capacity addition and production. Because demand varys a lot by season, including seasonal variation for demand is prefered. In this case, monthly production and capacity utilisation can also be learned.

I tried to do it by using month as time unit, but am not sure if I did it correctly. Could you please have a look at the attached file and give me some feedback?
Attachments
demand example.mdl
(2.25 KiB) Downloaded 1405 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You are using a sensible approach (switch time to Month). Of course, it is a good idea to include units for everything - you can rename use

month counter/Unit time

as the input to the Lookup where

unit time = 1 ~ Month ~|

If you switch time to month do note that you have growth rate at 5%/month - not a bad business to be in.

If you want to keep time in years use

Month Counter = MODULO* (Time - Initial Time) * Month Per year, Month Per year) ~ Month|
Month Per Year = 12 ~ Month|

Bob eberlein
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

thank you very much, Bob.
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

I have two more questions about the topic.

1. Is it correct to set the unit of time as year and time step as 1/12 and save result every time step in this case?

2. how do I calculate the average sale per year and total sale per year?
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

If you are running a monthly model I would recommend that you use time in Months setting time step to 1 or a smaller value if appropriate. To display graphs on years use a TIME BASE variable.

As far as cumulating things over years - there are no built in functions for this so you need to do things like

annual revenue = SAMPLE IF TRUE(MODULO(Time,Months per Year) = 0,cuming annual revenue,0) ~ $
cumming annual revenue = cum annual revenue + revenue * TIME STEP ~$
cum annual revenue = INTEG(IF THEN ELSE(MODULO(Time,Months per yer) = 0,-cum annual revenue/TIME STEP,0) + revenue,0) ~$

If you are into difference equations - as I am assuming you are - these are the kinds of tricks necessary. If you have a continuous view of the world then

annual revenue = MONTHS PER YEAR*smooth(Revenue,MONTHS PER YEAR) ~$/Year

time is in months for these.
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

Hi Bob, I tried to use your examples for calculating annual demand, but get the warning messags. what do these two messages mean?

annual demand = SAMPLE IF TRUE(MODULO(Time,Months per Year) = 0,cuming annual demand,0) ~ $
cumming annual demand = cum annual demand + demand * TIME STEP ~$
cum annual demand = INTEG(IF THEN ELSE(MODULO(Time,Months per yer) = 0,-cum annual demand/TIME STEP,0) + demand,0) ~$

WARNING: ACTIVE INITIAL differences found. Use Options>Setting to control reporting.
WARNING: -annual demand 1- Initial=0 Active=925685 has changed in value.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Hi,

the warnings indicate that the time 0 computation for annual demand has changed from the value used to initialize other variables. You can use

SAMPLE IF TRU(MODULO(time,months per year) = 0 :AND: Time > INITIAL TIME ...

alternatively iniitlize it to a different value if that is important - this can get complicated as you may need to do things to avoid simultaneous initial conditions.
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

hello again,

my result of annual demand always stay 0 or the number i put in the equation in this case, but i could not figure out what the problems is.

what is the difference between sample in true and if then else?

the examples about sample if true in the manual are not helpful.

max workforce = SAMPLE IF TRUE(Workforce > max workforce,
workforce,workforce)

starting cash = SAMPLE IF TRUE(MODULO(Time,12) <.5, cash, cash)
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

SAMPLE IF TRUE is a dynamic function - like a level it changes only over time, but unlike a level it jumps whenever the condition is true rather than integrating its inputs.

If it never changes probably your condition is never true - if you are using years with a time step of 1/12 you should use the formualtion

MODULO(Time,Unit Year) < TIME STEP/2

if you use

MODULO(Time,Unit Year) = 0

it will never be true because 1/12 is not a power of 1/2.
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

I managed to have seasonal variation in a model which unit of time is year. However, I am confused by another question.

Please have a look at the attached file and tell me if it is correctly to know how many labors are required every month by dividing monthly demand by working hour. Shoud the working hour be 120 hours/month or 2080hours/year in this case?
Attachments
example.mdl
(1.88 KiB) Downloaded 1194 times
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

seasonal variation

Post by LAUJJL »

Joined a model with the right units and equations.
There is no link from the level to the rate.
I do not know if you have more then Vensim P.L. it should be readable in that version.

Pay attention to the units.
Regards.
J.J. Laublé
Attachments
example2.mdl
(3.06 KiB) Downloaded 1022 times
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

seasonal variation

Post by LAUJJL »

a small bug in the example2.mdl

joined the new version example3
Attachments
example3.mdl
(3.04 KiB) Downloaded 1245 times
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

Thanks for joining the discussion.

The units of time in example 2 and example 3 are month, not year. Please have a look at the attached file. What I want is a model with year as unit of time, but have home seasonal variation on demand to result in different labor or capacity required. What I am confuesd is the time unit of variables after the part of total labor cost, such as total production cost, price, etcs. Hope you are not confused by me. Please tell me know if I am doing correctly.
Attachments
example4.mdl
(4.36 KiB) Downloaded 1211 times
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

seasonal variation

Post by LAUJJL »

I have made a small change, so that the lokkups has 12 values instead of 13, and the month counter is right and goes from 1 to 12, instead from 0 to 11.

Now the real problem is about the loop labor required, total labor cost, total production cost, that is not clear.
If the demand is increasing, the total cost is increasing but not the single cost of a widget. That cost as stated is stable
in the time, and I do not see the justification of the influence of the demand on price through this loop.
Secondly, what sort of inflence has the demand on price with the second loop, using the shadow variable monthly demand?

Is it the fact that the demand increasing and causing a shortage, the price can be increased?

Things need to be more clear to my opinion before getting on.
Regards.

J.J. Laublé
Attachments
example5.mdl
(4.41 KiB) Downloaded 1496 times
sintef
Member
Posts: 21
Joined: Mon Nov 15, 2004 7:52 pm

Post by sintef »

Thanks for the prompt reply.

The example model is just a rough idea, and I will post the more detailed one when it is improved.

Currently, what I want to know from the example model is if it is correct to say the time base for variables such as labor required and total labor cost becaomes month, rather than year, although the unit of time of the model is year and the time step is 0.01. Could I accumulated 1 unit of time, year, to know how much labor costs per year?

Hope my question is clear to be understood.
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

seasonal variations

Post by LAUJJL »

Hi Sintef

I have never used until now the time base function.
I have looked at the definition, which is not very clear.
I have not found where it is well explained or in what model
example it is used.

The examples shown int the time base function do not explain even the usefulness of the notion and when to use it.

If your question is about time base function and time base variable, it is better to ask Bob or an administrator who know much better than me.

J.J. Laublé
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

The TIME BASE function is used only for display. You do not need this to convert from an annual to a monthly number. Using a continuous formulation

monthly demand = annual demand / months per year

or

annual demand = monthly demand * months per year

This is what you need to do anytime you want to change units. It is generally best practice to put all times in the same units (ie choose year or choose month and stick to it). There are exceptions, but not doing so can easily lead to confusion.

I would recommend that you build you model with time units months. What you have called "Annual Demand" is not correctly named. It should be "Underlying Reference Demand." At a minimum you should look at the Molecules to understand the anchoring and adjustment concepts.
Post Reply