Can’t retrieve value from previous time step.
I am doing a energy storage and transport project in simulink in matlab. It is formed by a file which contains constant variables and an interactive model that attempts to simulate the flow of energy of this sytem, this is possible because inside of this model formulas and calculations can be implemented. The system consist of 5 blocks. Transport to supply, injection, storage, extraction, transport to demand, inside of each block you add the different formulas/calculations. The system also accounts for power losses. I am stuck in the storage subsystem.
I have a function block that simulates the storage. I have as inputs some constants and the variable power supply from a data file. I have as outputs the energy lossses and the energy storage. My type of storage is a water thermal battery (very simple). I have time step of 5mins, which means that there is a point every 5 mins, in the data file time there is data for 525600 minutes (one year). Every time step energy is added tothe storage, raising the temperature, the thing is in my code i can only take into account the enegy of the storage at that time step. I would like to retrieve the temperature of the previous step and add it to the new one, like this i will have the energy being stored in the system, but i dont know how to do this.
function [DStorage, EdotStorage]= Storage(PtoStorage, PfromStorage, kWater,TEnv, tankheight, tankradius, mwateronetank,cWater, ITank)
PreviousT = 0; %This should retrieve me the temperature of the tank in the previous time step, or the output from the previous step is even fine (from here I can calculate the temperature rise, make it a variabe and add it ot "Atank")
ATank= 2*pi*tankradius*(tankradius+tankheight); %Area of the tank
Ttank= TEnv + ((PtoStorage/125)/((mwateronetank)*cWater)) + PreviousT ; %Actual temperature of each tank
Dofonetank = ((kWater* ATank * ((Ttank-TEnv))/ITank)); %Power loss due to conduction in one tank
DStorage= Dofonetank*125; %Power loss due to conduction in all tanks
EdotStorage = PtoStorage – PfromStorage – DStorage; %Amount of energy in the storageI am doing a energy storage and transport project in simulink in matlab. It is formed by a file which contains constant variables and an interactive model that attempts to simulate the flow of energy of this sytem, this is possible because inside of this model formulas and calculations can be implemented. The system consist of 5 blocks. Transport to supply, injection, storage, extraction, transport to demand, inside of each block you add the different formulas/calculations. The system also accounts for power losses. I am stuck in the storage subsystem.
I have a function block that simulates the storage. I have as inputs some constants and the variable power supply from a data file. I have as outputs the energy lossses and the energy storage. My type of storage is a water thermal battery (very simple). I have time step of 5mins, which means that there is a point every 5 mins, in the data file time there is data for 525600 minutes (one year). Every time step energy is added tothe storage, raising the temperature, the thing is in my code i can only take into account the enegy of the storage at that time step. I would like to retrieve the temperature of the previous step and add it to the new one, like this i will have the energy being stored in the system, but i dont know how to do this.
function [DStorage, EdotStorage]= Storage(PtoStorage, PfromStorage, kWater,TEnv, tankheight, tankradius, mwateronetank,cWater, ITank)
PreviousT = 0; %This should retrieve me the temperature of the tank in the previous time step, or the output from the previous step is even fine (from here I can calculate the temperature rise, make it a variabe and add it ot "Atank")
ATank= 2*pi*tankradius*(tankradius+tankheight); %Area of the tank
Ttank= TEnv + ((PtoStorage/125)/((mwateronetank)*cWater)) + PreviousT ; %Actual temperature of each tank
Dofonetank = ((kWater* ATank * ((Ttank-TEnv))/ITank)); %Power loss due to conduction in one tank
DStorage= Dofonetank*125; %Power loss due to conduction in all tanks
EdotStorage = PtoStorage – PfromStorage – DStorage; %Amount of energy in the storage I am doing a energy storage and transport project in simulink in matlab. It is formed by a file which contains constant variables and an interactive model that attempts to simulate the flow of energy of this sytem, this is possible because inside of this model formulas and calculations can be implemented. The system consist of 5 blocks. Transport to supply, injection, storage, extraction, transport to demand, inside of each block you add the different formulas/calculations. The system also accounts for power losses. I am stuck in the storage subsystem.
I have a function block that simulates the storage. I have as inputs some constants and the variable power supply from a data file. I have as outputs the energy lossses and the energy storage. My type of storage is a water thermal battery (very simple). I have time step of 5mins, which means that there is a point every 5 mins, in the data file time there is data for 525600 minutes (one year). Every time step energy is added tothe storage, raising the temperature, the thing is in my code i can only take into account the enegy of the storage at that time step. I would like to retrieve the temperature of the previous step and add it to the new one, like this i will have the energy being stored in the system, but i dont know how to do this.
function [DStorage, EdotStorage]= Storage(PtoStorage, PfromStorage, kWater,TEnv, tankheight, tankradius, mwateronetank,cWater, ITank)
PreviousT = 0; %This should retrieve me the temperature of the tank in the previous time step, or the output from the previous step is even fine (from here I can calculate the temperature rise, make it a variabe and add it ot "Atank")
ATank= 2*pi*tankradius*(tankradius+tankheight); %Area of the tank
Ttank= TEnv + ((PtoStorage/125)/((mwateronetank)*cWater)) + PreviousT ; %Actual temperature of each tank
Dofonetank = ((kWater* ATank * ((Ttank-TEnv))/ITank)); %Power loss due to conduction in one tank
DStorage= Dofonetank*125; %Power loss due to conduction in all tanks
EdotStorage = PtoStorage – PfromStorage – DStorage; %Amount of energy in the storage storage, tank, water, energy, temperature MATLAB Answers — New Questions