Jump to content

PWM (DE) + low pass filter (ELN)


Recommended Posts

Hello all,

 

I have been working with SystemC some time. I am entering the SystemC-AMS world.

 

I have this system:

 

Processing algorithm (SystemC DE)

PWM generation (SystemC DE)

LPF (SystemC AMS, ELN)

 

I want to argument the selection. The processing part was already done and is almost digital, that's why DE is used for the modelling.

 

PWM generation is crucial in this application, as errors or quantization of the pulse position would result in distortion after demodulation. Using SystemC DE allows to toggle the signal at exact moments in time, without adding any quantization to the process.

 

Now I want to complete my model with the Low Pass Filter, that actuates as demodulator here.

 

The input should be sc_signal<bool> or sc_signal<double>, to interact with the PWM module.

 

The low pass filter should be model using ELN.

 

However, I do not know how to properly do this because I would need to define the sample time, however, as the LPF is the only AMS block and is a SC_MODULE instantiating the components and nodes, no sampling time is specified.

 

In the other hand, if I define a TDF block with a given sampling period, I will add uncertainty to the PWM signal, as well as aliasing because armonic extent is infinite.

 

I would appreciate any ideas. Please let me know if I have missunderstood some of the concepts of AMS.

 

Regards,

Leandro

Link to comment
Share on other sites

you have to use SystemC-AMS 2.0. The module should look like this (not tested nor compiled):

 

SCA_TDF_MODULE(de2eln)

{

  sca_tdf::sca_de::sca_in<double> inp;

  sca_tdf::sca_out<double>            outp;

 

 

  //define a Maximum timestep  e.g. half of the time constat of the ELN filter

  sca_core::sca_time max_timestep;

 

  void set_attributes()

  {

      this->set_timestep(max_timestep);

      this->does_attribute_changes();

  }

 

  void processing()

  {

     outp = inp.read();

  }

 

  void change_attributes()

  {

    //requests a new calculation of TDF Cluster (with the connected ELN Network)

    //if an Event occurs at inp or the max_time is over

     this->request_next_activation(max_timestep,inp->default_event());

  }

 

  SCA_CTOR(de2eln){}

 

};

 

This module gets as Input your pwm de Signal and the TDF Output should be connected to the ELN source.

 

best regards

Karsten

Link to comment
Share on other sites

Hi Karsten,

 

Thank you very much for your answer!!!!

 

This line makes the difference:

 

this->request_next_activation(max_timestep,inp->default_event());

 

As it allows me to maintain the resolution of the PWM module. I read about Dynamic TDF but did not know how to apply it here.

 

Thank you again!!!

 

Kind regards,

Leandro

Link to comment
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...