Complex Value types in Javascript and Opaque Actions

Moderator: Moderators

Complex Value types in Javascript and Opaque Actions

Postby kfisher@strattechnologies.com » Thu Apr 01, 2021 2:50 pm

Hello,

This is my first post. Apologies if I am breaking any guidelines.
I am trying to perform operations on arrays and matrices of complex numbers.
I have been unable to access the javascript math.complex libraries, so I am using CSM Built-in Math instead. Is there a way to include math.complex for javascript?

I have attached an image of an activity diagram which reads a structural feature, typed as Complex and given a default value. I am trying to send that complex value to an opaque action, and use the real() and imag() functions to perform operations on the data within the opaque action, however I get an error "Invalid input parameter in function real" I have the output and input pins typed as Complex.

Any help would be greatly appreciated as I need to perform many operations on arrays and matrices of complex numbers in order to simulate waveforms.

Thanks
You do not have the required permissions to view the files attached to this post.
kfisher@strattechnologies.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Wed Mar 03, 2021 9:43 am

Re: Complex Value types in Javascript and Opaque Actions

Postby kfisher@strattechnologies.com » Tue Apr 13, 2021 9:03 am

I was able to solve the first part of my problem. I had to type the "Opaque Expression" of complex_number as complex. The opaque expression is hidden in the containment tree, but found under the complex_number value type.

I am still wondering if and how I can import javascript libraries into CSM, such as Math.js, so that I can utilize things like math.complex in my javascript opaque expressions.

Thanks
kfisher@strattechnologies.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Wed Mar 03, 2021 9:43 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests