目的関数
概要
Objective function to optimize欄では、目的関数に適用する演算を選択する必要があります。これは、提供されるPredefined Operationの簡単なリストで定義するか、Composeで定義されたカスタム関数で定義できます。
下の項の表は、事前定義されたすべての演算をまとめています。
事前定義された演算
関数 | 式 |
---|---|
設計の応答(引数の全体最適化) | |
応答の平均(AVG) | |
応答の絶対値の平均(AVGABS) | |
応答の最大(MAX) | |
絶対応答の最大(MAXABS) | |
応答の最小(MIN) | |
絶対応答の最小(MINABS) | |
応答の二乗平均平方根の値(RMS) | |
Sum of squares of responsesの平方根(RSS) | |
Sum of squares of responses(SSQ) | |
応答の合計(SUM) | |
応答の絶対値の合計(SUMABS) |
Compose関数
量に対するカスタム演算は、Compose関数で定義することもできます。この関数はスカラー値を返す必要があります。この関数の例を以下に示します:
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Objective function %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
function [rresp, dresp, udata] = Obj_Func(iparam, rparam, nparam, iresp, rresp, dresp, nresp, isens, udata)
% iparam - vector of ints
% rparam - vector of doubles
% nparam - size of input vector
% iresp - vector of ints
% rresp - output parameter (vector of ints)
% dresp - output parameter (matrix of MxN dimension)
% nresp - size of output vector
% isens - sensitivity flag
% udata - userdata
Torque = rparam(1:nparam); % This variable contains all the values of the reponses for all the time steps,
% In this function, it contains the torque for each time step over an electrical period
Tr = mean(Torque) % Custom function based on the response previouly defined in Flux, computation of the torque ripple
rresp(1) = Tr % The mean value of the torque is used as an objective function
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Constraint function %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Lower and upper bounds of the constraint function are setted Flux
function [rresp, dresp, udata] = Cons(iparam, rparam, nparam, iresp, rresp, dresp, nresp, isens, udata)
% iparam - vector of ints
% rparam - vector of doubles
% nparam - size of input vector
% iresp - vector of ints
% rresp - output parameter (vector of ints)
% dresp - output parameter (matrix of MxN dimension)
% nresp - size of output vector
% isens - sensitivity flag
% udata - userdata
Torque = rparam(1:nparam); % This variable contains all the values of the reponses for all the time steps,
% In this function, it contains the torque for each time step over an electrical period
Tr = ( ( max(Torque) - min(Torque) ) / mean(Torque) ) *100 % Custom function based on the response previouly defined in Flux, computation of the torque ripple rate
rresp(1) = Tr
end
OMLファイルは.FLUプロジェクトと同じフォルダー内に配置する必要があります。