Jump to content

Tracing ELN Nodes (Voltages and Current)


Recommended Posts

Hi,

According to the SystemC AMS User Guide 2020 (p.g. 92), 

Quote

For ELN models, voltage tracing is supported for nodes and terminals. Current tracing through ELN
primitive modules having two terminals is supported. Some simulators also support current tracing
through ELN primitive modules with more than two terminals.

Can I know how exactly this is done, with examples?

Many thanks in advance!

 

Link to post
Share on other sites

The SystemC AMS standard defines in section 9.1.2.6 (sca_util::sca_trace) that it can trace objects of type sca_traceable_object. Since all ELN primitives are derived of this type, you can simply trace the ELN component itself, see example below
 

SC_MODULE(eln_circuit)
{ 
  // node declaration
  sca_eln::sca_node n1;      // ELN node
  sca_eln::sca_node_ref gnd; // ELN ground

  // component declaration
  sca_eln::sca_vsource vin;
  sca_eln::sca_r       r1;

  // constructor including ELN netlist
  eln_circuit( sc_core::sc_module_name nm )
  : vin("vin", 0.0, 1.23), 
    r1("r1", 1e3)
  {
    // Only ELN primitives requires explicit timestep assignment to one element
    vin.set_timestep(1.0, sc_core::SC_MS);
 
    // netlist
    vin.p(n1);
    vin.n(gnd);
 
    r1.p(n1);
    r1.n(gnd);
  }
};


int sc_main(int argc, char* argv[])
{
  eln_circuit cir("eln_circuit");
  
  sca_util::sca_trace_file* tf = sca_util::sca_create_tabular_trace_file("trace.dat");
  sca_util::sca_trace(tf, cir.n1, "v_n1");
  sca_util::sca_trace(tf, cir.vin, "i_through_vin");
  sca_util::sca_trace(tf, cir.r1, "i_through_r1");

  sc_core::sc_start(1.0, sc_core::SC_MS);

  sca_util::sca_close_tabular_trace_file(tf);

  return 0;
}

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...