demand and supply at price

Use this forum to post Vensim related questions.
kong17
Senior Member
Posts: 60
Joined: Wed May 30, 2018 1:12 pm
Vensim version: PRO

Re: demand and supply at price

Post by kong17 »

Hi,

I have solved the question that I asked above and there is only one demander.
but when I discretize the demand into multiple segments to represent different needs at different times of every year, and each segment should be equalibrium.
the model reports an error, but I don't know how to solve it.
I uploadded a simple example, I was wodering what's wrong with it?
Thank you very mcuh!

Best wishes
Attachments
EXAMPLE.mdl
(4.87 KiB) Downloaded 155 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

If you step through the elements of "priority vector" you will find that the first element has [duration,supplier,ptype] and the next has [duration,supplier,pprofile]. That doesn't work because pprofile is the range. If you replace it with the element ppriority it should work.
kong17
Senior Member
Posts: 60
Joined: Wed May 30, 2018 1:12 pm
Vensim version: PRO

Re: demand and supply at price

Post by kong17 »

tomfid wrote: Tue Jan 21, 2020 5:41 am If you step through the elements of "priority vector" you will find that the first element has [duration,supplier,ptype] and the next has [duration,supplier,pprofile]. That doesn't work because pprofile is the range. If you replace it with the element ppriority it should work.
Hi, thanks.
that is my mistake.
Now the model can running, but it did not achieve the results I thought, the each segment can reach the supply-demand equlibrium at a certain market price. Is there a problem with my subscript usage or a problem with subscript setting? So, I have so many questions.
Attachments
EXAMPLE.mdl
(4.94 KiB) Downloaded 159 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

You've mixed up the subscripting by deleting the "demander" dimension. Therefore FIND MARKET PRICE is iterating over suppliers on one side of the market, and durations on the other side.

The solution is to preserve the demander range, with length 1:

Code: Select all

demander : total
Then use that in the demand variables:

Code: Select all

FIND MARKET PRICE(demand[duration,total], demand priority vector[duration,total,ptype] 
,supply capacity[Coal], priority vector[duration,Coal,ptype])

DEMAND AT PRICE( demand[duration,demander], demand priority vector[duration,demander,ptype] ,market price[duration])

demand priority vector[duration,demander,ptype]=
	demand priority type ~~|
demand priority vector[duration,demander,ppriority]=
	demand priority[duration] ~~|
demand priority vector[duration,demander,pwidth]=
	demand priority width ~~|
demand priority vector[duration,demander,pextra]=
	extra
You can compute the net demand-supply as a check (should be 0 for each duration):

Code: Select all

SUM(amount demanded[duration,demander!])-SUM(amount supplied[duration,supplier!])
kong17
Senior Member
Posts: 60
Joined: Wed May 30, 2018 1:12 pm
Vensim version: PRO

Re: demand and supply at price

Post by kong17 »

tomfid wrote: Tue Jan 21, 2020 3:52 pm You've mixed up the subscripting by deleting the "demander" dimension. Therefore FIND MARKET PRICE is iterating over suppliers on one side of the market, and durations on the other side.

The solution is to preserve the demander range, with length 1:

Code: Select all

demander : total
Then use that in the demand variables:

Code: Select all

FIND MARKET PRICE(demand[duration,total], demand priority vector[duration,total,ptype] 
,supply capacity[Coal], priority vector[duration,Coal,ptype])

DEMAND AT PRICE( demand[duration,demander], demand priority vector[duration,demander,ptype] ,market price[duration])

demand priority vector[duration,demander,ptype]=
	demand priority type ~~|
demand priority vector[duration,demander,ppriority]=
	demand priority[duration] ~~|
demand priority vector[duration,demander,pwidth]=
	demand priority width ~~|
demand priority vector[duration,demander,pextra]=
	extra
You can compute the net demand-supply as a check (should be 0 for each duration):

Code: Select all

SUM(amount demanded[duration,demander!])-SUM(amount supplied[duration,supplier!])
Yes, it is solved. Thank you very much.
Post Reply