Random Function and Subscript
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Random Function and Subscript
Hello there,
It has been a while i've been here. Hope all is good, especially in this pandemic.
Anyway, i wolud like to ask regarding on this one issue that i got upon completing my model.
I have a variable that i have assigned to a subscript. This subscript contains 10 elements. Let me put it this way;
variable name : Generator A
subscript : Units Gen A
subscript elements : Unit 1 - Unit 10
What i want is, i want Generator A to generate at random any value ranged in Total Demand. By that, i mean each elements in Generator A will be having a random values according to the range set in Total Demand. So the output will looks like this:
Generator A
[Unit 1] 10000
[Unit 2] 12790
[Unit 3] 0
................ and so on.
I'm so looking forward to any solution that u guys can give me. Thanks in advance.
It has been a while i've been here. Hope all is good, especially in this pandemic.
Anyway, i wolud like to ask regarding on this one issue that i got upon completing my model.
I have a variable that i have assigned to a subscript. This subscript contains 10 elements. Let me put it this way;
variable name : Generator A
subscript : Units Gen A
subscript elements : Unit 1 - Unit 10
What i want is, i want Generator A to generate at random any value ranged in Total Demand. By that, i mean each elements in Generator A will be having a random values according to the range set in Total Demand. So the output will looks like this:
Generator A
[Unit 1] 10000
[Unit 2] 12790
[Unit 3] 0
................ and so on.
I'm so looking forward to any solution that u guys can give me. Thanks in advance.
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
Re: Random Function and Subscript
Is this what you mean?
Code: Select all
TOTAL DEMAND[UNIT 1] = 10000
TOTAL DEMAND[UNIT 2] = 12790
TOTAL DEMAND[UNIT 3] = 0
GENERATOR A[unit] = RANDOM UNIFORM (0, TOTAL DEMAND[UNIT], NOISE SEED)
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Re: Random Function and Subscript
That looks like what i'm looking for.
Thanks so much, Admin. I'll try to do it, and hope it works well with my model.
Thanks once again
Thanks so much, Admin. I'll try to do it, and hope it works well with my model.
Thanks once again
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Re: Random Function and Subscript
Hi there,
I think i couldn't use that solution. Here is the bigger picture of what i'm doing.
This is what i have in Total Generation
So, the idea is to have that Total Generation, let say
at Year 0 = 38,657, i want to distribute that value to all 4 technologies i have there (coal generation, gas generation, hydro generation, RE generation), randomly.
But, each technology has different subscript elements.
Coal Generation is assigned to 14 elements.
Gas Generation assigned to 25 elements.
Hydro Generation assigned to 19 elements.
RE generation is assigned to 40 elements.
Eg;
_____________________________________________________
Year 0
Total Generation = 38,657 MW
Coal Generation [Coal 1] = 1200 MW
Coal Generation [Coal 2] = 1300 MW
.
.
.
Coal Generation[Coal 14] = 2400 MW
Gas Generation[Gas 1] = 9000 MW
Gas Generation[Gas 2] = 3500 MW
.
.
.
.
Gas Generation{Gas 25] = 1200 MW
Hydro Generation[Hydro 1] = 650 MW
.
.
.
Hydro Generation[Hydro 19] = 300 MW
RE Generation[RE 1] = 150 MW
.
.
.
RE Generation[RE 40] = 100 MW
_____________________________________________________
I hope i have made a better explaination and hope that u can help me.
I think i couldn't use that solution. Here is the bigger picture of what i'm doing.
This is what i have in Total Generation
So, the idea is to have that Total Generation, let say
at Year 0 = 38,657, i want to distribute that value to all 4 technologies i have there (coal generation, gas generation, hydro generation, RE generation), randomly.
But, each technology has different subscript elements.
Coal Generation is assigned to 14 elements.
Gas Generation assigned to 25 elements.
Hydro Generation assigned to 19 elements.
RE generation is assigned to 40 elements.
Eg;
_____________________________________________________
Year 0
Total Generation = 38,657 MW
Coal Generation [Coal 1] = 1200 MW
Coal Generation [Coal 2] = 1300 MW
.
.
.
Coal Generation[Coal 14] = 2400 MW
Gas Generation[Gas 1] = 9000 MW
Gas Generation[Gas 2] = 3500 MW
.
.
.
.
Gas Generation{Gas 25] = 1200 MW
Hydro Generation[Hydro 1] = 650 MW
.
.
.
Hydro Generation[Hydro 19] = 300 MW
RE Generation[RE 1] = 150 MW
.
.
.
RE Generation[RE 40] = 100 MW
_____________________________________________________
I hope i have made a better explaination and hope that u can help me.
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
Re: Random Function and Subscript
It would help if you upload the model (it will save us guessing about what you are doing).
How do you split total generation into the four types? And then how is the total coal generation split between the 14 coal elements?
We do have some allocation functions, but it would be easier if you upload the model so we can see exactly what you are trying to do.
One other thing. I'd expect "Total generation" to be the sum of all the other generation types, not split between them.
How do you split total generation into the four types? And then how is the total coal generation split between the 14 coal elements?
We do have some allocation functions, but it would be easier if you upload the model so we can see exactly what you are trying to do.
One other thing. I'd expect "Total generation" to be the sum of all the other generation types, not split between them.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Random Function and Subscript
It sounds like you want total generation to be a fixed number, allocated among all the sources with some random noise in the individual sizes or shares. Normalization is a common way to do this:
prelim unit size[x] = 500 + RANDOM UNIFORM(-100,100,0)
prelim total size = SUM(prelim unit size[x!])
normalized unit size[x] = prelim unit size[x]*(desired total size/prelim total size)
prelim unit size[x] = 500 + RANDOM UNIFORM(-100,100,0)
prelim total size = SUM(prelim unit size[x!])
normalized unit size[x] = prelim unit size[x]*(desired total size/prelim total size)
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Re: Random Function and Subscript
Administrator wrote: ↑Mon Feb 01, 2021 7:25 am It would help if you upload the model (it will save us guessing about what you are doing).
How do you split total generation into the four types? And then how is the total coal generation split between the 14 coal elements?
We do have some allocation functions, but it would be easier if you upload the model so we can see exactly what you are trying to do.
One other thing. I'd expect "Total generation" to be the sum of all the other generation types, not split between them.
Yes, the "Total Generation" comes from an expression. Attached is the model that i'm working with. My issue is at "Maximum Demand" view.
- Attachments
-
- 1.0(a) NPV to calculate Gen Mix.mdl
- (31.7 KiB) Downloaded 141 times
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Re: Random Function and Subscript
Sorry Tom, but i couldn't get the picture of your solution there.tomfid wrote: ↑Mon Feb 01, 2021 1:37 pm It sounds like you want total generation to be a fixed number, allocated among all the sources with some random noise in the individual sizes or shares. Normalization is a common way to do this:
prelim unit size[x] = 500 + RANDOM UNIFORM(-100,100,0)
prelim total size = SUM(prelim unit size[x!])
normalized unit size[x] = prelim unit size[x]*(desired total size/prelim total size)
Do u mind to explain it further.
Once again, sorry to hassle you.
Re: Random Function and Subscript
I'm still not sure what the goal is. Can you restate?
So far it sounds like:
- each unit generates a random amount
- the sum of generation across all the units = demand
I could imagine other constraints, for example that some units are bigger than others.
So far it sounds like:
- each unit generates a random amount
- the sum of generation across all the units = demand
I could imagine other constraints, for example that some units are bigger than others.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Re: Random Function and Subscript
It's okay if the some units having bigger value than the others.
So how can i do that?
Re: Random Function and Subscript
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 80
- Joined: Sun Feb 02, 2020 5:10 am
- Vensim version: DSS
Re: Random Function and Subscript
Thank u so much, Tom!
I hope it works well with me.
But whatever it is, thank u so much for spending your precious time to help me
I hope it works well with me.
But whatever it is, thank u so much for spending your precious time to help me
Re: Random Function and Subscript
You're welcome, & good luck.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/