where can i find "mod" block in VisSim

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by murthyakella on Tue, 04/03/2012 - 15:08 

Hi,

I needed a mod block to convert the rotation radians into the range of 0 to 2*pi radians (i.e. 3pi radians --> pi radians and 4pi radians --> 0 radians). I looked for a 'mod' block in Vissim. But I could not find it. So I am currently using my own 'mod' block built from division and int blocks (i.e.output = input - Int(input/2pi)). But I suspect that this is leading to some small rounding or sampling error(I think) which is resulting in some deviation in the one another block depending upon this mod block. So I was wondering if there is a 'mod' block that I can readily use from vissim library?

Regards, Murthy

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by Satyabrata on Tue, 04/03/2012 - 19:38.

    Dear Murthy,

    Pls download VisSim/Comm if you haven't yet. After installation, in the toolbar, you will find a 'Comm' tab. Then you may find, Operators > Modulo block.

    Hope it helps you.

    Regards, Satya.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by murthyakella on Wed, 04/04/2012 - 14:50.

    Hi Satyabrata,

    Thanks a lot. But unfortuntalely I do not think another installation is an option for me. I have use to something from vissim and vissim embedded only. :(/emoticons/default_sad.png' srcset='/emoticons/sad@2x.png 2x' title=':(' width='20'> But anyways, i will go ahead with my own mod block for the time being.

    Regards, Murthy

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by Anders89 on Tue, 04/03/2012 - 20:13.

    modulus.png

     

    You can also use the quantize block (see attached):

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by murthyakella on Wed, 04/04/2012 - 14:46.

    Hi Anders89,

    Thanks a lot for your prompt help. But I have some concerns. 1. Your example functions as mod when the input value is positive. But when the input value is negative, it make the output positive in the range 0 to 2*pi. 2. Although I can still use this quantize block (by changing my notations i.e. angle always beween 0 to 2pi), I get one extra jump when compared to convectional mod function. Refer the attached diagram. Anyways, for the time being, I would continue with my own mod block because of the time and task priority constraints. The only major problem with this is the sampling problem near 2pi values. Although the mod gives the correct output (i.e. perfect saw tooth curve with sharp drop at 2 pi values), I do not get a sharp saw tooth curve after sampling. It generates a triangular wavefom as the sampling does an interpolation between the peak value and the next sample value. As a result, my other waveform (U_alpha and U_beta) which are dependent on these angles have an error at these points. Refer the attached picture.

    Thanks once again.

    Regards, Murthy

    <?xml version="1.0" encoding="UTF-8"?>Error in Sine way_0.png

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by murthyakella on Thu, 04/05/2012 - 16:07.

    Hi,

    I found the reason why I am getting that error in my sin/cos wavefoms. :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20'> In 'inverse park transform' block, I was giving the input of angle(theta) in the range 0 to 2pi instead of 0 to 1. That is why I was getting wierd values near the peaks. Once again, thanks a lot for your help. :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20'>

    Regards, Murthy

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by hugo ravena on Fri, 04/13/2012 - 01:37.

    I'M TRYING TO DOWNLOAD AND NOT THAT I'M GETTING FOR THE ERROR. HELP ME.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by murthyakella on Fri, 04/13/2012 - 14:30.

    Hi Hugo,

    What was your question again? Which error do you want to see? And what do you want to download? By the way, please note that the error I initially talked about is nothing to do with the mod block. I was getting an error at another place(say output of special sin block) which accepts ouput from my mod as input. That time, I thought that the simulation is not sampling my mod block output correctly and feeding some wrong values to my sin block. However I later realized that that error was caused by wrong range of inputs to special sin block. Instead of giving my values as a fraction of maximum values, I was using the aboslute values directly.

    Regards, Murthy

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by Anders89 on Fri, 04/13/2012 - 22:57.

    this should be it's own post

    please tell us what JTAG emulator you are using, what version of CCS you have, what version of VisSim you have and what target you are downloading to.