How to run my code for selective interval of values?

I have got washing machine to predict hot water consumption which is to be translated in energy use. So far I have got a code that goes through washing machine water consumption of 28 households. But I want to exclude the cold water consumption for rinsing.
Here is the code:
results=zeros(86401,1); % plot in seconds for activity 4. Washing machine
for i=1:28,
currentFlowArray=allFileMin(i).demand_pattern1.Wm.total.flowArray;
for p=1:86400,
results(p)=results(p)+ currentFlowArray(p);
end
end
So I want to exclude the second half of the values (assuming it is for cold water) in:
allFileMin(i).demand_pattern1.Wm.total.flowArray
How is this possible?
Thanks!

2 commentaires

Amit
Amit le 24 Jan 2014
what do you mean by second half?
For each 28 household i=1:28
allFileMin(i).demand_pattern1.Wm.total.flowArray
I have values for water consumption of waching machine. For my calculations I want to include half of the consumption of the washing machine of each household.

Connectez-vous pour commenter.

Réponses (1)

Amit
Amit le 24 Jan 2014
Do you mean something like this:
results=zeros(86401,1); % plot in seconds for activity 4. Washing machine
for i=1:28,
currentFlowArray=allFileMin(i).demand_pattern1.Wm.total.flowArray;
% Actually the looping can be omitted
% for p=1:86400/2 % Divide by half
results(1:86400/2)=results(86400/2)+ currentFlowArray(86400/2);
%end
end

8 commentaires

Darina
Darina le 24 Jan 2014
Hm in this case 86400 are seconds of a whole day. Dividing it like you propose means that the program runs only for half of the day, while values for the next half of the day are ignored. While I want to extract values located in demand_pattern1.Wm.total.flowArray;
Amit
Amit le 24 Jan 2014
That's what my question was. You said you wanted to include half of the consumption. How do you know when its hot water versus cold water. This part you did not specified in your question.
Darina
Darina le 24 Jan 2014
Yes, I mean half of the consumption of washing machine. But each washing machine is used at different time of the day. So excluding the evening does not work in my case.
Well I assume that 50% of the water consumption per washing machine is warm water, the other 50% -cold.
Amit
Amit le 24 Jan 2014
so allFileMin(i).demand_pattern1.Wm.total.flowArray, every data point means the amount of water consumption for that point?
Darina
Darina le 24 Jan 2014
yes, and of cource at certain time period there can be working more than one washing machine. And for instance if p=1:180:86400, then for the intervals of 180second all the washing maching working that interval are excluded. But I dont want this, since the cycles of each washing machine is different due to different starting time.
Amit
Amit le 24 Jan 2014
wouldn't 0.5*currentFlowArray will change the water flow at that time into half.
The problem is that there is not a lot of info regarding the machine, when its on, how much water gets used in each cycle etc.
Darina
Darina le 24 Jan 2014
Adding 0.5 basicaly reduces the total water consumption by half.
Attached you can see water consumption per one household. At Every second about 0.1667l/s are used from the washing machine, and the total water consumption of washing machine is about 50l. When I add 0.5 it reduces the consumption down to 0.08l/s and about 25l for the total. The start time of the machine is randomized, but still clustered about mornings and evenings.
Darina
Darina le 24 Jan 2014

Connectez-vous pour commenter.

Question posée :

le 24 Jan 2014

Commenté :

le 24 Jan 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by