MODULO function problem

Use this forum to post Vensim related questions.
Post Reply
Huda
Junior Member
Posts: 3
Joined: Mon Apr 30, 2018 8:15 pm
Vensim version: PLE

MODULO function problem

Post by Huda »

A look up function was made for "EVs Average Mileage per KWh" where the miles increases every year so in the first year we have assumed an average driver will drive 50,000 km and in the 2nd year it will be 100,000 km and so on.
I want the mileages to increase every year so I used the funtion <year> with MODULO (year,1) and connected it to "Cost of EVs Opertion" that includes this formula (EVs Price Per KWh*(EVs Average Mileage per KWh(Yearly))

But it is giving me incorrect results.... For example for the first year it increases exponentially then decrease ...and I dont know how to fix it
Attachments
EDITEDfinalOneDYN.mdl
(11.83 KiB) Downloaded 195 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: MODULO function problem

Post by tomfid »

Why are you using MODULO? Seems like it would only make sense if your time step were much smaller than a year. As is, it just oscillates from 0 to 0.5 because your time step is 0.5. It appears that you could simply use "time" directly.
Huda
Junior Member
Posts: 3
Joined: Mon Apr 30, 2018 8:15 pm
Vensim version: PLE

Re: MODULO function problem

Post by Huda »

Thaank you for your reply but the time step is actually 1 but I guess I inputted 0.5 by mistake. However, if I kept it 1 then I will have a constant value for "Cost of EVs Opertion which does not make sense because it has to change every year
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: MODULO function problem

Post by tomfid »

Right. MODULO is behaving correctly. Any integer modulo 1 is 0. Any lookup given a constant input will have a constant output.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: MODULO function problem

Post by tomfid »

Huda
Junior Member
Posts: 3
Joined: Mon Apr 30, 2018 8:15 pm
Vensim version: PLE

Re: MODULO function problem

Post by Huda »

Okay, so maybe am using MODULO in the wrong way because what am trying to do is change the EVs Average Mileage per KWh every year using look up function ....but how to demonstrate this without using MODULO ? Thank you

[(0,0)-(50,2e+08)],(0,50000),(1,100000),(2,150000),(3,200000),(4,250000),(5,300000),(6,350000),(7,400000),(8,450000),(9,500000),(10,550000),(11,600000),(12,650000),(13,700000),(14,750000),(15,800000),(16,850000),(17,900000),(18,950000),(19,1e+06),(20,1.5e+06),(21,2e+06),(22,2.5e+06)
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: MODULO function problem

Post by tomfid »

Just use mylookup(time).
Post Reply