00001 #ifndef _SystemFreqCalculator_h_
00002 #define _SystemFreqCalculator_h_
00003 #include <fstream>
00004 #include "adevs.h"
00005 #include "ElectricalModel.h"
00006 #include "ElectricalData.h"
00007
00013 class SystemFreqCalculator:
00014 public adevs::EventListener<adevs::PortValue<BasicEvent*> >
00015 {
00016 public:
00023 SystemFreqCalculator(ElectricalModel* model,
00024 double cint = 1E-1,
00025 std::string model_name = "");
00026 void outputEvent(adevs::Event<adevs::PortValue<BasicEvent*> >, double){}
00027 void stateChange(adevs::Atomic<adevs::PortValue<BasicEvent*> >* model,
00028 double t);
00029 double getSysFreq() const { return sys_freq; }
00030 ~SystemFreqCalculator();
00031 private:
00032 const double cint;
00033 std::ofstream fout;
00034 double t_last, sys_freq;
00035 ElectricalModel* src;
00036 };
00037
00038 #endif
00039