Jump to content

AlexSax

Members
  • Content Count

    9
  • Joined

  • Last visited

About AlexSax

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location
    Turin, Italy
  1. I'm sorry Torsten, I forgot to say that I am simulating a DC-DC converter model consisting of a ELN sub-module and a TDF sub-module. Then there is the LSF module for the calculation of input energy and output energy which consists only of a couple of gain and integrator blocks. Actually I saw that the problem is with the simulation timestep. I was using a timestep of 10ns, which let me simulate around 0.4s of operating time before throwing the std::bad_alloc exception. Then I used a timestep of 100ns, and the simulated time raised to around 4s, and finally with a timestep of 1us I was able to simulate 10s, which was my target. I tried also without tracing any signal, but this had no effect. The weird thing for me was that when I tried to simulate only the converter model without the LSF module, I was able to simulate 10s of operation with timestep of 10ns and no exception was thrown. Does the LSF solver save in memory all or most of the samples of the simulation? Thank you for the suggestion about the integration, I completely forgot about the LTF in TDF, which probably is a more efficient approach.
  2. Hi all, I am using an LSF module consisting of a gain and integrator blocks only for calculating input and output energy of a simple ELN module. When I try to simulate a long period of time I notice that the physical memory used by the process continues to increase up to the point that the simulation is stopped due to the following exception: Error: (E549) uncaught exception: std::bad_alloc In file: ../../../../src/sysc/kernel/sc_except.cpp:98 In process: sca_implementation_0.cluster_process_0 That is probably due to the fact that there is no more free physical memory on my machine. I noticed that commenting the LSF module the simulation goes on till the end. Why LSF uses so much memory, more than ELN for example? I used LSF only because I needed the integrator block to integrate the power over time, so can I use the other MoCs to perform the same computation? Maybe by using TDF and some numerical integration method? Thanks much! Alessandro
  3. Hi all, I have a doubt about the sca_sampling tracing mode. I have implemented a TDF module that performs an approximate integral of an input signal with the rectangle method and another TDF module that generates the input signal values with a timestep of 1US. I tried to trace the integrated signal using a tabular format and the function sca_sampling with a sampling time of 50NS(smaller than the TDF timestep), and I was expecting the samples having the same values between each US. On the contrary, I obtained the signal behavior as it has been sampled each 50NS. Does it mean that the TDF modules are activated every 50NS rather than every 1US? Does it happen like that because the time resolution is 1PS, smaller than both TDF and trace sampling timesteps? Thank you very much. Alessandro
  4. I found this tutorial complete and really useful for starting with SystemC AMS. I appreciated especially the provided examples and labs with solutions. Are available also the pdf files of the video presentations? Thank you very much. Regards, Alessandro
  5. You're right Torsten, thank you very much! Best regards, Alessandro
  6. Hello everyone, I am implementing a module using LSF primitives and I need to add a signal to a constant value (a parameter of such module). The first solution that came to my mind was to use a sca_tdf_source element but then I would need a tdf_module only for this constant value. Then I thought of forcing a sca_lsf::sca_source element to provide a constant source signal as follows: Vref("Vref", Vref_, 0.0, Vref_, 0.0, M_PI/2) where Vref_ is the constant value. Could it work this way? Best regards, Alessandro
  7. Thank you very much Torsten, following your suggestion the simulation works! And thank you also for the reminder about the destructor :-) Best regards, Alex
  8. Hi everybody, I am trying to simulate a simple RLC circuit usin ELN moc but I got the following error message: Error: SystemC-AMS: Initialization equation system failed in sca_linear_solver_0: 4 The error is in the following net (max. 50): rlc1.Vsc rlc1.Isc rlc1.Racc rlc1.Ls rlc1.Cacc The error is may be near: rlc1.Ls and rlc1.n2 In file: ../../../../../../src/scams/impl/solver/linear/sca_linear_solver.cpp:1619 In process: sca_implementation_0.cluster_process_0 @ 0 s I inject a current into the circuit with a TDF isource and then I want to obtain the circuit voltage with a vsink in parallel. Does anybody know where is the problem, please? Here you can see the main: #include "systemc-ams.h" #include "rlc.h" #include "const_load.h" int sc_main(int argc, char* argv[]) { // Connecting signals sca_tdf::sca_signal<double> Isc, Vsc; // Instantiation of supercapacitor components rlc rlc1("rlc1"); const_load load("load"); // Port binding rlc1.in(Isc); rlc1.out(Vsc); load.out(Isc); // Tracing sca_util::sca_trace_file* atf = sca_util::sca_create_tabular_trace_file( "test_trace.dat" ); sca_util::sca_trace( atf, Vsc, "Vsc" ); sca_util::sca_trace( atf, Isc, "Isc" ); sc_start(10, sc_core::SC_SEC); // sc_start(); sca_util::sca_close_tabular_trace_file( atf ); return 0; } rlc.h: #include <systemc-ams> SC_MODULE (rlc) { // Interface and internal components declaration sca_tdf::sca_in<double> in; // Isc sca_tdf::sca_out<double> out; // Vsc sca_eln::sca_tdf::sca_isource *Isc; sca_eln::sca_tdf::sca_vsink *Vsc; sca_eln::sca_node n1, n2, n3; sca_eln::sca_node_ref gnd; sca_eln::sca_r *Racc; sca_eln::sca_c *Cacc; sca_eln::sca_l *Ls; SC_CTOR (rlc) : n1("n1"), n2("n2"), n3("n3") { // Output voltage instantiation Vsc = new sca_eln::sca_tdf::sca_vsink("Vsc"); Vsc->p(n1); Vsc->n(gnd); Vsc->outp(out); // Load current instantiation Isc = new sca_eln::sca_tdf::sca_isource("Isc"); Isc->inp(in); Isc->p(n1); Isc->n(gnd); // Racc instantiation Racc = new sca_eln::sca_r("Racc"); Racc->p(n1); Racc->n(n2); Racc->value = 0.34; // Ls instantiation Ls = new sca_eln::sca_l("Ls"); Ls->p(n2); Ls->n(n3); Ls->value=0.00000093; // Cacc instantiation Cacc = new sca_eln::sca_c("Cacc"); Cacc->p(n3); Cacc->n(gnd); Cacc->value=0.8; } }; While the const_load is just a tdf module having as output a value of -1.0 connected to the TDF isource. Thank you very much! Alex
×
×
  • Create New...