Page 1 of 1

Adding macros to vensim

Posted: Tue Feb 18, 2020 12:36 pm
by neelu@nitw.ac.in
is it possible to add a macro program in Vensim so that production variable is changed a number of times within a time step?

Re: Adding macros to vensim

Posted: Tue Feb 18, 2020 2:14 pm
by tomfid
You might be able to do this with the SIMULTANEOUS function, or by using an array dimension as a virtual time axis.

What's the reason for doing this?

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 7:29 am
by neelu@nitw.ac.in
please find the attached files.
I Have some questions about the model.

is the model is ok?

at the initial stage ( 0 months) demand is 300 and shipment is 50 the backorders are showing 0 instead of 250. this 250 has appeared in next month. if I want to get that 250 in the current month in an accumulation mode, how can I get it?
Similarly, FGI is equal to the production rate - shipment[/list][/list]

shipment is showing 50 due to the initial value of FGI is 50 but once shipment happens it becomes 0, please look in this issue.

Demand is 300 units /month, the production rate is also varies based on a cycle time suppose the products are taking 2 months as production time how can i use the delay function in this model?

Demand is 300 units/month but i want to get the production rate in terms of weeks like 1st week, 2nd-week production so that before completion of the month my required demand should be completed. is this possible?

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 9:54 am
by LAUJJL
HI

Goto model, settings and change units and check 'use strict testing' and afterwards test unit dimension. you will see 7 unit errors. Correct them and it may reveal your error.

Regards.

JJ

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 10:09 am
by neelu@nitw.ac.in
LAUJJL wrote: Wed Feb 19, 2020 9:54 am HI

Goto model, settings and change units and check 'use strict testing' and afterwards test unit dimension. you will see 7 unit errors. Correct them and it may reveal your error.

Regards.

JJ
This is not clear for my questions

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 10:18 am
by LAUJJL
Hi

The basic for good modeling is to have no unit errors; If you set model>setings>use strict testing' it will tell you your unit errors. Correct these unit errors and it may help you to find the other error.

Regards.

JJ

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 10:46 am
by neelu@nitw.ac.in
LAUJJL wrote: Wed Feb 19, 2020 10:18 am Hi

The basic for good modeling is to have no unit errors; If you set model>setings>use strict testing' it will tell you your unit errors. Correct these unit errors and it may help you to find the other error.

Regards.

JJ
that's ok sir, but please answer to my another questions

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 11:57 am
by Administrator
JJ is trying to help you. If you fix the errors, it will help.

We will not fix the model for you, but we do help you to fix it yourself.

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 12:14 pm
by neelu@nitw.ac.in
I am very sorry sir, I am not asking you to fix the model but I want to know whether mentioned issues can we fix in Vensim or not?
if it is possible can you please explain sir

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 3:00 pm
by tomfid
If you're interested in weekly dynamics, it seems like it would be easier to run the model in weeks.

I think the unit errors are closely related to the conceptual issues you're asking about. For example, you have:
production rate = start rate/cycle time
that transforms units/month into units/month/month, which doesn't make sense. Also, the rate-to-rate connection essentially makes the WIP stock superfluous. The simplest possible first-order equivalent would be:
production rate = WIP/cycle time
If you want to use a higher-order delay, you could use:
production rate = DELAY FIXED(start rate, cycle time, initval)
But again, if cycle time = time step = 1 month, the stock dynamics don't make any difference.

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 3:02 pm
by tomfid
Your shipment equation also contains a unit error:
MIN((Back orders/delivery delay+Demand), FGI )
This takes MIN( units/month , units ) which is inconsistent. You don't need strict checking to discover this; you just need to correct the missing unit in delivery delay first (but JJ is right).

Re: Adding macros to vensim

Posted: Wed Feb 19, 2020 3:04 pm
by tomfid
If you run the model in weeks, but you want shipments to happen discretely every 4th week, you can use PULSE TRAIN as a trigger for the shipments.

Re: Adding macros to vensim

Posted: Thu Feb 20, 2020 7:31 am
by neelu@nitw.ac.in
tomfid wrote: Wed Feb 19, 2020 3:04 pm If you run the model in weeks, but you want shipments to happen discretely every 4th week, you can use PULSE TRAIN as a trigger for the shipments.

Re: Adding macros to vensim

Posted: Thu Feb 20, 2020 7:33 am
by neelu@nitw.ac.in
neelu@nitw.ac.in wrote: Thu Feb 20, 2020 7:31 am
tomfid wrote: Wed Feb 19, 2020 3:04 pm If you run the model in weeks, but you want shipments to happen discretely every 4th week, you can use PULSE TRAIN as a trigger for the shipments.
Thank you very much sir