Adding macros to vensim

Use this forum to post Vensim related questions.
Post Reply
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Adding macros to vensim

Post 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?
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Adding macros to vensim

Post 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?
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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?
Attachments
simple model.mdl
(4.52 KiB) Downloaded 162 times
Screenshot (30).png
Screenshot (30).png (109.45 KiB) Viewed 4986 times
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Adding macros to vensim

Post 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.
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
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Adding macros to vensim

Post 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.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Adding macros to vensim

Post 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).
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Adding macros to vensim

Post 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.
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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.
neelu@nitw.ac.in
Member
Posts: 23
Joined: Thu Mar 22, 2018 9:56 am
Vensim version: DSS

Re: Adding macros to vensim

Post 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
Post Reply