AM modulator/ Ideal modulation sanity checks


Was wondering if there’s a quick way to do an ideal version of a modulation, generate 2 sidebands or 1 sideband only, no other harmonics? It looks like the Optical Amplitude Modulation block “AM” has harmonics, and “Optical modulator scripted” has neff definitions/ doesn’t let you script arbitrary modulation functions defined through the math (or is that incorrect?).

Just wanted to generate some ideal behavior for sanity checks/isolate behavior to some other block of the system. Should I be looking at the “scripted elements”? Is it possible to open the “Optical Amplitude Modulation” block’s file/code/script and edit the functions and math through there? Thanks for the guidance, much appreciated!


Hi @xw27

You could use the “Scripted Element” to build an ideal optical modulator which matches your expectation. The KB page Scripted Element clearly illustrates the implementation details and defining method of this element. I made an example file optical_modulator_example.icp (183.6 KB) which contains a simple amplitude modulator that generates double sidebands. The script that used to define this element is under the “Simulation” tab in the Editing window. The modulated signal power spectrum is attached below.

The “Optical Amplitude Modulation” element is a primitive element and it is not possible to open up the block for any of the primitive elements.

I hope this helps :slight_smile:



Thanks a lot for the file!

Had spent some time trying to modify the example scripted optical gain file, but had hanging error during simulation, so this really clears up what I needed in the scripts.

I had:

which is just a slight modification of the scripted gain example from " optical_mm_scripted_struct.icp" but it lacks the initialization and setup that you have in the file you gave, and freezes on simulation, so your code is incredibly helpful.
Really appreciate it!


I am glad it helped :slightly_smiling:


Hi Guanhui,
Have another question- did something change with in the recent updates to Interconnect? I re-downloaded the link provided to “optical_modulator_example.icp” and it’s no longer working, when I run that file I now get an error:

"Scripted Element: value=struct;

Scripted Element: value=struct;

Scripted Element: value=struct;

Scripted Element: go:
Error: prompt line 41: arguments of * are not the same type or of an invalid type

Scripted Element: go: Error: prompt line 41: arguments of * are not the same type or of an invalid type Thread ID 1 usage: 34.13 % Thread ID 2 usage: 50.00 % Saving monitor data... Wrapping up elements... Thread ID 1 usage: 16.67 % Thread ID 2 usage: 33.33 % Finalizing elements... Checking for errors... Simulation completed successfully. Total elapsed time: 00:00:00" Thanks again! XW


More details: yeah it runs with an older version of Interconnect (5.5) and I get results of the modulation in the OSA object, so it seems it has to do with the version differences.


Hi @xw27,

Thanks a lot for bringing up this problem. Indeed the Scripted Element data structure have been updated, and now the “value” is in a cell format as well. So to make the script work, you just need to replace the in the script by{1}. I updated the file optical_modulator_example.icp (183.6 KB) and it should work now (the file linked in previous posts has been updated too).

For your information, the “Electrical” data and “Optical” data structure is listed below, you could refer to it for your coding.

However, we will update the scripts and data structure agai shortly. I will update you when these features are ready to use.

I hope this could help :slight_smile:


I see, thanks a lot!