I want to simulate the behaviour of a battery on a network. In my entry data I have a timestamp associated to a value that is a need from the network (energy speaking). I have set up two measures : Need and Production that compute for each timestamp the total need and the production (that production is dependent on variables too).
I have created a variable vCapBat for the capacity of the battery, and two measures: Overproduction and Deficit which compare the need and the production.
I would like to simulate the behaviour of the battery in that way:
But it is not so accurate, sometimes I have some overproduction that is not increasing that measure and I noticed that, if I put the RangeMax() part in a column, when there is overproduction it piles up to infinite, then the deficit makes it decrease but it has to go below the battery capacity to change the value of the whole RangeMin(), otherwise this one stays stuck at the battery capacity when the RangeMax() part > Battery capacity.