I have a flow that can either 650 or zero depending on other conditions. I need to calculate the longest period where the flow remains zero.
e.g. 650,650,0,0,0,650,0,0,0,0,0,650,0,0 the answer would be 5 (days in my case).
I have PLE Plus is there a way to code this?
Thanks
longest run of zeros
-
- Junior Member
- Posts: 11
- Joined: Sat Apr 21, 2018 5:14 am
- Vensim version: PLE+
-
- Junior Member
- Posts: 11
- Joined: Sat Apr 21, 2018 5:14 am
- Vensim version: PLE+
Re: longest run of zeros
I realise how I can solve this.
But I need to reset a level to zero after the data stream changes back to 650 (having accumulated the count of zeros in another variable).
I can't find a way to do this, is there a reset variable command?
But I need to reset a level to zero after the data stream changes back to 650 (having accumulated the count of zeros in another variable).
I can't find a way to do this, is there a reset variable command?
-
- Junior Member
- Posts: 11
- Joined: Sat Apr 21, 2018 5:14 am
- Vensim version: PLE+
Re: longest run of zeros
Got it:
Used IF THEN ELSE to catch when zero stream started and count it. Used SAMPLE IF TRUE to find the maximum length of the counted stream.
Thanks
Used IF THEN ELSE to catch when zero stream started and count it. Used SAMPLE IF TRUE to find the maximum length of the counted stream.
Thanks
Re: longest run of zeros
joined a model to reset a level to 0. Does not use the sample if true, normally not available in PLE plus.
- Attachments
-
- resetting.vpm
- (19.65 KiB) Downloaded 183 times
-
- Junior Member
- Posts: 11
- Joined: Sat Apr 21, 2018 5:14 am
- Vensim version: PLE+
Re: longest run of zeros
Thanks LAUJJ
that cleaned it up!
that cleaned it up!