### Basic Python Module Example Source: https://help.simetrix.co.uk/9.4/python/api.html A simple example demonstrating how one Python module can import and call functions from another. ```python import hello hello.hello() ``` ```python def hello() : print("Hello world!") ``` -------------------------------- ### Install SIMetrix/SIMPLIS Python package Source: https://help.simetrix.co.uk/9.4/python/installation/index.html Installs the specific Python package required for the SIMetrix/SIMPLIS version. Replace placeholders with the actual major and minor version numbers. ```bash py -m pip install simetrix~=..0 ``` ```bash py -m pip install simetrix~=9.4.0 ``` -------------------------------- ### Install Pyright Language Server Source: https://help.simetrix.co.uk/9.4/python/installation/index.html Installs the Pyright module to enable advanced Python editor features like completions, error checking, and documentation tooltips. ```bash py -m pip install pyright ``` -------------------------------- ### Install NumPy Source: https://help.simetrix.co.uk/9.4/python/installation/index.html Installs the NumPy library, which is essential for handling large data vectors within the SIMetrix/SIMPLIS interface. ```bash py -m pip install numpy ``` -------------------------------- ### Get Instance Symbol Name and Properties Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Element.html Retrieves all instances with a 'VALUE' property and prints their reference, symbol name, and type. This example demonstrates iterating through schematic instances. ```python import simetrix as sx schematic_file = "%DOCSPATH%/SIMetrix/Examples-93/SIMetrix/General/AMP.sxsch" schematic = sx.openSchematic(schematic_file) # returns all instances with a VALUE property instances = schematic.instances('VALUE') for el in instances : print(el.propertyValue('REF'), el.symbolName, el.type) ``` -------------------------------- ### String Starts With Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Checks if a string starts with a specified prefix. ```APIDOC ## StringStartsWith ### Description Checks if a string starts with a specified prefix. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `StringStartsWith(arg1, arg2)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### Python Path Example Source: https://help.simetrix.co.uk/9.4/python/_downloads/4e2ee03e4a4ed78000c07e6d02615d7a/Freq_Response.sxsch Demonstrates how to define a file path in Python, including handling backslashes. Useful for file system operations. ```python const path = "C:\\Users\\file"; ``` -------------------------------- ### Expanded Pre-Process Script Example Source: https://help.simetrix.co.uk/9.4/python/getting-started/dvm-example/index.html A complete implementation of a pre-process script that modifies the V1 component and returns a status message. ```python 1## DVM Pre-Process Script 2import simetrix, simetrix.dvm 3 4def preProcess(context : simetrix.dvm.PreTestContext, controlSymbol : simetrix.dvm.ControlSymbol) -> str: 5 6 schematic = controlSymbol.schematic 7 for i in schematic.instances(): 8 if i.propertyValue("REF") == "V1": 9 i.setPropertyValue("value", "10") 10 11 return "V1 set to 10v" 12 13locals()["dvm_preProcess_result"] = preProcess(locals()["dvm_preProcess_context"], locals()["dvm_preProcess_controlSymbol"]) ``` -------------------------------- ### Modify Instance Property Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Property.html Example demonstrating how to retrieve a property, update its value and flags, and commit the changes back to the instance. ```python if len(inst)>0 : # Get reference and value property propref = inst[0].prop('REF') prop = inst[0].prop('value') # Check properties are valid if propref.valid and prop.valid : # Get value prop = inst[0].prop('value') # Change value prop.value = 'q2n2222' # copy flags from Ref property prop.flags = propref.flags() # set new property value and attributes inst[0].setPropertyObject(prop) else : print("Instance doesn't have that property") else : print("Cannot find instance REF:Q2") ``` -------------------------------- ### GET /openSchematic Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.html#module-simetrix Opens a schematic file from a specified path. ```APIDOC ## GET /openSchematic ### Description Opens a schematic from a path and returns a Schematic object. ### Method GET ### Endpoint /openSchematic(path[, options]) ### Parameters #### Query Parameters - **path** (string) - Required - The file system path to the schematic file. - **options** (object) - Optional - Additional options for opening the schematic. ### Response #### Success Response (200) - **Schematic** (object) - The opened Schematic object. ``` -------------------------------- ### GET simetrix.script.functions.WM_GetSystemWidgetsLayout Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.WM_GetSystemWidgetsLayout.html Retrieves the current layout configuration for system widgets. ```APIDOC ## GET simetrix.script.functions.WM_GetSystemWidgetsLayout ### Description Retrieves the layout of system widgets as a string. ### Parameters #### Arguments - **arg1** (str | list[str] | GroupVector) - Optional - The argument defining the scope or selection for the layout retrieval. ### Response - **Return Value** (str | None) - Returns the system widgets layout as a string, or None if no layout is found. ``` -------------------------------- ### GET simetrix.script.functions.GetKeyDefs Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GetKeyDefs.html Retrieves a list of key definitions as strings. ```APIDOC ## GET simetrix.script.functions.GetKeyDefs ### Description Returns a list of strings representing the key definitions currently available in the SIMetrix environment. ### Method GET ### Endpoint simetrix.script.functions.GetKeyDefs() ### Response #### Success Response (200) - **return** (list[str]) - A list containing the key definitions. ``` -------------------------------- ### WM Get Widget Instance Info Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves instance information for a widget. ```APIDOC ## WM_GetWidgetInstanceInfo ### Description Retrieves instance information for a widget. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetWidgetInstanceInfo(arg1)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### Get Current Schematic and Run Simulation Source: https://help.simetrix.co.uk/9.4/python/getting-started/examples/demo-2-Display-Measurements/index.html Obtain the currently open schematic and initiate a simulation. This is useful when the schematic is already loaded. ```python # Get current schematic schem = sx.currentSchematic() # Run simulation sim = schem.run() ``` -------------------------------- ### Updating a Property Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Property.html Example demonstrating how to retrieve, modify, and save a property value back to a SIMetrix instance. ```APIDOC ## Update Property Value ### Description Retrieves a property from an instance, updates its value and flags, and commits the changes back to the SIMetrix object. ### Request Example ```python # Get reference and value property propref = inst[0].prop('REF') prop = inst[0].prop('value') # Change value and copy flags prop.value = 'q2n2222' prop.flags = propref.flags() # Commit changes inst[0].setPropertyObject(prop) ``` ``` -------------------------------- ### Set Property Value Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Property.html Example showing how to update the value attribute of a property object. ```python prop.value = "my new value" ``` -------------------------------- ### Get Current Graph Object in Python Source: https://help.simetrix.co.uk/9.4/python/getting-started/dvm-example/index.html Retrieves the current graph object from the simulation. This is the starting point for accessing curve data. ```python graph = simetrix.currentGraph() ``` -------------------------------- ### List reference designators of all instances Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Demonstrates opening a schematic file and preparing to query instances. ```python # List reference designators of all instances import simetrix as sx schematic_file = "%DOCSPATH%/SIMetrix/Examples-93/SIMetrix/General/AMP.sxsch" schematic = sx.openSchematic(schematic_file) ``` -------------------------------- ### Initializing SIMetrix Python Environment Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.GroupVector.html Import the necessary simetrix and numpy modules to begin simulation tasks. ```python import simetrix as sx import numpy as np ``` -------------------------------- ### Write and Read .TRAN Analysis Parameters Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Writes a .TRAN analysis command to the F11 window and then reads back the 'start_time' parameter. This example demonstrates basic analysis configuration and retrieval. It checks the status of the write operation before attempting to read. ```python import simetrix as sx schem_file = "%DOCSPATH%/SIMetrix/Examples-93/SIMetrix/General/AMP.sxsch" schem = sx.openSchematic(schem_file) status = schem.writeF11Analysis(".TRAN 0 5u 1u 1n") if status==sx.SchematicStatus.NOERR : # read back start time analyses = schem.readF11AnalysisParameter('.tran', 'start_time') print(analyses) elif status==sx.SchematicStatus.NOSCHEMATIC : print("Cannot find schematic") ``` -------------------------------- ### NewSchem Command with Simulator Argument Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.html Demonstrates how to call the NewSchem command with an optional argument to specify the initial simulator. Use this when you need to pre-select a simulator like SIMPLIS upon opening a new schematic. ```python NewSchem("/simulator SIMPLIS") ``` -------------------------------- ### ShowSimulatorWindow Command Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.ShowSimulatorWindow.html Displays the simulator window in the SIMetrix application. ```APIDOC ## ShowSimulatorWindow ### Description Displays the simulator window within the SIMetrix/SIMPLIS environment. ### Method Function Call ### Endpoint simetrix.script.commands.ShowSimulatorWindow ### Parameters #### Path Parameters - **command** (str) - Optional - A command string associated with the window display. ### Response - **None** (None) - The function does not return a value. ``` -------------------------------- ### WM Get Window Names Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the names of all windows. ```APIDOC ## WM_GetWindowNames ### Description Retrieves the names of all windows. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetWindowNames()` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### WM Get Window Geometry Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the geometry of a window. ```APIDOC ## WM_GetWindowGeometry ### Description Retrieves the geometry of a window. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetWindowGeometry(arg1)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### GET /currentGraph Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.html#module-simetrix Retrieves the currently active graph object. ```APIDOC ## GET /currentGraph ### Description Returns the currently active graph object. ### Method GET ### Endpoint /currentGraph() ### Response #### Success Response (200) - **Graph** (object) - The currently active graph object. ``` -------------------------------- ### GET simetrix.script.functions.ph Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.ph.html Calculates the phase of the provided input argument. ```APIDOC ## ph(arg1) ### Description Calculates the phase of the input argument. The function returns a GroupVector representing the phase values. ### Parameters #### Arguments - **arg1** (float | complex | list[float] | list[complex] | GroupVector) - Required - The input value or vector for which to calculate the phase. ### Response - **Returns** (GroupVector) - The calculated phase values. ``` -------------------------------- ### Retrieve Instance Nets Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Element.html Demonstrates how to obtain a list of nets connected to a specific schematic instance. ```python import simetrix as sx schem_file = "%DOCSPATH%/SIMetrix/Examples-93/SIMetrix/General/AMP.sxsch" schem = sx.openSchematic(schem_file) inst = schem.instances('REF', 'Q2') nets = inst[0].instanceNets() print(nets) ``` -------------------------------- ### GET simetrix.script.functions.InstPins Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.InstPins.html Retrieves pin information for specified instances. ```APIDOC ## GET simetrix.script.functions.InstPins ### Description Retrieves pin information for instances in the SIMetrix/SIMPLIS environment. ### Method GET ### Parameters #### Path Parameters - **arg1** (str | list[str] | GroupVector) - Optional - First argument for instance selection. - **arg2** (str | list[str] | GroupVector) - Optional - Second argument for instance selection. - **arg3** (float | list[float] | GroupVector) - Optional - Third argument for instance selection. ### Response - **Returns** (list[str]) - A list of strings representing the pins. ``` -------------------------------- ### Using ProgressBox with a 'with' statement Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.ProgressBox.html This example demonstrates how to use the ProgressBox class within a 'with' statement to manage a progress indicator during a simulation loop. It shows how to open, update, and potentially abort the process. Ensure the schematic is valid before proceeding. ```python import simetrix as sx schematic = sx.currentSchematic() if schematic.valid : oldValue = schematic.setComponentValue("R1.VALUE", "{RLOAD}").value loads = [5,10,20,40,100] # Open progress box with sx.ProgressBox(5, "", "Running simulation, click Abort to abort") as progressBox : for load in loads : # Update progress box. If update returns True, exit loop if progressBox.update("Load=" + str(load)+ "") : print("Run Aborted") break result = schematic.run(["RLOAD="+str(load)]) print("load=", load) if result.status==sx.RunStatus.success : print("success") else : print(result.status) schematic.setComponentValue("R1.VALUE", oldValue) else : print("There are no schematics open") ``` -------------------------------- ### run Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Executes a simulation on the current schematic. ```APIDOC ## run ### Description Runs a SIMetrix or SIMPLIS simulation on the schematic. ### Parameters - **parameters** (list[str]) - Optional - List of parameter name=value pairs to override. - **analysisOverride** (list[str]) - Optional - List of analysis specifications to override existing ones. - **options** (list[str]) - Optional - List of .OPTIONS statements to apply. ### Response - **Simulation** - A Simulation object containing status and data group information. ``` -------------------------------- ### GET simetrix.script.functions.GuiType Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GuiType.html Retrieves the current GUI type as a string. ```APIDOC ## GET simetrix.script.functions.GuiType ### Description Returns the current graphical user interface type used by the SIMetrix/SIMPLIS application. ### Method GET ### Endpoint simetrix.script.functions.GuiType() ### Response #### Success Response (200) - **return** (str) - The name of the current GUI type. ``` -------------------------------- ### Schematic.writeF11Options Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Writes SIMetrix simulator options to the F11 window. ```APIDOC ## writeF11Options(options) ### Description Write SIMetrix simulator options to the F11 window. ### Parameters #### Path Parameters - **options** (list[tuple[str, float | int | bool | str]]) - Required - List of pairs with the option name and its corresponding value. ### Response - **Returns** (SchematicStatus) - SchematicStatus.NOERR (success), SchematicStatus.NOSCHEMATIC (schematic not valid), or SchematicStatus.UNEXPECTED (unexpected result). ``` -------------------------------- ### GET simetrix.script.functions.GetAxisType Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GetAxisType.html Retrieves the axis type for the specified argument. ```APIDOC ## GET simetrix.script.functions.GetAxisType ### Description Returns the axis type as a string based on the provided input argument. ### Method GET ### Endpoint simetrix.script.functions.GetAxisType ### Parameters #### Path Parameters - **arg1** (str | list[str] | GroupVector) - Required - The input for which to determine the axis type. ### Response #### Success Response (200) - **return** (str) - The axis type. ``` -------------------------------- ### select Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Brings a schematic sheet into focus. ```APIDOC ## select ### Description Selects a schematic sheet, bringing it into focus. ### Response - **return** (SchematicStatus) - Returns NOERR, NOSCHEMATIC, or UNEXPECTED. ``` -------------------------------- ### simetrix.script.commands.Anno Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.Anno.html Documentation for the Anno command used to handle annotations in SIMetrix/SIMPLIS. ```APIDOC ## Anno ### Description The Anno command is used to perform annotation operations within the SIMetrix/SIMPLIS environment. ### Method Python Function Call ### Parameters #### Arguments - **command** (str) - Optional - The annotation command string to be executed. ``` -------------------------------- ### simetrix.script.commands.AppendGroup Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.AppendGroup.html Appends a group to the current simulation or analysis setup. ```APIDOC ## simetrix.script.commands.AppendGroup ### Description Appends a group to the current simulation or analysis setup. This command is part of the SIMetrix scripting interface. ### Method `AppendGroup()` ### Endpoint N/A (This is a Python function within the SIMetrix scripting environment) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_command** (str) - Optional - The command string to be appended as a group. If None, a default group might be created or the command might operate on the current context. ### Request Example ```python import simetrix simetrix.script.commands.AppendGroup(_command="my_new_group") ``` ### Response #### Success Response (None) This function returns None upon successful execution. #### Response Example None ``` -------------------------------- ### simetrix.script.commands.Let Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.Let.html Documentation for the Let command used to assign values or evaluate expressions in the SIMetrix environment. ```APIDOC ## Let ### Description The Let command is used to assign a value to a variable or evaluate an expression within the SIMetrix script environment. ### Parameters #### Path Parameters - **command** (str) - Optional - The expression or assignment string to be executed. ``` -------------------------------- ### GetHostId Function Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GetHostId.html Retrieves the host ID for the current SIMetrix/SIMPLIS installation. ```APIDOC ## GetHostId ### Description Retrieves the host identifier for the SIMetrix/SIMPLIS environment. ### Method Function Call ### Endpoint simetrix.script.functions.GetHostId ### Parameters #### Arguments - **arg1** (str | list[str] | GroupVector) - Optional - Argument for the function call. ### Response - **Return Value** (str) - The host identifier string. ``` -------------------------------- ### Importing Modules Source: https://help.simetrix.co.uk/9.4/python/getting-started/examples/demo-1-SIMetrix/index.html Imports the simetrix module and the standard math library for calculations. ```python # import simetrix module import simetrix as sx import math ``` -------------------------------- ### Template Get Property Value Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves a property value from a template. ```APIDOC ## TemplateGetPropValue ### Description Retrieves a property value from a template. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `TemplateGetPropValue(arg1, arg2)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### simetrix.script.commands.Inst() Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.Inst.html The Inst command is used to instantiate or manage instances within the SIMetrix environment. It can be called with an optional command string. ```APIDOC ## simetrix.script.commands.Inst() ### Description Instantiates or manages instances within the SIMetrix environment. This command can be initialized with an optional command string. ### Method `Inst` (Constructor) ### Endpoint N/A (Python function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from simetrix.script.commands import Inst # Example usage with a command string instance_manager = Inst("_command='some_command_string'") # Example usage without a command string instance_manager_default = Inst() ``` ### Response #### Success Response (200) None (This function returns None upon successful execution, but it initializes an object for managing instances). #### Response Example None ``` -------------------------------- ### Function: InstPoints Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.InstPoints.html Retrieves instance points based on provided arguments. ```APIDOC ## Function: InstPoints ### Description Returns a list of integers representing instance points based on the provided input arguments. ### Parameters - **arg1** (str | list[str] | GroupVector) - Optional - First argument for point identification. - **arg2** (str | list[str] | GroupVector) - Optional - Second argument for point identification. - **arg3** (float | list[float] | GroupVector) - Optional - Third argument for point identification. ### Returns - **list[int]** - A list of integer values representing the instance points. ``` -------------------------------- ### GET simetrix.script.functions.SelectedStyleInfo Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.SelectedStyleInfo.html Retrieves style information based on the provided arguments. ```APIDOC ## GET simetrix.script.functions.SelectedStyleInfo ### Description Retrieves style information for the specified elements. ### Method Function Call ### Parameters #### Arguments - **arg1** (str | list[str] | GroupVector) - Required - The input identifier or list of identifiers for which to retrieve style information. ### Response - **Returns** (list[str]) - A list of strings containing the style information for the selected elements. ``` -------------------------------- ### GET simetrix.script.functions.PropFlags Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.PropFlags.html Retrieves property flags based on the provided arguments. ```APIDOC ## GET simetrix.script.functions.PropFlags ### Description Retrieves property flags for specified components or objects within the SIMetrix/SIMPLIS environment. ### Method GET ### Parameters #### Path Parameters - **arg1** (str | list[str] | GroupVector) - Required - First argument for property flag identification. - **arg2** (str | list[str] | GroupVector) - Optional - Second argument for property flag identification. - **arg3** (str | list[str] | GroupVector) - Optional - Third argument for property flag identification. - **arg4** (float | list[float] | GroupVector) - Optional - Fourth argument for property flag identification. ### Response #### Success Response (200) - **Return Value** (list[str]) - A list of strings representing the property flags. ``` -------------------------------- ### GET simetrix.script.functions.OptimiserSimulatorUserMessage Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.OptimiserSimulatorUserMessage.html Retrieves the current user message from the optimiser simulator. ```APIDOC ## GET simetrix.script.functions.OptimiserSimulatorUserMessage ### Description Retrieves the current user message from the optimiser simulator. ### Method GET ### Endpoint simetrix.script.functions.OptimiserSimulatorUserMessage() ### Response #### Success Response (200) - **return** (str | None) - Returns the user message as a string, or None if no message is available. ``` -------------------------------- ### simetrix.script.functions.BuildMclogHTML Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.BuildMclogHTML.html Builds an HTML log file from simulation data. ```APIDOC ## simetrix.script.functions.BuildMclogHTML ### Description Builds an HTML log file from simulation data. ### Method N/A (This is a function call, not a REST API endpoint) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```python simetrix.script.functions.BuildMclogHTML(_arg1, _arg2, _arg3) ``` ### Response #### Success Response (bool) - **return_value** (bool) - True if the HTML log was built successfully, False otherwise. #### Response Example ```json { "return_value": true } ``` ### Parameters Details - **_arg1** (str | list[str] | GroupVector_) - Required - The first argument for building the log. - **_arg2** (str | list[str] | GroupVector_) - Required - The second argument for building the log. - **_arg3** (str | list[str] | GroupVector_) - Optional - The third argument for building the log. ``` -------------------------------- ### GET simetrix.script.functions.CommandStatus Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.CommandStatus.html Retrieves the status of commands as a list of boolean values. ```APIDOC ## GET simetrix.script.functions.CommandStatus ### Description Returns the status of executed commands as a list of boolean values. ### Method GET ### Endpoint simetrix.script.functions.CommandStatus() ### Response #### Success Response (200) - **return** (list[bool]) - A list of boolean values representing the status of commands. ``` -------------------------------- ### properties() - Get All Properties Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.dvm.ControlSymbol.html Returns a list of all properties associated with an object. ```APIDOC ## GET /properties ### Description Returns the set of properties for this object. ### Method GET ### Endpoint `/properties` ### Response #### Success Response (200) - **properties** (list[Property]) - A list of Property objects, each detailing a property of the object. #### Response Example ```json { "properties": [ { "name": "REF", "value": "Q6", "visible": true }, { "name": "value", "value": "10k", "visible": false } ] } ``` ``` -------------------------------- ### GetSimulationInfo() Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GetSimulationInfo.html Retrieves information about the current simulation. ```APIDOC ## GetSimulationInfo() ### Description Retrieves information about the current simulation. ### Method N/A (This is a function call, not an HTTP request) ### Endpoint N/A ### Parameters This function does not take any parameters. ### Request Example ```python simulation_info = simetrix.script.functions.GetSimulationInfo() ``` ### Response #### Success Response (list[str]) Returns a list of strings, where each string contains information about the simulation. #### Response Example ```json [ "Simulation Type: Transient", "Simulation Time: 10ms", "Step Size: 1us" ] ``` ``` -------------------------------- ### run Method Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Runs a simulation on the schematic. ```APIDOC ## run ### Description Runs a simulation on the schematic. ### Parameters #### Query Parameters - **parameters** (dict) - Optional - Simulation parameters. - **analysisOverride** (string) - Optional - Override for the analysis type. - **options** (dict) - Optional - Simulation options. ``` -------------------------------- ### About Command Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.About.html The About command displays information about the SIMetrix/SIMPLIS software. ```APIDOC ## About Command ### Description Displays information about the SIMetrix/SIMPLIS software. ### Method N/A (This is a script command, not an HTTP request) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python simetrix.script.commands.About() ``` ### Response #### Success Response (None) This command does not return a value, but displays information in the SIMetrix GUI or console. #### Response Example N/A ``` -------------------------------- ### WM Get System Widgets Layout Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the layout of system widgets. ```APIDOC ## WM_GetSystemWidgetsLayout ### Description Retrieves the layout of system widgets. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetSystemWidgetsLayout(arg1)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### WM Get Primary Window Name Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the name of the primary window. ```APIDOC ## WM_GetPrimaryWindowName ### Description Retrieves the name of the primary window. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetPrimaryWindowName()` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### Configuration and Property Setting Commands Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.commands.html Commands used to set various properties, configurations, and styles for schematic elements, graphs, and the simulator environment. ```APIDOC ## Set Commands ### Description Commands to set various properties and configurations. ### Method POST ### Endpoint /api/set ### Parameters #### Query Parameters - **command** (string) - Required - The specific set command (e.g., Set, SetAnnotationTextPosition, SetCurveName, SetDefaultEncoding, SetDisable, SetGraphAnnoProperty, SetGroup, SetHighlight, SetOrigin, SetPinPrefix, SetPinSuffix, SetReadOnly, SetRef, SetSnapGrid, SetStyleColour, SetSymbolFillStyle, SetSymbolOriginVisibility, SetUnits). ### Request Example ```json { "command": "Set" } ``` ``` -------------------------------- ### Write Simulator Options Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html Writes simulator options to the F11 window. This example sets the relative tolerance ('reltol') to 1e-4 and the simulation method ('method') to 'gear'. The `CheckStatus` method is used to verify the operation's success. ```python import simetrix as sx schem_file = "%DOCSPATH%/SIMetrix/Examples-93/SIMetrix/General/AMP.sxsch" schem = sx.openSchematic(schem_file) schem.CheckStatus (schem.writeF11Options( [('reltol', 1e-4 ), ('method', 'gear' )])) ``` -------------------------------- ### WM Get Number Modified Editors Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the number of modified editors. ```APIDOC ## WM_GetNumberModifiedEditors ### Description Retrieves the number of modified editors. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetNumberModifiedEditors()` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### WM Get Current Window Name Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the name of the current window. ```APIDOC ## WM_GetCurrentWindowName ### Description Retrieves the name of the current window. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetCurrentWindowName()` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### WM Get Current Widget Info Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves information about the current widget. ```APIDOC ## WM_GetCurrentWidgetInfo ### Description Retrieves information about the current widget. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetCurrentWidgetInfo(arg1)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### Run Simulation with Parameter Source: https://help.simetrix.co.uk/9.4/python/getting-started/examples/demo-3-SIMetrix-Step-Load/index.html Use the `run()` method to execute a simulation with specific parameters. Parameters are passed as a list of strings in the format 'PARAMETER_NAME=VALUE'. This is useful for sweeping values or setting initial conditions. ```python import simetrix as sx import math # Function to calculate RMS def rms(y, x) : prev_y = y[0] prev_x = x[0] ss = 0 for idx, v in enumerate(y): time = x[idx] ss = ss + (v*v + prev_y*prev_y + v*prev_y)/3 * (time-prev_x) prev_y = v prev_x = time return math.sqrt(ss/prev_x) # Get schematic schematic = sx.currentSchematic() # Load resistor values rloads = [1000, 500, 200] for rload in rloads : # Run schematic setting RLOAD parameter to rload sim = schematic.run(["RLOAD=" + str(rload)]) ## Get VOUT vector vout = sim.primaryGroup.vectorOfName("VOUT") # Calculate RMS rms_vout = rms(vout.ydata, vout.xdata) # Print result print("Rload =", rload, "RMS =", rms_vout) ``` -------------------------------- ### WM Get Content Widget Types Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the types of content widgets. ```APIDOC ## WM_GetContentWidgetTypes ### Description Retrieves the types of content widgets. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetContentWidgetTypes(arg1)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### StringStartsWith Function Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.StringStartsWith.html The StringStartsWith function checks if a given string or a list of strings starts with a specified prefix. It can accept a single string or a list of strings as the first argument and a single string or a list of strings as the second argument (the prefix to check against). ```APIDOC ## simetrix.script.functions.StringStartsWith ### Description Checks if a string or list of strings starts with a specified prefix. ### Method N/A (This is a function call, not an HTTP method) ### Endpoint N/A (This is a Python function within the SIMetrix scripting environment) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - `_arg1` (str | list[str] | GroupVector_) - The string or list of strings to check. - `_arg2` (str | list[str] | GroupVector_) - The prefix string or list of strings to check against. ### Returns - `str` - A string indicating the result of the check. The exact format of the returned string is not detailed in the provided text, but it typically signifies a boolean outcome (e.g., 'true'/'false' or 1/0). ### Request Example ```python # Example usage (assuming _arg1 and _arg2 are defined) result = simetrix.script.functions.StringStartsWith(_arg1, _arg2) print(result) ``` ### Response #### Success Response (200) - `result` (str) - The outcome of the string comparison. ``` -------------------------------- ### WM Get Content Widget Names Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.html Retrieves the names of content widgets. ```APIDOC ## WM_GetContentWidgetNames ### Description Retrieves the names of content widgets. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example `WM_GetContentWidgetNames(arg1)` ### Response #### Success Response (200) None (function execution) #### Response Example None ``` -------------------------------- ### GetSystemInfo Function Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GetSystemInfo.html Retrieves system information from the SIMetrix environment. ```APIDOC ## GetSystemInfo ### Description Retrieves system information as a list of strings. ### Method Function Call ### Endpoint simetrix.script.functions.GetSystemInfo() ### Response #### Success Response (200) - **return** (list[str]) - A list of strings containing system information. ``` -------------------------------- ### simetrix.script.functions.ReadConfigSetting Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.ReadConfigSetting.html Retrieves configuration settings based on provided arguments. ```APIDOC ## ReadConfigSetting ### Description Reads a configuration setting from the SIMetrix environment. ### Parameters - **arg1** (str | list[str] | GroupVector) - Required - The primary configuration key or identifier. - **arg2** (str | list[str] | GroupVector) - Optional - An additional identifier or sub-key for the configuration setting. ### Response - **Returns** (list[str]) - A list of strings representing the retrieved configuration values. ``` -------------------------------- ### GET simetrix.script.functions.floorv Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.floorv.html Documentation for the floorv function which calculates the floor of the provided input. ```APIDOC ## FUNCTION simetrix.script.functions.floorv ### Description Calculates the floor of the input argument and returns a GroupVector. ### Parameters #### Arguments - **arg1** (float | complex | list[float] | list[complex] | GroupVector) - Required - The value or vector to process. ### Returns - **GroupVector** - The result of the floor operation. ``` -------------------------------- ### GET simetrix.script.functions.SupportedReadFormats Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.SupportedReadFormats.html Retrieves a list of supported file formats for reading in SIMetrix. ```APIDOC ## GET simetrix.script.functions.SupportedReadFormats ### Description Returns a list of strings representing the file formats that can be read by the SIMetrix system. ### Method GET ### Endpoint simetrix.script.functions.SupportedReadFormats() ### Response #### Success Response (200) - **return** (list[str]) - A list of supported file format extensions or identifiers. #### Response Example [ "sxdat", "csv", "txt" ] ``` -------------------------------- ### Open Schematic and Run AC Analysis Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.GroupVector.html This snippet demonstrates how to open a schematic, run an AC analysis, and process the results. ```APIDOC ## Open Schematic and Run AC Analysis ### Description Opens a specified schematic file, performs an AC analysis, and retrieves simulation results. ### Method Python Scripting (SIMetrix API) ### Endpoint N/A (Local Script Execution) ### Parameters None ### Request Example ```python import simetrix as sx import numpy as np schematic = sx.openSchematic("%DOCSPATH%/SIMetrix/Examples-94/SIMetrix/General/AMP.sxsch") if schematic.valid: result = schematic.run([], [".ac dec 500 1k 100000000"]) if result.status == sx.RunStatus.success: dataGroup = result.primaryGroup vector = dataGroup.vectorOfName("Vout") ydata = np.array(vector[0].y) xdata = np.array(vector[0].x) data_db = 20 * np.log10(abs(ydata)) peak_mag_db = np.max(data_db) target_db = peak_mag_db - 3 indices = np.where(data_db < target_db)[0] if len(indices) > 0: print("-3db point:", xdata[indices[0]]) else: print(result.status) print(result.errorMessage) else: print("There are no schematics open") ``` ### Response #### Success Response Prints the -3dB frequency point if the analysis is successful and the point is found. #### Response Example ``` -3db point: 125892.54 ``` ``` -------------------------------- ### simetrix.script.functions.MakeTree Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.MakeTree.html Documentation for the MakeTree function which creates a directory tree. ```APIDOC ## FUNCTION simetrix.script.functions.MakeTree ### Description Creates a directory tree structure. ### Parameters - **arg1** (str | list[str] | GroupVector) - Required - The path or list of paths to create as a tree structure. ### Returns - **bool** - Returns True if the operation was successful, otherwise False. ``` -------------------------------- ### Get Available Python Versions Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.PythonVersions.html Retrieves a list of all supported Python versions. ```APIDOC ## GET simetrix.script.functions.PythonVersions ### Description Retrieves a list of all supported Python versions available in the SIMetrix environment. ### Method GET ### Endpoint simetrix.script.functions.PythonVersions() ### Parameters This function does not accept any parameters. ### Response #### Success Response (200) - **versions** (list[str]) - A list of strings, where each string represents a supported Python version. #### Response Example ```json { "versions": [ "3.8.10", "3.9.7", "3.10.4" ] } ``` ``` -------------------------------- ### GET simetrix.script.functions.OptimiserSimulatorResults Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.OptimiserSimulatorResults.html Retrieves the results from the optimiser simulator as a list of floating-point numbers. ```APIDOC ## GET simetrix.script.functions.OptimiserSimulatorResults ### Description Retrieves the results from the optimiser simulator. ### Method GET ### Endpoint simetrix.script.functions.OptimiserSimulatorResults() ### Response #### Success Response (200) - **results** (list[float]) - A list of floating-point numbers representing the optimiser simulator results. ``` -------------------------------- ### simetrix.script.functions.GetAllSimulatorDevices Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GetAllSimulatorDevices.html Retrieves a list of all simulator devices available in the SIMetrix environment. ```APIDOC ## simetrix.script.functions.GetAllSimulatorDevices ### Description Retrieves a list of all simulator devices available in the SIMetrix environment. ### Method GET ### Endpoint /simetrix/script/functions/GetAllSimulatorDevices ### Parameters None ### Request Example None ### Response #### Success Response (200) - **devices** (list[str]) - A list of strings, where each string is the name of an available simulator device. #### Response Example { "devices": ["HSPICE", "Spectre", "ADS", "CustomSim"] } ``` -------------------------------- ### GET simetrix.script.functions.HighlightedNets Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.HighlightedNets.html Retrieves the list of currently highlighted nets in the simulation environment. ```APIDOC ## GET simetrix.script.functions.HighlightedNets ### Description Returns a list of strings representing the names of nets that are currently highlighted. ### Parameters #### Arguments - **arg1** (float | list[float] | GroupVector) - Optional - An optional argument to filter or specify the context for highlighted nets. ### Response - **Returns** (list[str]) - A list containing the names of the highlighted nets. ``` -------------------------------- ### OptimiserWidgetCreateOptDef Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.OptimiserWidgetCreateOptDef.html Documentation for the OptimiserWidgetCreateOptDef function. ```APIDOC ## Function: simetrix.script.functions.OptimiserWidgetCreateOptDef ### Description Creates an optimization definition using the SIMetrix/SIMPLIS scripting interface. ### Endpoint simetrix.script.functions.OptimiserWidgetCreateOptDef() ### Response - **return** (int) - Returns an integer status code. ``` -------------------------------- ### GET simetrix.script.functions.GraphLimits Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.script.functions.GraphLimits.html Retrieves the current graph limits as a list of floating-point numbers. ```APIDOC ## GET simetrix.script.functions.GraphLimits ### Description Returns the current limits of the active graph. ### Method GET ### Endpoint simetrix.script.functions.GraphLimits() ### Response #### Success Response (200) - **return** (list[float]) - A list containing the graph limits. ``` -------------------------------- ### Netlist Configuration Options Source: https://help.simetrix.co.uk/9.4/python/generated/simetrix.Schematic.html This section describes the parameters that can be used to configure the netlist generation process. ```APIDOC ## Netlist Configuration Options ### Description This section details various options that can be passed to the netlist generation function to customize its behavior. ### Method `schematic.netlist()` ### Parameters #### Query Parameters - **templates** (String) - Optional - Property names to be used as templates. A template is a string that specifies a format to be used for the netlist line for the device that owns it. By default the template property name is “TEMPLATE” in SIMetrix mode and “SIMPLIS_TEMPLATE in SIMPLIS mode. This can be overridden with this option. Multiple template property names may be specified by separating them with a pipe symbol (|). - **sep** (String) - Optional - May be a single character or “none”. Default is “$”. To comply with SPICE syntax each device line starts with a letter that identifies the type of device. Usually this letter is determined by the MODEL property. If the component reference of the device does not begin with the correct letter it is prefixed with the correct letter followed by the character specified by this option. - **wireTemplate** (String) - Optional - Format for bus wires. wire_template may contain the keywords %BUSNAME% and %WIRENUM%. These resolve to the bus name and wire number respectively. So a spec set to %BUSNAME%#%WIRENUM% would give the default, i.e. bus names like BUS1#2. A spec of %busname%[%wirenum%] would give bus names like BUS1[2]. - **dotEnd** (Boolean) - Optional - Forces .END to be placed at the end of the netlist. - **noDescend** (Boolean) - Optional - Netlister does not descend into hierarchy and processes items at the top level only. - **f11Top** (Boolean) - Optional - The contents of the F11 window are placed before the netlist lines generated by the schematic. Otherwise they are placed after the schematic netlist lines. - **nodemap** (Boolean) - Optional - Generates SIMPLIS .NODE_MAP statements for user named nets. - **sort** (Boolean) - Optional - If specified, the netlist lines will be output in alphanumeric sorted order. - **inhibitTemplateScripts** (Boolean) - Optional - Inhibits execution of template scripts. ### Request Example ```python import simetrix as sx schematic = sx.currentSchematic() # Example with multiple options nl = schematic.netlist(templates="MY_TEMPLATE|ALT_TEMPLATE", sep="_", wireTemplate="%BUSNAME%-%WIRENUM%", dotEnd=True, noDescend=False, f11Top=True, nodemap=True, sort=True, inhibitTemplateScripts=False) # Example with default options # nl = schematic.netlist() ``` ### Response #### Success Response (200) - **netlist_output** (String) - The generated netlist content. #### Response Example ```json { "netlist_output": "* Default Netlist\n* Created by SIMetrix\n... (netlist content) ...\n.END" } ``` ```