Creating the Lua Settings File

Specify the loading and excitations for each port using a Lua settings file.

  1. Open a text editor and create the following settings file:
    -- Non-active port configuration 
    nonActivePortsConfiguration = {}
    nonActivePortsConfiguration.Data = {}
    -- Empty non-Active port configuration since all ports are active.
    
    -- Active port configuration  
    activePortsConfiguration = {}
    activePortsConfiguration.Load ={}
    activePortsConfiguration.Load.Data ={}
    -- Source Port1 source = {}
    source.Label = "Port1"
    source.Index = 1
    source.Value = pf.Complex(1,0)
    table.insert(activePortsConfiguration,source)
    -- Load attached to active port 1
    -- Type = 1 (direct connection),
    -- Type = 2 (complex), 
    -- Type = 3 (one port Touchstone network), 
    -- Type = 4 (two port Touchstone network)
    load ={}
    load.Type = 2 
    load.Value = pf.Complex(10,-30)
    table.insert(activePortsConfiguration.Load.Data,load)
    -- Source for Port2  
    source = {}
    source.Label = "Port2"
    source.Index = 2
    source.Value = pf.Complex(1,0)
    table.insert(activePortsConfiguration,source)
    -- Load attached to active port 2
    load ={}
    load.Type = 2
    load.Value = pf.Complex(70,-30)
    table.insert(activePortsConfiguration.Load.Data,load)
    -- Source Port3
    source = {}
    source.Label = "Port3"
    source.Index = 3
    source.Value = pf.Complex(1,0)
    table.insert(activePortsConfiguration,source)
    -- Load attached to active port 3
    load ={}
    load.Type = 2
    load.Value = pf.Complex(105,-30)
    table.insert(activePortsConfiguration.Load.Data,load)
    -- Source Port4
    source = {}
    source.Label = "Port4"
    source.Index = 4
    source.Value = pf.Complex(1,0)
    table.insert(activePortsConfiguration,source)
    -- Load attached to active port 4
    load ={}
    load.Type = 2 
    load.Value = pf.Complex(50,0)
    table.insert(activePortsConfiguration.Load.Data,load)
    -- Return the configurations in a settings table
    return {activePortsConfiguration, nonactivePortsConfiguration}
    
  2. Save the example3_settings.lua file.