Imaginary number in CoDeSys

davre-1
2007-03-26
2007-03-29
  • davre-1 - 2007-03-26

    Does anybody know how to use imaginary number in CoDeSys?

    thanks for your help

     
  • ndzied1 - 2007-03-29

    Like any computer system, imaginary numbers will have to be handled as either a structure or array where each "number" has two sub-elements; the real part and the imaginary part.

    You will then have to define your own functions for all of the operations you wish to perform on the imaginary numbers. In FORTRAN these are sometimes also called Complex Numbers so that you could write functions such as

    CADD for adding

    CSUB for subrraction

    CMUL for multiplication

    etc....

    At some level of complexity you will have to weigh the option of writing the impginary part of your program in a higher level language such as C++ where you can find ready made libraries for dealing with imaginary numbers.

    I believe there are ways to link your own programs into CoDeSys but I have never done it myself. Others will have to comment on this.

    Good Luck

     

Log in to post a comment.