How to solve this type of equation

Use this forum to post Vensim related questions.
Post Reply
suoq87
Junior Member
Posts: 5
Joined: Mon Feb 20, 2017 5:52 pm
Vensim version: PLE

How to solve this type of equation

Post by suoq87 »

Anyone can hekps me to solve this equation to convert into VENSIM PLE?
I have to parameter which W and C
Attachments
Convert to the vensim eq PLE
Convert to the vensim eq PLE
eqVensim.JPG (12.42 KiB) Viewed 3629 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to solve this type of equation

Post by tomfid »

This isn't a dynamic problem, and therefore Vensim is not the tool of choice.

However, you could solve this in Vensim Pro/DSS, using arrays.

In PLE, you could probably simulate this by treating b as time and using a stock to do the summation.

Either way, some other tool would probably make more sense.
suoq87
Junior Member
Posts: 5
Joined: Mon Feb 20, 2017 5:52 pm
Vensim version: PLE

Re: How to solve this type of equation

Post by suoq87 »

Then how to structure the equation to make sure its loop so that it can be summation?
Attachments
try1.mdl
File Problem
(2.12 KiB) Downloaded 155 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to solve this type of equation

Post by tomfid »

1. There is no loop, because this equation has no feedback.

2. "Final" needs to be a stock. Then:

Final = INTEG( Rate, 0 )
Rate = W(b)*C(a-b+1)
a = ...
b = time
INITIAL TIME = 1
FINAL TIME = a+1

Note that FINAL TIME is > a - the stock introduces a discrete lag of one TIME STEP, so if you want Final to contain the complete sum, you have to run one step past the end.

Why not do this in a spreadsheet? Seems like it would be easier.
suoq87
Junior Member
Posts: 5
Joined: Mon Feb 20, 2017 5:52 pm
Vensim version: PLE

Re: How to solve this type of equation

Post by suoq87 »

Thank you for helping me
But I'm still have a lot of problem
The reason I don't use excel because main topic is to use VENSIM as dynamic software
Here attached model update by me and hand calculation as required result
I think still need loop since in each row not used previous data or information
Can you help me on this Mr. tomfid?
Attachments
IMG_4359.JPG
IMG_4359.JPG (1.53 MiB) Viewed 3611 times
try1.mdl
(2.22 KiB) Downloaded 146 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to solve this type of equation

Post by tomfid »

Ahh ... if the summation is also time varying, there's no practical way to do this in PLE.
suoq87
Junior Member
Posts: 5
Joined: Mon Feb 20, 2017 5:52 pm
Vensim version: PLE

Re: How to solve this type of equation

Post by suoq87 »

Can you help me complete that equation using my file because I want try to run in DSS or Professional trial version first as consider to buy that software?
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to solve this type of equation

Post by tomfid »

I really wouldn't recommend Vensim for this task, unless it's a small part of a larger dynamic model. There will be a significant inefficiency, because arrays are static. You would have to create an array with the full dimension of "a" which would then be empty 50% of the time, and there would be a lot of overhead for something that's otherwise quite simple. You could do this in Python for free with just a few lines of code, for example.

I don't have time right now, but could work out an example later today.
suoq87
Junior Member
Posts: 5
Joined: Mon Feb 20, 2017 5:52 pm
Vensim version: PLE

Re: How to solve this type of equation

Post by suoq87 »

Did you able to solve it using Python?
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to solve this type of equation

Post by tomfid »

I haven't had a chance to work up a Vensim example.

It would be easy to solve in Python, but I think this isn't really the place to discuss it.
Post Reply