カスタムデータセットの例
nf1 = pf.NearField.GetDataSet("Horn.StandardConfiguration1.NearField1") -- Create custom dataset custom = pf.DataSet.New() for axisNum = 1,nf1.Axes.Count do sourceAxis = nf1.Axes[axisNum] custom.Axes:Add(sourceAxis.Name, sourceAxis.Unit, sourceAxis.Values) end custom.Quantities:Add("above5V", "scalar", "V/m") -- Populate the values function process5Vthreshold(index, target, source1) local magEx = source1[index].EFieldComp1:Magnitude() local magEy = source1[index].EFieldComp2:Magnitude() local magEz = source1[index].EFieldComp3:Magnitude() local totalE = math.sqrt(magEx^2 + magEy^2 + magEz^2) if (totalE >= 5) then target[index].above5V = totalE else target[index].above5V = 0 end end pf.DataSet.ForAllValues(process5Vthreshold, custom, nf1) print(custom) return custom
ここでは、customというDataSetに、給電源の近傍界と同じ空間軸が設定され、定義済みの任意の量が追加されています。このDataSetが有効であるためには、すべての軸上の各位置にスカラー値を定義する必要があります。DataSetは、その全体がスクリプト内部で作成されています。AxesとQuantitiesをDataSetに追加して、データが入力されています。この方法で生成された結果は、内部データタイプと同様に、3Dビューまたは2Dビューにプロットできます。