demand and supply at price

Use this forum to post Vensim related questions.
sosorior
Junior Member
Posts: 16
Joined: Mon Oct 28, 2013 8:11 pm
Vensim version: DSS

demand and supply at price

Post by sosorior »

I'm trying to allocate some capacity within some buyers at a certain price. I tried to do it by using the functions DEMAND AT PRICE and SUPPLY AT PRICE, but sincerely I don't get to do it. It is the typical problem of building a supply curve and dispatching by merit order, such as happens in electricity markets.
For example, let's suppose I have 3 suppliers (a,b,c) with certain capacities and prices at which they sell.
Capacities(suppliers): 500, 300, 700
Cost(suppliers): 1,2,3
Also, suppose 2 buyers who need a certain amount (capacity) and are willing to pay a maximum price for it
Demand(buyers): 600, 500
Price(buyers):3,4
Then, the solution should be: allocated capacity: 500, 300, 300 and price: 3
The problem when using the mentioned functions is that i don't know how to use the pprofile functions in order to indicate the priorities of dispatch and where to include the prices.
Do you have and example that works for both supply and demand functions (and for FIND MARKET PRICE), or something that could be useful to solve this problem.
Thank you
Attachments
demand at price.mdl
(2.62 KiB) Downloaded 282 times
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: demand and supply at price

Post by Administrator »

Have you looked at the examples in the Vensim help system? There is a whole section on allocation (including sample models)

http://www.vensim.com/documentation/ind ... erview.htm
http://www.vensim.com/documentation/ind ... _price.htm
http://www.vensim.com/documentation/ind ... _price.htm
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
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

For a situation in which supply and demand are relatively constant, up to fixed willingness to pay/sell, you probably want a rectangular distribution (ptype=1) with a narrow pwidth (i.e. pwidth is smaller than the variation in prices across suppliers).

Another possibility would be to use a linear program via an external function. See http://vensim.com/workbench/#lp-solve-link
sosorior
Junior Member
Posts: 16
Joined: Mon Oct 28, 2013 8:11 pm
Vensim version: DSS

Re: demand and supply at price

Post by sosorior »

Finally I got it to work, thank you.
It seems that when formulating the vector of priority, we should use the prices in a positive way. It is different to ALLOCATE BY PRIORITY, where you should use the prices with negative sign in order to give a higher priority to those producer with cheaper marginal costs.
I attach one simple example of FIND MARKET PRICE, ALLOCATE AT PRICE, DEMAND AT PRICE for whom is interested.
Attachments
demand at price.mdl
(3.26 KiB) Downloaded 294 times
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

Hi,
I would like to ask a question which is related to this post.
I want to do dispatch of power plants with Vensim itself. Assume that I have 3 power plants with specific price(a1,a2,a3) and capacity(b1,b2,b3). They take part in one auction for satisfying the demand(D). Power plants will be sorted based on their price. With this dispatch I want to find winner of each auction. Can I ask you that is it possible to model such this auction with vensim when priority is cheapest price?
Best Regards,
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

Yes, that kind of thing can be done. You can also use FIND ZERO for a more general solution to simultaneous problems. There's a sample model for each included in the Help system.
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

tomfid wrote: Fri May 03, 2019 3:13 pm Yes, that kind of thing can be done. You can also use FIND ZERO for a more general solution to simultaneous problems. There's a sample model for each included in the Help system.
Thank you. I modelled it with ALLOCATE AVAILABLE function. But still I want to know how to define priority dynamicly that power plants with cheaper price can have higher priority. Can I use VECTOR RANK function for it?
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

My model is an hourly based model which simulates electricity market for 35 years. I want to model the auction of technology X only three times per year and winners of auction X can be able to sell their energy for 10 years. Looser of auction X will sell their energy without any premuim, but they have chance for winning in these auction and getting 10 years previlege in next round of these especial auctions.
Firstly ,can you help me how can I model this auction three times per year in an hourly model(for example, I want to model them in first day of Jan, May and Dec).
Secondly, how can I distinguish winner and looser of each auction round? As I want to consider some premuim for winner for 10 years I want to seperate looser and winner of each round.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: demand and supply at price

Post by Administrator »

You'll need to create a variable that is zero or one at those three times of the year. Then use SAMPLE IF TRUE to hold the winning value until the next round.

VECTOR RANK can be used to work out which is the winner at each auction round.
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
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

Administrator wrote: Mon May 06, 2019 8:15 am You'll need to create a variable that is zero or one at those three times of the year. Then use SAMPLE IF TRUE to hold the winning value until the next round.

VECTOR RANK can be used to work out which is the winner at each auction round.
The thing is that I want the winners will be able to sell for 20 years(not only for the next round). Isn't it better to use PULSE TRAIN? I have used a pulse train function that is always 0 except three times per year.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

It sounds like we need something like an "ALLOC IF" function that's switchable, so it only executes when a flag is true.
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

tomfid wrote: Mon May 06, 2019 2:59 pm It sounds like we need something like an "ALLOC IF" function that's switchable, so it only executes when a flag is true.
I just multiplied pluse train with allocation function. Do you have any suggestion for filtering the winner and looser of each auction. I want that looser can be able to take part in further auctions and winners sell their energy for 10 yaers.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

You could use a stock or SAMPLE IF TRUE to identify the winner and set their quantity to 0, or priority very low, for future auctions.
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

tomfid wrote: Mon May 06, 2019 4:05 pm You could use a stock or SAMPLE IF TRUE to identify the winner and set their quantity to 0, or priority very low, for future auctions.
Thanks. I still get this error for a part of model which is related to ALLOCATE AVAILABLE function:
"Error in ALLOCATE_AVAILABLE/FIND_MARKET_PRICE - subscript range error in request quantity"
Do you have any idea why I encounter this?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

I'd have to see the relevant equations.
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

tomfid wrote: Mon May 06, 2019 5:56 pm I'd have to see the relevant equations.
The problem is that, this ranking is being done for a subrange. However, these functions are not suitable for ranking subrange. Do you have any idea how to rank subranges?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

I think you could map the subrange to a distinct (full) subscript range of the same size, sort that, and then map back.
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

Hi,

How can I use FIND MARKET PRICE(dq,dp,sq,sp) when I have only multi suppliers and no priority for demanders?
I get this error: Argument 2 of FIND MARKET PRICE must be a normal variable
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

"No priority" = "priority vector with all values the same" would be one option. You can't change the type of an argument from a vector to a single value.

Another, simpler option would be to use one of the one-sided ALLOC functions. In other words, add up the demands to a single value, ALLOC that across the suppliers, then give each demander a share of whatever is received, in proportion to their request.
RWTH_FCN
Senior Member
Posts: 148
Joined: Wed Feb 08, 2017 9:10 am
Vensim version: DSS

Re: demand and supply at price

Post by RWTH_FCN »

tomfid wrote: Wed Jul 03, 2019 3:19 pm "No priority" = "priority vector with all values the same" would be one option. You can't change the type of an argument from a vector to a single value.

Another, simpler option would be to use one of the one-sided ALLOC functions. In other words, add up the demands to a single value, ALLOC that across the suppliers, then give each demander a share of whatever is received, in proportion to their request.
Thanks . I found first solution quite applicable. I already used "ALLOCATE AVAILABLE" for it but how can I access price of that allocation when I am using ALLOCATE AVAILABLE?
My problem is as follows: I have n wind suppliers that they bid for providing energy to the grid. So, n suppliers and 1 demand. I want to find market clearance price and accepted amount of energy that they can bid. Priority vector is based on cheaper price.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

For some distributions, you could compute the price, but using the 2-sided allocation with a one-dimensional demand is probably easier.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

If you're OK with the rectangular distribution, you could use ALLOC P and MARKETP.
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,

Following the above question, I would like to ask.
If I have only one demander and the goal is to achieve the balance between supply and demand, how to use the find market price function.

For example, the suppliers (a,b,c) with certain capacityies and prices at which they sell.
capacities (suppliers):500,300,700
Cost (suppliers): 1,2,3
Demand changes over time. In order to achieve market clearing, the market price is equal to the cost of the most expensive capacityies. Such as, T=1, demand is 500, the price only needs 1, and when T=2, demand becomes 700, then the price should change to 2, until the demand is greater than 800, the price will be 3. It is only the situation that the supply can meet demand, if demand exceeds supply is another story.

I looked up the example of Find market price in Vesnim help. My understanding is that the example realizes how the quantity of demand changes when the price curve of supply and demand is certain, and when the price of demand is lower than the price of supply, the supplier will still not sell.

I alos tried the one-to-many Allocation available function, export the lowerest priority price for each allocation. But I didn;t succeed.
So, I was wondering how to do it?

Thank you very mcuh!
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: demand and supply at price

Post by tomfid »

It should work as you've described, if the dimensionality of demand is reduced to 1. The demand priority should be greater than the max supply priority, to ensure that demand is always fulfilled. If you want stepwise allocations, the width parameter needs to be narrow.
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: Mon Jan 20, 2020 5:19 pm It should work as you've described, if the dimensionality of demand is reduced to 1. The demand priority should be greater than the max supply priority, to ensure that demand is always fulfilled. If you want stepwise allocations, the width parameter needs to be narrow.
Yes, it is solved. Thank you for your help.
Post Reply