Script

View the completed CADFEKO automation script.

Create the model geometry.

--[[
Script exchange is a value added initiative through which customers can
upload or download scripts that help simplify their processes and reduce the effort of repetitive work.

THE SCRIPT exCHANGE IS PROVIDED ON AN "AS-IS" BASIS. USE OF THE SCRIPTS AND
RELIANCE ON ANY
RESULTS DERIVED THEREFROM IS SOLELY AND STRICTLY AT THE USER'S DISCRETION.
ALTAIR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, exPRESS OR
IMPLIED, AND exPRESSLY
DISCLAIMS THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
ALTAIR DOES NOT WARRANT THE OPERATION, ACCURACY, CORRECTNESS OR
COMPLETENESS OF THE SCRIPTS
OR ANY RESULTS DERIVED THEREFROM.
--]]

-- =========================================================================== --
--  PATCH ANTENNA ON PLANAR MULTILAYER SUBSTRATE 
-- =========================================================================== --
--[[
This script creates a patch antenna on a planar multilayer substrate
NOTE: This example is only to be used as an example to demonstrate
how to automate tasks that are often required in CADFEKO.
An electromagnetic solution is only performed to obtain results to
demonstrate how to automate tasks often required in POSTFEKO.]]--

app = cf.GetApplication()
my_project = app:NewProject()

-- Create a rectangle
corner1 = cf.Point(-0.25, -0.25, 0)
my_rectangle = my_project.Geometry:AddRectangle(corner1, 0.5, 0.5)

-- Create dielectrics
my_diel = my_project.Media:AddDielectric()
my_diel.Label = "substrate"
my_diel.DielectricModelling.RelativePermittivity = 1.5
my_diel2_properties = cf.Dielectric.GetDefaultProperties()
inspect(my_diel2_properties)
my_diel2_properties.DielectricModelling.ConductivityType =
cf.Enums.MediumDielectricConductivityTypeEnum.Conductivity
my_diel2_properties.DielectricModelling.Conductivity = "1e-2"
my_diel2_properties.DielectricModelling.RelativePermittivity = "2.5"
my_diel2_properties.Label = "substrate2"
my_diel2 = my_project.Media:AddDielectric(my_diel2_properties)

-- Create a planar multilayer substrate
my_project.GroundPlane.DefinitionMethod = 
cf.Enums.GroundPlaneDefinitionMethodEnum.MultilayerSubstrate
my_project.GroundPlane.Layers:Add(2,"None","0.351",my_diel2)
my_project.GroundPlane.Layers:Modify(3,"PEC","0.2",my_diel) 

-- Create the feed pin
startPoint = cf.Point(0,0,0)
endPoint = cf.Point(0,0,-0.551)
my_line = my_project.Geometry:AddLine(startPoint,endPoint)
my_line.Label = "my_line_Line1"

-- Union the line and rectangle
my_Union = my_project.Geometry:Union()

Create the wire port, add voltage source, define the frequency, mesh the model, add requests.

-- Create a wire port
my_port = my_project.Ports:AddWirePort(my_Union.Wires[1])
my_port.Location = cf.Enums.WirePortLocationEnum.End 

-- Add a voltage source as part of configuration
this_config = my_project.SolutionConfigurations[1]
my_voltage_source = this_config.Sources:AddVoltageSource(my_port) 

-- Set the frequency
this_config.Frequency.Start = "3e8"

-- Create the mesh
my_project.Mesher.Settings.WireRadius = "0.001"
my_project.Mesher:Mesh() 

-- Add a far field request
my_farfield = this_config.FarFields:Add3DPattern()
properties = my_farfield:GetProperties()
inspect(properties)
properties.Theta.End = "89"
properties.Theta.Increment = "1"
my_farfield:SetProperties(properties) 

-- Add all currents request
my_currents = this_config.Currents:Add()

-- Zoom to extents in the 3D view
app.Views[1]:ZoomToExtents()

Launch the Solver.

-- Enable the parallel Solver
my_project.Launcher.Settings.FEKO.Parallel.Enabled = true

-- Save the *.cfx file
app:SaveAs([[patch_antenna_scripted_model.cfx]])

-- Run the Solver
my_project.Launcher:RunFEKO()