Page tree
Skip to end of metadata
Go to start of metadata

This script will add piece wise linear optimization goals to a project. You can select which measurement will be used for the goal.

        ' Code Module
        Dim sch As String
        Dim measn As String
        Dim measName () As String
        Dim grp As Graph
        Dim meas As Measurement
        Sub Main
        numgraph = Project.Graphs.Count
           For i=1 To numgraph
                        nummeas = nummeas + Project.Graphs(i).Measurements.Count
                Next i
                ReDim measName(nummeas)
                For i=1 To numgraph
                        For Each meas In Project.Graphs(i).Measurements
                                x = Replace(x,".$FDOC","")
                                measName(j) = Join(Array(x,":",meas.MeasName),"")
                                'Debug.Print meas.SourceName
                        Next meas
                Next i
                Begin Dialog UserDialog 400,200,"Select Measurement For Optimization Goals" ' %GRID:10,7,1,1
                        ListBox 40,35,310,100,measName(),.lstdataBox,1
                        Text 40,21,160,14,"Select Measurement",.Text1
                        OKButton 150,160,100,28
                End Dialog
                Dim dlg1 As UserDialog
                Dialog dlg1
                measindexi = dlg1.lstdataBox
                measindexi = measindexi + 1
                measnamei = measName(measindexi)
            tokens = Split(measnamei,":")
            sch = tokens(0)
            measn = tokens(1)
            flist = Array(1e9,2e9,3e9,4e9,5e9,6e9)
            glist= Array(-20, -20, -1, -1, -20, -20)
            num_pts = UBound(flist)
                For i=1 To num_pts Step 1
            Next i
        End Sub