Element library
library - Script command
Returns a list of elements available in the currently installed element library, including custom elements.
Syntax | Description |
---|---|
out = library; | Returns a list of elements available in the currently installed element libraries, including custom elements. |
Example
Listing currently available elements
?library result: ::analyzers::digital::logic analyzer ::analyzers::electrical::oscilloscope ...
addtolibrary - Script command
Adds the selected element to the currently selected folder under Custom library.
Syntax | Description |
---|---|
addtolibrary ("name", replace); | Adds an element to the currently selected folder under Custom library. The "name" specified is the custom folder name. If no folder named as specified, a new folder will be generated under the Custom library. The "replace" is a boolean value. If "replace" is true, the element in the Custom library with the same name will be replaced; if "replace" is false, a warning message will pop up to get further action for replacing the element with the same name or not. The default value for "replace" is false. |
Eample
#adds the selected element to the folder "folder1" under Custom library addtolibrary("folder1", true);
customlibrary - Script command
Returns the location (path) of the Custom library.
Syntax | Description |
---|---|
out = customlibrary; | Returns the directory of the custom library. |
Example
?out = customlibrary; >C:/Users
saveelement - Script command
Saves an element to a .ice file in the current working directory.
Syntax | Description |
---|---|
saveelement ("name"); | Save an element to a file. The element will be saved with the current element name in the current working directory with extension ICE. |
Example
#adds an element star coupler and saves it to an .ice file in the current working directory addelement("Star Coupler"); saveelement("STAR_1");
loadelement - Script command
Loads an element from a file created using the saveelement command in the current working directory. The element will be placed in the current schematic editor window.
Syntax | Description |
---|---|
loadelement ("name"); | Loads an element from the file in the current working directory with extension ICE. |
Example
#adds an element star coupler and saves it to an .ice file in the current working directory addelement("Star Coupler"); saveelement("STAR_1"); #loads the star coupler element "STAR_1.ice" to the schematic editor loadelement("STAR_1.ice"); #change element position in the schematic editor set("x position", -200)
probe - Script command
Places a probe analyzer at a specified port of a specified element.
Syntax | Description |
---|---|
probe ("name","port"); | Places a probe analyzer at a given element name at the given port. |
Example
#adds a straight waveguide element to the schematic editor and adds a probe to "port 2" of it addelement("Straight Waveguide"); probe("WGD_1", "port 2");
loadcustom - Script command
Redirects the location of the element library ‘Custom’ folder and reloads the contents of the folder.
Syntax | Description |
---|---|
loadcustom (path); | Redirects the location of the element library ‘Custom’ folder to a user defined ‘path’. It also reloads the contents of the ‘Custom’ folder in the element library. |
Example
#Redirects the location of the element library ‘Custom’ folder and reloads the contents of the folder from the path #"C:/Users/xxx" loadcustom("C:/Users/xxx");
replacelibrary - Script command
Replaces all instances of the current library in the Custom library.
Syntax | Description |
---|---|
replacelibrary(previous,new); | Replaces all instances of the current library ‘previous’ by the new library ‘new’. |
hideproperty - Script command
Hides the ‘property’ of a given ‘element’.
Syntax | Description |
---|---|
hideproperty (element,property,hide); | Hides the ‘property’ of a given ‘element’. The argument 'hide' is a boolean value. If ‘hide’ is true the property is invisible, if 'hide' is false the property is visible. The default value of ‘hide' is true. |
Example
addelement("CW Laser"); hideproperty("CWL_1","linewidth", true);
annotateproperty - Script command
Enables ‘property’ annotation on a given ‘element’.
Syntax | Description |
---|---|
out=annotateproperty (element,property,annotate); | Enables ‘property’ annotation on a given ‘element’. If ‘annotate’ is true the property is annotated, if ‘annotate’ is false the annotation is disable. The default value of ‘annotate’ is true. |
Example
addelement("CW Laser"); annotateproperty("CWL_1", "linewidth", true);
ispropertyactive - Script command
Returns true if the property ‘property’ from element ‘element’ is active.
Syntax | Description |
---|---|
out=ispropertyactive (element,property); | Returns true if the property ‘property’ from element ‘element’ is active. |
Example
addelement("CW Laser"); ?ispropertyactive("CWL_1", "frequency"); result: 1
parsebackannotation - Script command
Parses the waveguide back annotation.
Syntax | Description |
---|---|
parsebackannotation(backannotation) | Parses the waveguide back annotation. The annotation contains a list of mode labels, and for each mode a list of temperature and wavelength dependent propagation parameters are provided. The function returns a cell vector containing multiple structures with the parsed data. |
Example
sIn = "( ( 'TE' ( '26.85' '1.5475u' 0.0501323 2.4485 4.19145 0.000138683 ) ( '26.85' '1.5u' 0.0501323 2.4485 4.19145 0.000138683 ) ) ( 'TM' ( '26.85' '1.5475u' 17.3718 1.785382 3.76608 -0.019477 ) ( '26.85' '1.5u' 17.3718 1.785382 3.76608 -0.019477 ) ) ( 'TX' ( '26.85' '1.5650u' 0.0485085 2.42879 4.19216 0.000133047 ) ( '26.85' '1.5u' 0.0485085 2.42879 4.19216 0.000133047 ) ) ( 'TY' ( '49.85' '1.5475u' 0.0501048 2.45306 4.19667 0.000154927 ) ( '49.85' '1.5u' 0.b0501048 2.45306 4.19667 0.000154927 ) ) ) "; x=parsebackannotation(sIn); ?toscript(x); x=cell(4); x{1}=struct; x{1}.dispersion=matrix(2); x{1}.dispersion(1)=0.000138683; x{1}.dispersion(2)=0.000138683; x{1}.dispersion_temperature_sensitivity=matrix(2); x{1}.dispersion_temperature_sensitivity(1)=0; x{1}.dispersion_temperature_sensitivity(2)=0; x{1}.effective_index=matrix(2); x{1}.effective_index(1)=2.4485; x{1}.effective_index(2)=2.4485; x{1}.effective_index_temperature_sensitivity=matrix(2); x{1}.effective_index_temperature_sensitivity(1)=0; x{1}.effective_index_temperature_sensitivity(2)=0; …
parsewaveguidebackannotation - Script command
Parses the waveguide back annotation at a given temperature in Celsius.
Syntax | Description |
---|---|
parsewaveguidebackannotation(backannotation, temperature) | Parses the waveguide back annotation at a given temperature in Celsius. The annotation contains a list of mode labels, and for each mode a list of temperature and wavelength dependent propagation parameters are provided. The function returns a cell vector containing multiple structures with the parsed data at the given input temperature. |
Example
sIn = "( ( 'TE' ( '26.85' '1.5475u' 0.0501323 2.4485 4.19145 0.000138683 ) ( '26.85' '1.5u' 0.0501323 2.4485 4.19145 0.000138683 ) ) ( 'TM' ( '26.85' '1.5475u' 17.3718 1.785382 3.76608 -0.019477 ) ( '26.85' '1.5u' 17.3718 1.785382 3.76608 -0.019477 ) ) ( 'TX' ( '26.85' '1.5650u' 0.0485085 2.42879 4.19216 0.000133047 ) ( '26.85' '1.5u' 0.0485085 2.42879 4.19216 0.000133047 ) ) ( 'TY' ( '49.85' '1.5475u' 0.0501048 2.45306 4.19667 0.000154927 ) ( '49.85' '1.5u' 0.0501048 2.45306 4.19667 0.000154927 ) ) ) "; x= parsewaveguidebackannotation(sIn, 10); ?toscript(x); x=cell(4); x{1}=struct; x{1}.label='TE'; x{1}.orthogonal_identifier=1; x{1}.propagation=matrix(2,5); x{1}.propagation(1,1)=1.99862e+014; x{1}.propagation(2,1)=1.93727e+014; x{1}.propagation(1,2)=0.0501323;…
Design Kit Commands
loaddesignkit - Script command
Loads a design kit and directs its contents to a user defined path.
Syntax | Description |
---|---|
loaddesignkit ("name", "path"); | Loads a design kit named ‘name’ and directs its contents to a user defined ‘path’. The design kit will be available in the element library ‘Design kits’ folder. |
Example
#loads the design kit "dk" and direct its contents to the path "C:/Users/xxx" loaddesignkit("dk", "C:/Users/xxx");
enabledesignkit - Script command
Enables a design kit in the Design Kits folder.
Syntax | Description |
---|---|
enabledesignkit("name", ["version"]); | Enables a design kit that is already installed to the Design Kit folder with the version number "version". The "version" is optional, default is an empty string. |
Example
#enables the design kit "LCML" with version v1.1 from the element library ‘Design kits’ folder enabledesignkit("LCML", "v1.1");
disabledesignkit - Script command
Disables a design kit in the Design Kits folder.
Syntax | Description |
---|---|
disabledesignkit("name", ["version"]); | Disables a design kit that is already installed to the Design Kit folder with the version number "version". The "version" is optional, default is an empty string. |
Example
#disables the design kit "LCML" with version v1.1 from the element library ‘Design kits’ folder disabledesignkit("LCML", "v1.1");
removedesignkit - Script command
Removes an existing design kit from the element library ‘Design kits’ folder.
Syntax | Description |
---|---|
removedesignkit("name", ["version"]); | Removes a design kit named ‘name’ from the element library ‘Design kits’ folder with the version 'version'. "version" is optional and by default is an empty string. |
Example
#removes the design kit "LCML" with version v1.1 from the element library ‘Design kits’ folder removedesignkit("LCML", "v1.1");
reloaddesignkit - Script command
Reloads the contents of a design kit from the element library ‘Design kits’ folder.
Syntax | Description |
---|---|
reloaddesignkit ("name", ["version"]); | Reloads the contents of a design kit named ‘name’ from the element library ‘Design kits’ folder with the version 'version'. "version" is optional and by default is an empty string. |
Example
#reloads the design kit "LCML" with version v1.1 from the element library ‘Design kits’ folder reloaddesignkit("LCML", "v1.1");
packagedesignkit - Script command
Creates a .cml from a existing folder under Custom library.
Syntax | Description |
---|---|
packagedesignkit(name, filename, encrypt, overwrite); | Creates a design kit file named ‘filename.cml’ from the custom folder named ‘name’. If 'encrypt' = false, it will be packaged without encryption and if 'encrypt' = true, the package will be encrypted. If ‘overwrite’ is true, it will overwrite an existing design kit file with the same name, if ‘overwrite’ is false, it will ask the user for confirmation before overwriting. The default setting for 'overwrite' is false. |
Example
#packages a compact model library in the Custom folder with encryption packagedesignkit("dk", "dk.cml", true, true);
installdesignkit - Script command
Installs a design kit file to the Design Kits folder.
Syntax | Description |
---|---|
installdesignkit(filename, path, overwrite); | Installs a design kit file named ‘filename.cml’ and directs its contents to a user defined ‘path’. The design kit will be available in the element library ‘Design kits’ folder. If ‘overwrite’ is true, it will overwrite an existing design kit with the same name, if ‘overwrite’ is false, it will ask the user for confirmation before overwriting. |
Example
#installs the "dk.cml" library to the Design Kits folder installdesignkit("dk.cml", "C:/Users/xxx", true);
uninstalldesignkit - Script command
Uninstalls a design kit file in the Design Kits folder.
Syntax | Description |
---|---|
uninstalldesignkit("name", ["version"]); | Uninstalls a design kit named 'name' with version 'version' in the Design Kits folder. "version" is optional and default is an empty string. |
Example
# uninstalls a design kit folder "LCML" with version v1.1 from the Design Kits folder uninstalldesignkit("LCML", "v1.1");
exportlib - Script command
Exports the .lib file for a CML in the Custom folder.
Syntax | Description |
---|---|
exportlib(name, path, overwrite); | Exports the .lib file for a CML in the Custom folder. name, the CML name in Custom path, where to save the exported .lib file. Use the current working directory if path is not provided. overwrite, boolean value to indicate whether or not to overwrite the file if it exists. |
Example
#exports the ".lib" file for "dk.cml" exportlib("dk.cml", "C:/Users/xxx", true);
renameport - Script command
Renames the port name for a Compound or Scripted element.
Syntax | Description |
---|---|
renameport("element name", "old port name", "new port name"); | Renames the port name for a Compound or Scripted element. |
Example
#renames the port name "port 1" to "port a" for the element "COMPOUND_1" renameport("COMPOUND_1", "port 1", "port a");
removecustom - Script command
Removes a folder in the Custom folder in Element Library.
Syntax | Description |
---|---|
removecustom("element name", "old port name", "new port name"); | Removes a folder in the Custom folder in Element Library. This command removes all the files in the CML installation directory. |
Example
#removes the folder "new folder" in the Custom folder in Element Library removecustom("new folder");
Measurements
validate - Script command
Updates the results for the specified analyzer.
Syntax | Description |
---|---|
validate("analyzer"); | Updates the results for the specified "analyzer". If the name is not provided, the selected analyzer will be updated. |
Example
addelement("Optical Network Analyzer"); validate("ONA_1");
validateall - Script command
Updates the results for all the analyzers in the current simulation.
Syntax | Description |
---|---|
validateall; | Updates the results for all the analyzers in the current simulation. |
Example
validateall;
setresult - Script command
Sets the result of a Scripted or a Compound element. Note that this command is not available from the script prompt or script file editor. It should be used in the Scripted or Compound element "Simulation" tabs.
Syntax | Description |
---|---|
setresult("result",value); | Sets the "result" for the scripted/compound element to the specified value. The "result" can be a matrix or a dataset. |
setresult("result",value,"kind (unit)"); | Sets the "result" for the scripted/compound element to the specified value with the given description. Note that units should be placed in parenthesis. |
setresult("result",x,y,"x title",'y title'); | Sets the x, y parameters of the "result" for the scripted/compound element. This is useful for visualization. |
getresultdata - Script command
Gets results from an analyzer. This differs from the "getresult" function in that the results are returned as matrices, not Datasets.
Syntax | Description |
---|---|
?getresultdata; | Returns the names of all elements in the current simulation that contain results. |
?getresultdata("analyzer"); | Returns all available results for "analyzer". |
out = getresultdata("analyzer", "result"); | Returns the result "result" for "analyzer". |
getvalue - Script command
Gets an internal value for an element's internal ‘s parameters’.
Syntax | Description |
---|---|
value=getvalue("element", "parameter"); value=getvalue("element", "parameter", "type"); | Gets an internal value for an element's internal ‘parameter’. Different from ‘set’ or ‘getnamed’, ‘getvalue’ can have direct access to internal element parameters. ‘type’ allows for variations for a given ‘parameter’. |
Example
The following example gets the "s parameter" from the element "SPAR_1".
?getvalue("SPAR_1", "s parameters"); Cell array with 3 elements
setvalue - Script command
Sets an internal value for an element's internal parameter.
Syntax | Description |
---|---|
setvalue(element, parameter ,value); | Set an internal value for an ‘element’ internal ‘parameter’. Different from ‘set’ or ‘setnamed’, ‘setvalue’ can have direct access to internal element parameters. Currently only the ‘Optical N Port S-Parameter’ support this function for the internal ‘s parameters’ value. The ‘s parameters’ parameter is a cell that contains a complete description of the element s-parameters. |
Example
M=cell(3); M{1}=struct; M{1}.numberOfNPorts=-1; M{2}=struct; M{2}.numberOfMPorts=-1; M{3}=cell(1); M{3}{1}=struct; M{3}{1}.data=matrix(5,3); M{3}{1}.data(1,1)=2.26258e+014; M{3}{1}.data(2,1)=2.27569e+014; M{3}{1}.data(3,1)=2.28879e+014; M{3}{1}.data(4,1)=2.3019e+014; M{3}{1}.data(5,1)=2.315e+014; M{3}{1}.data(1,2)=0.0104993; M{3}{1}.data(2,2)=0.00926858; M{3}{1}.data(3,2)=0.00596999; M{3}{1}.data(4,2)=0.00182042; M{3}{1}.data(5,2)=0.00429422; M{3}{1}.data(1,3)=-2.64534; M{3}{1}.data(2,3)=-2.75636; M{3}{1}.data(3,3)=-2.89119; M{3}{1}.data(4,3)=-3.62524; M{3}{1}.data(5,3)=-5.23423; M{3}{1}.modeInputLabel='TE'; M{3}{1}.modeInputOID=1; M{3}{1}.modeInputUID='#1'; M{3}{1}.modeOutputLabel='TE'; M{3}{1}.modeOutputOID=1; M{3}{1}.modeOutputUID='#1'; M{3}{1}.portInput='port 1'; M{3}{1}.portOutput='port 2'; # sets the s-parameter for the element SPAR_1 setvalue('SPAR_1','s parameters',M);
pushportdata - Script command
Sends the data value to the specified output port. Used for Scripted Element.
Syntax | Description |
---|---|
pushportdata("output_port",data); | Sends the data value to "output_port". |
Example
Please see the page Scripted Element for the implementation details of this this command.
cloneportdata - Script command
Clones an existing data value. Used for Scripted Element.
Syntax | Description |
---|---|
data_destination = cloneportdata(data_source); | Clones "data_source", returns the data destination. |
popportframe - Script command
Extracts the first available data value from the input port. Used for Scripted Element.
For INTERCONNECT 6.5+, this script command supports for both Sample Mode and Block Mode data.
Syntax | Description |
---|---|
signalIn = popportframe(port); | For a scripted element, this command returns a frame structure containing the input signal for a given input ‘port’ (data) and its properties (header). |
Implementation Details
Digital signal frame:
The data contains the current time instant and the value of the signal, as well as the bandwidth struct which contains the signal bitrate and time window. The header is a struct that contains the signal type and subtype. The type for a digital signal is ‘3’. The subtype for sample and block modes digital signal are '1' and '2', respectively.
#digital signal frame data=struct data.bandwidth=struct data.bandwidth.bitrate data.bandwidth.time_window data.time data.value header=struct header.subtype header.type valid
Electrical signal frame:
The data contains the current time instant and the value of the signal, as well as the bandwidth struct which contains the signal frequency, sample rate and time window. The header is a struct that contains the signal type and subtype. The type for an electrical signal is ‘2’. The subtype for sample and block modes electrical signal are '1' and '2', respectively.
#electrical signal frame data=struct data.bandwidth=struct data.bandwidth.frequency data.bandwidth.sample_rate data.bandwidth.time_window data.time data.value header=struct header.subtype header.type valid
Optical signal frame:
The data signal is a cell which contains the channel and mode information. The signal channel is a cell that contains the bandwidth struct, and the bandwidth struct contains the signal frequency, sample rate and time window. The mode is a struct which contains the mode label, orthogonal indentifier and the mode ID. The header is a struct that contains the signal type and subtype. The type for an optical signal is ‘1’. The subtype for sample and block modes optical signal are '1' and '2', respectively.
#optical signal frame data=struct data.signal=cell data.signal.channel=cell data.signal.channel.bandwidth=struct data.signal.channel.bandwidth.frequency data.signal.channel.bandwidth.sample_rate data.signal.channel.bandwidth.time_window data.signal.channel.time data.signal.channel.value data.signal.mode=struct data.signal.mode.label data.signal.mode.orthogonal_identifier data.signal.mode.uid header=struct header.subtype header.type valid
Example
Sample Mode
Implements of a ‘go’ function of a scripted element with one digital input and one digital output port. It calculates the complementary output:
signalIn = popportframe( "input" ); if( signalIn.valid ) { logmessage( toscript( signalIn ) ); bitrate = signalIn.data.bandwidth.bitrate; mxX( nCount ) = signalIn.data.time; mxY( nCount ) = signalIn.data.value; if( signalIn.data.value 0 ) { signalIn.data.value = 0; } else { signalIn.data.value = 1; } nCount = nCount + 1; } pushportframe( "output", signalIn );
The digital signal frame at time instant ‘6.4e-10’ seconds
SignalIn=struct; SignalIn.data=struct; SignalIn.data.bandwidth=struct; SignalIn.data.bandwidth.bitrate=2.5e+009; SignalIn.data.bandwidth.time_window=6.4e-009; SignalIn.data.time=5.6e-009; SignalIn.data.value=0; SignalIn.header=struct; SignalIn.header.subtype=1; SignalIn.header.type=3 SignalIn.valid=1
Implements of a ‘go’ function of a scripted element with one electrical input and one electrical output port. It calculates applies a gain of ‘10’ to the input signal:
signalIn = popportframe( "input" ); if( signalIn.valid ) { logmessage(toscript(signalIn)); for( i=1:length( signalIn.data.value ) ) { signalIn.data.value( i ) = 10 * signalIn.data.value( i ); } } pushportframe( "output", signalIn );
The electrical signal frame at time instant ‘3.19375e-009’ seconds
signalIn=struct; signalIn.data.bandwidth=struct; signalIn.data.bandwidth.frequency=0; signalIn.data.bandwidth.sample_rate=1.6e+011; signalIn.data.bandwidth.time_window=3.2e-009; signalIn.data.time=3.19375e-009; signalIn.data.value=3.19375e-009; signalIn.header=struct; signalIn.header.subtype=1; signalIn.header.type=2; signalIn.valid=1;
Implements of a ‘go’ function of a scripted element with one optical input and one optical output port. It calculates applies a gain of ‘10’ to the input signal for each mode and channel:
signalIn = popportframe( "input" ); if( signalIn.valid ) { logmessage( toscript( signalIn ) ); for( i = 1:length( signalIn.data.signal ) ) { nChannels = length( signalIn.data.signal{i}.channel ); for( j = 1:nChannels ) { for(k=1:length(signalIn.data.signal{i}.channel{j}.value)) { signalIn.data.signal{i}.channel{j}.value(k) = 10.0 * signalIn.data.signal{i}.channel{j}.value(k); } } } } pushportframe( "output", signalIn );
The optical signal frame at time instant ‘7.01562e-010’ seconds
Scripted Element: signalIn=struct; signalIn.data=struct; signalIn.data.signal=cell(1); signalIn.data.signal{1}=struct; signalIn.data.signal{1}.channel=cell(1); signalIn.data.signal{1}.channel{1}=struct; signalIn.data.signal{1}.channel{1}.bandwidth=struct; signalIn.data.signal{1}.channel{1}.bandwidth.frequency=1.931e+014; signalIn.data.signal{1}.channel{1}.bandwidth.sample_rate=1.6e+011; signalIn.data.signal{1}.channel{1}.bandwidth.time_window=3.2e-009; signalIn.data.signal{1}.channel{1}.time=3.18125e-009; signalIn.data.signal{1}.channel{1}.value=0.0316228+0i; signalIn.data.signal{1}.mode=struct; signalIn.data.signal{1}.mode.label='X'; signalIn.data.signal{1}.mode.orthogonal_identifier=1; signalIn.data.signal{1}.mode.uid='#1'; signalIn.header=struct; signalIn.header.subtype=1; signalIn.header.type=1; signalIn.valid=1;
Block Mode
Implements of a ‘go’ function of a scripted element with one digital input and one digital output port for Block Mode. It calculates the complementary output, achieves the same purpose as in the first example:
signalIn = popportframe( "input" ); if( signalIn.valid ) { logmessage( toscript( signalIn ) ); bitrate = signalIn.data.bandwidth.bitrate; mxX = signalIn.data.time; mxY = signalIn.data.value; for (nCount = 1:16) { if( signalIn.data.value(nCount) 0 ) { signalIn.data.value(nCount) = 0; } else { signalIn.data.value(nCount) = 1; } } } pushportframe( "output", signalIn );
The digital signal block frame at time instant ‘6.4e-10’ seconds
signalIn=struct; signalIn.data=struct; signalIn.data.bandwidth=struct; signalIn.data.bandwidth.bitrate=2.5e+010; signalIn.data.bandwidth.time_window=6.4e-010; signalIn.data.time=0; signalIn.data.value=matrix(16); signalIn.data.value(1)=0; signalIn.data.value(2)=1; signalIn.data.value(3)=1; signalIn.data.value(4)=0; signalIn.data.value(5)=1; signalIn.data.value(6)=1; signalIn.data.value(7)=1; signalIn.data.value(8)=0; signalIn.data.value(9)=0; signalIn.data.value(10)=1; signalIn.data.value(11)=0; signalIn.data.value(12)=0; signalIn.data.value(13)=0; signalIn.data.value(14)=0; signalIn.data.value(15)=0; signalIn.data.value(16)=1; signalIn.header=struct; signalIn.header.subtype=2; signalIn.header.type=3; signalIn.valid=1;
pushportframe - Script command
Writes a frame structure containing the output signal for a given output port. Used for Scripted Element.
Syntax | Description |
---|---|
pushportframe(port); | For a scripted element, this command writes a frame structure containing the output signal for a given output ‘port’ (data) and its properties (header). Refer to popportframe for the list of supported frame types and examples. |
Example
Please refer to the script command popportframe for the implementation details of this script.
getmonitorframe - Script command
Reads the available frames from an analyzer input port.
Syntax | Description |
---|---|
signalIn = getmonitorframe(port,start,count); | For a scripted element, this command reads the available frames from an analyzer input port. Analyzer input ports store the signal frames in an internal buffer. This function allows for accessing these frames from a starting point ‘start’ with length defined by ‘count’. Different from ‘popportrame’ where header and data contains one structure each, the data member returned from this function is cell containing multiple data values. Refer to ‘popportframe’ for the list of supported frame types and examples. |
getmonitorwaveform - Script command
Returns a structure containing a waveform from an analyzer input port. This command is specific for building analyzers.
Syntax | Description |
---|---|
signalIn = getmonitorwaveform(port,domain=”time”); | For a scripted element, this command returns a structure containing a waveform from an analyzer input port. Results can be provided in “time” or “frequency’ domains. This command is specific for building analyzers. |
Implementation Details
Digital signal waveform:
The waveform contains the signal bitrate and two vectors: the time and amplitude values.
#digital signal waveform bitrate time=matrix; value=matrix;
Electrical signal frame:
The waveform contains the signal value and its bandwidth. Frequency or time domain values are available.
#electrical signal frame bandwidth=struct bandwidth.frequency bandwidth.sample_rate bandwidth.time_window value=struct value.amplitude = matrix value.frequency = matrix
Optical signal frame:
The waveform contains the signal channel. The signal channel is a cell which contains the bandwidth, value and mode structs.
#optical signal frame signal=cell signal.channel=cell signal.channel.bandwidth=struct signal.channel.bandwidth.frequency signal.channel.bandwidth.sample_rate signal.channel.bandwidth.time_window signal.channel.value=struct signal.channel.value.amplitude signal.channel.value.frequency signal.channel.mode=struct signal.channel.mode.label signal.channel.mode.orthogonal_identifier signal.channel.mode.uid
Example
Implements of a ‘wrapup function of a scripted element with one analyzer digital input port:
signalIn = getmonitorwaveform( "input", "time", 3 ); logmessage(toscript(signalIn,false)); setresult( "waveform", signalIn.time, signalIn.value, "time (s)", "amplitude (a.u.)" ); setresult( "bitrate", signalIn.bitrate, "bitrate (bits/s)" );
The digital signal waveform with 32 values for time and amplitude:
SCRIPTED_2: signalIn=struct; signalIn.bitrate=2.5e+009; signalIn.time=matrix(32); signalIn.value=matrix(32);
Implements of a ‘wrapup function of a scripted element with one analyzer electrical input port:
signalIn = getmonitorwaveform( "input", "time", 3 ); logmessage( toscript( signalIn, false ) ); setresult( "waveform", signalIn.value.time, signalIn.value.amplitude, "time (s)", "amplitude (a.u.)" );
The electrical signal waveform with 512 values for time and amplitude:
SCRIPTED_2: signalIn=struct; signalIn.bandwidth=struct; signalIn.bandwidth.frequency=0; signalIn.bandwidth.sample_rate=1.6e+011; signalIn.bandwidth.time_window=3.2e-009; signalIn.value=struct; signalIn.value.amplitude=matrix(512); signalIn.value.frequency=matrix(512);
Implements of a ‘wrapup function of a scripted element with one analyzer optical input port:
signalIn = getmonitorwaveform( "input" ); logmessage( toscript( signalIn, false) ); setresult( "waveform", signalIn.signal{1}.channel{1}.value.time, signalIn.signal{1}.channel{1}.value.amplitude, "time (s)", "amplitude (a.u.)" );
The optical signal waveform with 512 values for time and amplitude:
SCRIPTED_2: signalIn=struct; signalIn.signal=cell(1); signalIn.signal{1}=struct; signalIn.signal{1}.channel=cell(1); signalIn.signal{1}.channel{1}=struct; signalIn.signal{1}.channel{1}.bandwidth=struct; signalIn.signal{1}.channel{1}.bandwidth.frequency=1.931e+014; signalIn.signal{1}.channel{1}.bandwidth.sample_rate=1.6e+011; signalIn.signal{1}.channel{1}.bandwidth.time_window=3.2e-009; signalIn.signal{1}.channel{1}.value=struct; signalIn.signal{1}.channel{1}.value.amplitude=matrix(512); signalIn.signal{1}.channel{1}.value.frequency=matrix(512); signalIn.signal{1}.mode=struct; signalIn.signal{1}.mode.label='X'; signalIn.signal{1}.mode.orthogonal_identifier=1; signalIn.signal{1}.mode.uid='#1';
portdatasize - Script command
Returns the number of data values available at the input port.
Syntax | Description |
---|---|
size = portdatasize("input_port"); | Returns the number of data values available at the input port. |
Example
?size = portdatasize("input"); 0
setsparameter - Script command
Sets the s-parameters between output port and input port.
IMPORTANT: the filter transfer function depends on the sample rate when providing filter coefficients.
Syntax | Description |
---|---|
setsparameter("output_port", "input_port", "constant", value); | Sets the s-parameter between "output_port" and "input_port" as a single complex constant value (frequency independent). |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "constant", value); | Sets the s-parameter between "output_port" and "input_port" as a single complex constant value (frequency independent). "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port", "input_port", "transmission", transmission); | Sets the s-parameter between "output_port" and "input_port", where the transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad). The number of rows of the matrix is the number of frequency points. If only two columns are provided, it is assume that the angle values are zero. |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "transmission", transmission); | Sets the s-parameter between "output_port" and "input_port", where the transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad). The number of rows of the matrix is the number of frequency points. If only two columns are provided, it is assume that the angle values are zero. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "transmission", transmission, delay, fractional delay, delay compensation); | Sets the s-parameter between "output_port" and "input_port", where the transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad). The number of rows of the matrix is the number of frequency points. If only two columns are provided, it is assumed that the angle values are zero. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). Delay is the filter delay defined in seconds. Fractional delay is a boolean value which defines whether to enable the fractional delay option for the function. Delay compensation is the compensation number. |
setsparameter("output_port", "input_port", "propagation", propagation, length, digital, fractional delay, delay compensation); | Sets the frequency dependent propagation parameters between "output_port" and "input_port", where the propagation is a matrix with up to 6 columns: frequency (Hz), absorption (dB/m), effective index, group velocity (m/s), dispersion (s/m/m), dispersion slope (s/m^2/m) and digital filter. The number of rows of the matrix is the number of frequency points. Group velocity, dispersion, dispersion slope and digital filter are optional. The length (m) is the propagation length. Digital is a boolean value which defines whether the model will use a FIR filter or not (default is true). Fractional delay is a boolean value which defines whether to enable the fractional delay option for the propagation. Delay compensation is the compensation number. |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "propagation", propagation, length, digital, fractional delay, delay compensation); | Sets the s-parameter between "output_port" and "input_port", where the propagation is a matrix with up to 6 columns columns: frequency (Hz), absorption (dB/m), effective index, group velocity (m/s), dispersion (s/m/m) , dispersion slope (s/m^2/m) and digital filter. The number of rows of the matrix is the number of frequency points. Group velocity, dispersion, dispersion slope and digital filter are optional. The length (m) is the propagation length. Digital is a boolean value which defines whether the model will use a FIR filter or not (default is true). Fractional delay is a boolean value which defines whether to enable the fractional delay option for the propagation. Delay compensation is the compensation number. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "s coefficient", coeff, frequency); | Sets the s-parameter between "output_port" and "input_port", using ‘s’ domain coefficients. coeff is a matrix with 2 columns: complex numerators and complex denominators. The number of rows of the matrix is the number of coefficients points. If the number of numerators are different from the number of denominators, set the missing values to zero. frequency is the center frequency of the transmission described by the coefficients. Coefficients are the terms of the polynomial and increase in powers of s. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port","input_port", "s-coefficient", coeff, frequency); | Sets the s-parameter between "output_port" and "input_port", using ‘s’ domain coefficients. coeff is a matrix with 2 columns: complex numerators and complex denominators. The number of rows of the matrix is the number of coefficients points. If the number of numerators are different from the number of denominators, set the missing values to zero. frequency is the center frequency of the transmission described by the coefficients. Coefficients are the terms of the polynomial and increase in powers of s. |
Example
Below is a simple example of the usage of the 'transmission' option, where the user can enter the transmission for different modes. The transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad).
#setsparameter("output_port","mode_label",output_mode_ID,"input_port",input_mode_ID,"transmission",transmission); trans = matrix(5,3); #column 1, defines the frequency points trans(1,1) = 187370286250000.0; trans(2,1) = 190493124354166.7; trans(3,1) = 193615962458333.3; trans(4,1) = 196738800562500.0; trans(5,1) = 199861638666666.7; #column 2, defines the transmission amplitude trans(1,2) = 0.03518825476359812; trans(2,2) = 0.03383507116538854; trans(3,2) = 0.03492134747865309; trans(4,2) = 0.02838844090444738; trans(5,2) = 0.02130194150641888; #column 3, defines the transmission phase trans(1,3) = -1.433937989007260; trans(2,3) = -0.5088708644443268; trans(3,3) = 0.8736840958416258; trans(4,3) = 2.047612541197649; trans(5,3) = 4.695289185212291; setsparameter("port 2", "TE", 1, "port 1", 1, "transmission", trans);
Below is a simple example of the usage of the 'coefficient' option, where the user can enter z-transform numerator and denominator complex coefficients directly. User should provide the complex coefficients and the center frequency. If the number of numerators and denominators are different, simply provide zero values for the missing coefficients.
trans = matrix(5,2); #numerator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of z (increase in powers of 1/z) trans(1,1) = 0.0016146343489959229; trans(2,1) = 0.0064585373959836915; trans(3,1) = 0.0096878060939755359; trans(4,1) = 0.0064585373959836915; trans(5,1) = 0.0016146343489959229; #denominator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of z (increase in powers of 1/z) trans(1,2) = 1.0000000000000000; trans(2,2) = 2.6335032369252369; trans(3,2) = -2.6909323201054560; trans(4,2) = 1.2572856503799887; trans(5,2) = -0.22569071678370439; setsparameter("port 2", "port 1", "coefficients", trans, frequency ); setsparameter("port 1", "port 2", "coefficients", trans, frequency );
Below is a simple example of the usage of the 'propagation' option, which is most useful when setting the s-parameter for waveguides. Users can define the propagation length and propagation parameters (loss, effective index, group velocity, dispersion and dispersion slope) at one or multiple frequency points. An improvement was made to the interpolation scheme for this option in INTERCONNECT version 2020a R1. From this version on, we recommend that users define the propagation parameters at a minimum of three frequency points per band, at the center and edges of the band. For previous versions, one frequency point per band is recommended.
prop = matrix(3,5); #define the propagation parameters prop(1,1) = 192.2e12; #first frequency prop(1,2) = 0; #absorption prop(1,3) = 2.34; #effective index prop(1,4) = 6.94e7; #group velocity prop(1,5) = 3.72e-3; #dispersion prop(2,1) = 193.4e12; #second frequency prop(2,2) = 0; #absorption prop(2,3) = 2.35; #effective index prop(2,4) = 6.95e7; #group velocity prop(2,5) = 3.65e-3; #dispersion prop(3,1) = 194.6e12; #third frequency prop(3,2) = 0; #absorption prop(3,3) = 2.37; #effective index prop(3,4) = 6.97e7; #group velocity prop(3,5) = 3.58e-3; #dispersion setsparameter("port 2", "port 1", "propagation", prop, 1e-5, true );
Below is a simple example of the usage of the 's coefficient' option. It models the filter coefficients for proportional integral derivative controller (PID), L(s)= kd.s + kp + ki/s.
trans = matrix(3,2); #numerator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of s (increase in powers of 1/s) trans(1,1) = kd; trans(2,1) = kp; trans(3,1) = ki; #denominator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of s (increase in powers of 1/s) trans(1,2) = 0; trans(2,2) = 1; trans(3,2) = 0; setsparameter("output", "input", "s coefficients", trans, 0.0 );
importsparameter - Script command
Imports the S-parameter data in the Script workspace to the S-parameter elements. The S-parameter data is a string that contains the exact data as the s-parameter data file supported by s-parameter elements, and the file formats are defined in the S-parameter file formats page. This script is supported by the following elements:
- Optical N Port Propagation Parameter
- Optical N Port S-Parameter
- Optical Nonlinear S-Parameter
- Optical Time Variant S-Parameter
Note: the filter transfer function depends on the sample rate when providing filter coefficients. For more information on the digital filters please visit the Digital filter coefficients automatic fitting page and the How to set up Digital filter for S Parameter elements post. |
Syntax | Description |
---|---|
importsparameter("elementName" , sParameterData); | Imports the S-parameter data "sParameterData" to the element "elementName". "sParameterData" is a string which contains the exact data as the s-parameter data file supported by s-parameter elements. |
Example
Below is a simple example of importing the S-parameter defined in "spar" to the Optical Time Variant S-Parameter element "SPAR_1":
spar = read("spar.txt"); importsparameter("SPAR_1", spar);
The content in the file "spar.txt" is the S-parameter for the Optical Time Variant S-Parameter element:
("port 2", "TE", 1, "port 1", 1, "modulation") (1, 5) -2 -1.5 -1 -0.5 0 (2, 11) 1.91561e+14 1.20499 0 1.22927 0 1.26623 0 1.29932 0 1.32 0 1.95943e+14 1.20499 0 1.22927 0 1.26623 0 1.29932 0 1.32 0 ("port 2", "TM", 2, "port 1", 2, "modulation") (1, 5) -2 -1.5 -1 -0.5 0 (2, 11) 1.91561e+14 1.20499 0 1.22927 0 1.26623 0 1.29932 0 1.32 0 1.95943e+14 1.20499 0 1.22927 0 1.26623 0 1.29932 0 1.32 0
setfir - Script command
Initializes a FIR filter using the current s-parameters.
Syntax | Description |
---|---|
setfir("window",taps,tap_estimation,tolerance,max_taps); | Initializes a FIR filter (with the specified number of taps) using the current s-parameters. "window" is the window function used by the FIR. window = "rectangular", "hamming" or "hanning". tap_estimation = 1, the fitting will iterate from number of taps to max_taps to find the best fit with the given input tolerance. tap_estimation = 2, the fitting will use the group delay value of the filter (if available). tap_estimation = 0, or false, tap_estimation is disabled. |
Example
#set the fir "hamming" filter with 64 taps setfir("hamming", 64, 1, 1e-4, 256);
setiir - Script command
Initializes a IIR filter using the current s-parameters.
Syntax | Description |
---|---|
setiir(taps,tolerance,iterations,rolloff,estimate_taps,max_taps); | Initializes an IIR filter (with the specified number of taps) using the current s-parameters. Filter taps are optimized using tolerance and max number of iterations ‘iterations’. Rolloff is the frequency rollof to force periodicity of the filter frequency response. If estimate_taps is true, the fitting will iterate from number of taps to max_taps to find the best fit with the given input tolerance. |
Example
#set the iir filter setiir(64, 0.1, 1024, 1, 1024);
exportimage - Script command
Exports an image of the current circuit schematic.
Syntax | Description |
---|---|
exportimage(filename); | Exports an image of the current circuit schematic. If the file has ‘png’ or no extension, a PNG (Portable Network Graphics) will be created. If the file has ‘svg’ extension, a SVG (Scalable Vector Graphics) file will be created. |
Example
exportimage("shcematic.png");
setsetting - Script command
Sets the value of a user defined setting. User settings are saved permanently and available after even closing the application.
Syntax | Description |
---|---|
setsetting("name","string_value") | Set the value of a user defined setting. |
Parameter | Type | Description |
---|---|---|
name | string | name of the setting. |
string_value | string | value of the setting. |
Example
This command allows users to define customized setting that is stored permanently, until the software reinstallats.
setsetting("in","out"); ?getsetting("in"); out # "string_value" of the setting "in"
getsetting - Script command
Returns the value of a user defined setting. This command can be used with setsetting .
Syntax | Description |
---|---|
getsetting("name"); | Gets the value of a user defined setting. |
Parameter | Type | Description |
---|---|---|
name | string | name of the setting. |
Example
Please visit the page setsetting .
runoptimization - Script command
Optimizes a property from a chosen element under specified condition.
Syntax | Description |
---|---|
x=runoptimization(element, property, min, max, analyzer, result, ’target’, target, tolerance=1e-9, iterations=2000) | Optimizes property from element until a target for an analyzer result is reached. Function returns an array with two columns, the firs column contains the property values and the second column contains the result values. |
x=runoptimization(element, property, min, max, analyzer, result, ’minimize’, tolerance=1e-9, iterations=2000) | Optimizes property from element until a minimum value for an analyzer result is reached. Function returns an array with two columns, the firs column contains the property values and the second column contains the result values. |
x=runoptimization(element, property, min, max, analyzer, result, ’maximize’, tolerance=1e-9, iterations=2000) | Optimizes property from element until a maximum value for an analyzer result is reached. Function returns an array with two columns, the firs column contains the property values and the second column contains the result values. |
Example
The following script line optimizes the thermal noise for a PIN Photodetector for target
x=runoptimization("PIN Photodetector","thermal noise",1e-20,1e-17,"Eye Diagram","measurement/Q factor","target",6,1e-2);
The following script line searches the minimum cutoff frequency for a LP Bessel Filter
x=runoptimization("LP Bessel Filter","cutoff frequency",1e+09,1e+10,"Eye Diagram","measurement/log of BER","minimize");
The following script line searches the maximum cutoff frequency for a LP Bessel Filter
x=runoptimization("LP Bessel Filter","cutoff frequency",1e+09,1e+10,"Eye Diagram","measurement/Q factor","maximize");
Related articles
- Optimization utility
- Lumerical scripting language - By category
- runparallel - Script command
- Y branch optimization using particle swarm algorithm
- INTERCONNECT product reference manual
Recently viewed articles
- Lumerical scripting language - By category
- getsetting - Script command
- setsetting - Script command
- exportimage - Script command
- setii
exportimage - Script command
Exports an image of the current circuit schematic.
Syntax | Description |
---|---|
exportimage(filename); | Exports an image of the current circuit schematic. If the file has ‘png’ or no extension, a PNG (Portable Network Graphics) will be created. If the file has ‘svg’ extension, a SVG (Scalable Vector Graphics) file will be created. |
Example
exportimage("shcematic.png");
constructgeneratormatrix - Script command
Constructs a symmetric coding generator matrix. This command is especially useful together with the FEC block.
Syntax | Description |
---|---|
constructgeneratormatrix(parityin, generatorout, parityout); | Constructs a symmetric coding generator matrix ‘generatorout’ and the correspondent parity check matrix ‘parityout’ from a input parity check matrix ‘parityin’. The input and the generated files are AList formatted files. |
Example
constructgeneratormatrix("hamming_7_4_1_h.alist", "hamming_7_4_1_g.alist", "hamming_7_4_1_
importtemperaturemap
Imports an Icepak data file (4 column csv file with columns x, y, z, temperature) and some optional arguments to an INTERCONNECT schematic design. It interpolates the temperature map to assign temperature to the elements in the schematic with an active "temperature" property and overwrites the existing temperature expressions, unless this has been deactivated in the optional argument struct.
Syntax | Description |
---|---|
importtemperaturemap(filename, option); | Import the Icepak data file (.csv file) from the specified filename with the optional arguments in the struct "option". |
Parameter | Default value | Type | Description |
---|---|---|---|
filename | required | string | The name of the csv file to import. May contain complete path to file, or path relative to current working directory |
option | optional | struct | The optional arguments are:
|
Example
The following script command will import the temperature map data in "myfile.csv" to the current INTERCONNECT schematic design.
importtemperaturemap("myfile.csv",{"x": 100e-9, "y": 100e-9, "z": 0, "z span": 200e-9, "visualize": true, "apply to schematic": true});
Related articles
- Spatial (n,k) data - Simulation object
- Tunable CROW Filter
- Tool integration overview
- INTERCONNECT product reference manual
- How to check license status and availability