-1

In my model i have the evolution of a variable lets say the electric power during time and i want to calculate the summation of the total electric power during the simulation time ,if anyone have an idea of how i will be thankfull.

1 Answers1

3

The best choice would be to declare a variable with a meaningful name say energy and in the equation section of model's top-level assign der(energy)= electricPower. This will give you the continuous summation of electric power variable or otherwise integrate the power variable across the simulation stop time.

Akhil Nandan
  • 315
  • 2
  • 9
  • Thank you @Akhil for your answer it is really helpful, just i want to clarify that i want the result to be one total number, let's say I have the instantaneous variation of the power consumed by an electric device during 4 hours and I want to find the total of the consumed power. – Dahmani Merzaka Oct 31 '22 at 11:29
  • I believe it is a post processing average operation you have to perform on the instantaneous results you obtain from simulation. In `Dymola` you can use this by using `Signal Operators`----> `Arithematic Mean`. In case you are using `OpenModelica` please export the variable into `CSV` file and do postprocessing using a third-party spreadsheet tool like LibreOffice calc or MS Excel. – Akhil Nandan Oct 31 '22 at 11:41
  • You mean i export the power values or the der(power) as a csv value to an excel sheet and do the summation there????????? – Dahmani Merzaka Nov 04 '22 at 12:09
  • From your problem statement I understood you are interested in `energy`. So based on that my answer would be to see the final value of energy value at the end of the simulation. Now if you don't want to do this coding, you can always find the average of `power` variable and multiply with 4 hours to obtain Energy consumed value. – Akhil Nandan Nov 05 '22 at 07:14