Demo 4: SIMPLIS Step Load

Download demo 4 Schematic

Download demo 4 Python code

In this example a SIMPLIS simulation is run three times, each time the measurements from a plotted graph are displayed.

The demonstration combines ideas presented in demo 3 and demo 2 for a SIMPLIS schematic. Here is the code in full:

 1import simetrix as sx
 2
 3# Get Schematic object. If schematic is not already visible, it will be opened
 4# for display
 5schem = sx.openSchematic("Freq_Response_2.sxsch", [sx.SchematicOptions.VISIBLE])
 6
 7# Values for load resistance (R19)
 8R19values = ["20","24","50"]
 9
10# Save original value so it can be restored
11R19_orig_value = schem.getComponentValue("R19.value").value
12
13# Iterate through required load values
14for R19 in R19values :
15
16    schem.setComponentValue("R19.value", R19)
17
18    sim = schem.run()
19
20    if sim.status==sx.RunStatus.success :
21
22        # get graph
23        graph = sx.currentGraph()
24
25        # get curves
26        curves = graph.curves
27
28        # for each curve obtain the measurement objects
29        print("\nResults with Load = ", R19)
30        for curve in curves() :
31
32            # measurement_objects is the list of measurement objects for curve
33            measurement_objects = curve.prop("MeasurementIds").objects
34
35            # Iterate through each measurement
36            for v in measurement_objects  :
37                # Print curve name followed by measurement label then measurement value
38                print(curve.prop("Name").string, v.prop("Label").string, "=", v.prop("RawValues").strings[0])
39    else :
40        print("Run failed, status =", sim.status)
41
42# Restore R19 to original value
43schem.setComponentValue("R19.value", R19_orig_value)