unit Funcs; {!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Ф У Н К Ц И О Н А Л Ь Н Ы Е Б Л О К И !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} interface uses WinTypes, WinProcs,gltype,glproc,MathObj,Math,srcs,Classes,MVTU_TLB; function TFun0(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun1(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun4(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun5(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun6(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun7(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun8(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun9(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun10(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun11(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun12(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun13(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun14(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun15(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun16(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun17(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun18(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; function TFun19(at,adt:RealType;var time,dtime:RealType;var AU,AY:TPtrExt;var AX,ADX:array of RealType; var CU,CY : TIntArray;var Prop:TPtrArray;var Vars:Pointer;Action:Integer):Integer;export; {********************************************************************************************************} IMPLEMENTATION {********************************************************************************************************} {--------------------------------------------------------------------------- Усилитель входного сигнала - y=K*u ---------------------------------------------------------------------------} function TFun0Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Усилитель'; var Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: begin MVTU.SetBlockProp(BlockId,'a',PChar(PropStr[0]),Res); end; end; end; function TFun0; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun0Convert); f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=arr^[0]*AU.Ptr(0).arr^[j]; if abs(x) > ymax then begin Result:=er_overflow_y;exit end; AY.Ptr(0).arr^[j]:=x end; end{END CASE} end;{END TFUN0} {--------------------------------------------------------------------------- Полином - y=a0 + a1*u + a2*u^2 + ... an*u^(n-1) ---------------------------------------------------------------------------} function TFun1Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Полиноминальная функция'; var Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try MVTU.SetBlockProp(BlockId,'a',PChar(ConvertVector(PropStr[0])),Res); finally end; end; end; function TFun1; var i,j : Integer; Sum,Mul : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun1Convert); f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : begin for j:=0 to AU.Ptr(0).Count-1 do begin Sum:=0.0;Mul:=1.0; for i:=0 to Count-1 do begin Sum:=Sum+arr^[i]*Mul; if abs(sum) > ymax then begin Result:=er_overflow_y;exit end; Mul:=Mul*AU.val(0,j); end; AY.Ptr(0).arr^[j]:=Sum end end; end{END CASE} end;{END TFUN1} {--------------------------------------------------------------------------- Функция синуса - y=A*SIN[B*u+C] ---------------------------------------------------------------------------} function TFun4Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Синусоидальная функция'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun4; var j : Integer; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun4Convert); f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do AY.Ptr(0).arr^[j]:=arr^[0]*SIN(arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]); end{END CASE} end;{END TFUN4} {--------------------------------------------------------------------------- Функция экспоненты - y=A*EXP[B*u+C] ---------------------------------------------------------------------------} function TFun5Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Экспоненциальная функция'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'b',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'c',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun5; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun5Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=arr^[0]*EXP(arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]); if abs(x) > ymax then begin Result:=er_overflow_y;exit end; AY.Ptr(0).arr^[j]:=x end; end{END CASE} end;{END TFUN5} {--------------------------------------------------------------------------- Функция гиперболы - y(t)=A*/[u(t)+EPS] ---------------------------------------------------------------------------} function TFun6Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Гиперболическая функция'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'k',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'eps',PChar(SL[1]),Res); finally SL.Free; end; end; end; function TFun6; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun6Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=AU.Ptr(0).arr^[j]+arr^[1]; if x = 0.0 then begin Result:=er_zerodivide;exit end; x:=arr^[0]/x; if abs(x) > ymax then begin Result:=er_overflow_y;exit end; AY.Ptr(0).arr^[j]:=x end; end{END CASE} end;{END TFUN6} {--------------------------------------------------------------------------- АРКСИНУС - y=a0*ARCSIN[a1*u(t)+a2] ---------------------------------------------------------------------------} function TFun7Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Арксинус'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun7; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun7Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]; if abs(x) > 1.0 then begin Result:=er_overflow_y;exit end; if x = -1.0 then AY.Ptr(0).arr^[j]:=-arr^[0]*pi/2 else if x = 1.0 then AY.Ptr(0).arr^[j]:=arr^[0]*pi/2 else AY.Ptr(0).arr^[j]:=arr^[0]*ARCTAN(x/sqrt(1-sqr(x))) end; end{END CASE} end;{END TFUN7} {--------------------------------------------------------------------------- АРККОСИНУС - y=a0*ARCCOS[a1*u(t)+a2] ---------------------------------------------------------------------------} function TFun8Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Арккосинус'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun8; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun8Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]; if abs(x) > 1.0 then begin Result:=er_overflow_y;exit end; if x = -1.0 then AY.Ptr(0).arr^[j]:=arr^[0]*pi else if x = 1.0 then AY.Ptr(0).arr^[j]:=0 else AY.Ptr(0).arr^[j]:=arr^[0]*(pi/2-ARCTAN(x/sqrt(1-sqr(x)))) end; end{END CASE} end;{END TFUN8} {--------------------------------------------------------------------------- АРКТАНГЕНС - y=a0*ARCTG[a1*u(t)+a2] ---------------------------------------------------------------------------} function TFun9Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Арктангенс'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun9; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun9Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]; AY.Ptr(0).arr^[j]:=arr^[0]*ARCTAN(x) end; end{END CASE} end;{END TFUN9} {--------------------------------------------------------------------------- АРККОТАНГЕНС - y=a0*ARCCTG[a1*u(t)+a2] ---------------------------------------------------------------------------} function TFun10Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Арккотангенс'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun10; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun10Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]; AY.Ptr(0).arr^[j]:=arr^[0]*(pi/2-ARCTAN(x)) end; end{END CASE} end;{END TFUN10} {--------------------------------------------------------------------------- Косинус гиперболический - y(t)=0.5*A*(EXP[B*u(t)]+EXP[-B*u(t)]) ---------------------------------------------------------------------------} function TFun12Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Гиперболический косинус'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); finally SL.Free; end; end; end; function TFun12; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun12Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=AU.Ptr(0).arr^[j]*arr^[1]; if abs(x) > mante_max then begin Result:=er_overflow_y;exit end; x:=0.5*arr^[0]*(EXP(x)+EXP(-x)); AY.Ptr(0).arr^[j]:=x end; end{END CASE} end;{END TFUN12} {--------------------------------------------------------------------------- Синус гиперболический - y(t)=0.5*A*(EXP[B*u(t)]-EXP[-B*u(t)]) ---------------------------------------------------------------------------} function TFun11Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Гиперболический синус'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); finally SL.Free; end; end; end; function TFun11; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun11Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState :for j:=0 to AU.Ptr(0).Count-1 do begin x:=AU.Ptr(0).arr^[j]*arr^[1]; if abs(x) > mante_max then begin Result:=er_overflow_y;exit end; x:=0.5*arr^[0]*(EXP(x)-EXP(-x)); AY.Ptr(0).arr^[j]:=x end; end{END CASE} end;{END TFUN11} {--------------------------------------------------------------------------- Тангенс гиперболический - y(t)=A*(EXP[B*u(t)]-EXP[-B*u(t)])/(EXP[B*u(t)]+EXP[-B*u(t)]) ---------------------------------------------------------------------------} function TFun13Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Гиперболический тангенс'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); finally SL.Free; end; end; end; function TFun13; var j : Integer; x,x1,x2 : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun13Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState :for j:=0 to AU.Ptr(0).Count-1 do begin x:=AU.Ptr(0).arr^[j]*arr^[1]; if x > mante_max then AY.Ptr(0).arr^[j]:=arr^[0] else if x < -mante_max then AY.Ptr(0).arr^[j]:=-arr^[0] else begin x1:=EXP(x); x2:=EXP(-x); x:=arr^[0]*(x1-x2)/(x1+x2); AY.Ptr(0).arr^[j]:=x end end; end{END CASE} end;{END TFUN13} {--------------------------------------------------------------------------- Котангенс гиперболический - y(t)=A*(EXP[B*u(t)]+EXP[-B*u(t)])/(EXP[B*u(t)]-EXP[-B*u(t)]) ---------------------------------------------------------------------------} function TFun14Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Гиперболический котангенс'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); finally SL.Free; end; end; end; function TFun14; var j : Integer; x,x1,x2 : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun14Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=AU.Ptr(0).arr^[j]*arr^[1]; if x = 0.0 then begin Result:=er_zerodivide;exit end; if x > mante_max then AY.Ptr(0).arr^[j]:=arr^[0] else if x < -mante_max then AY.Ptr(0).arr^[j]:=-arr^[0] else begin x1:=EXP(x); x2:=EXP(-x); x:=arr^[0]*(x1+x2)/(x1-x2); AY.Ptr(0).arr^[j]:=x end end; end{END CASE} end;{END TFUN14} {--------------------------------------------------------------------------- Степенная функция - y(t)=A*u(t)^[B] ---------------------------------------------------------------------------} function TFun15Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Степенная функция'; var Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: begin MVTU.SetBlockProp(BlockId,'a',PChar(PropStr[0]),Res); end; end; end; function TFun15; var j : Integer; begin Result:=0; with PConstRec(Prop.arr)^ do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun15Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin if AU.Ptr(0).arr^[j] < 0 then begin Result:=er_negPow;exit end; AY.Ptr(0).arr^[j]:=PowerY(k^,AU.Ptr(0).arr^[j]) end; end{END CASE} end;{END TFUN15} {--------------------------------------------------------------------------- Показательная функция - y(t)=A^[u(t)*B] ---------------------------------------------------------------------------} function TFun16Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Показательная функция'; var Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: begin MVTU.SetBlockProp(BlockId,'a',PChar(PropStr[0]),Res); MVTU.SetBlockProp(BlockId,'b',PChar(PropStr[1]),Res); end; end; end; function TFun16; var j : Integer; x : RealType; begin Result:=0; with PConst2Rec(Prop.arr)^ do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun16Convert); f_EditErr : if k0^ <= 0 then Result:=er_RangeMin; f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AU.Ptr(0).Count-1 do begin x:=k1^*AU.Ptr(0).arr^[j]; { if abs(x) > mante_max then begin Result:=er_overflow_y;exit end;} AY.Ptr(0).arr^[j]:=PowerY(x,k0^) end; end{END CASE} end;{END TFUN16} {--------------------------------------------------------------------------- Показательная функция - y(t)=A*u1(t)^[u2(t)*B] ---------------------------------------------------------------------------} function TFun17Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Показательная функция с переменной амплитудой'; var Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: begin MVTU.SetBlockProp(BlockId,'a',PChar(PropStr[0]),Res); MVTU.SetBlockProp(BlockId,'b',PChar(PropStr[1]),Res); end; end; end; function TFun17; var j : Integer; x1,x2 : RealType; begin Result:=0; with PConst2Rec(Prop.arr)^ do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun17Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=min(CU.arr^[0],CU.arr^[1]); f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AY.Ptr(0).Count-1 do begin x2:=k1^*AU.Ptr(1).arr^[j]; x1:=AU.Ptr(0).arr^[j]; if x1 < 0 then begin Result:=er_negPow;exit end; AY.Ptr(0).arr^[j]:=k0^*PowerY(x2,x1) end; end{END CASE} end;{END TFUN17} {--------------------------------------------------------------------------- Десятичный логарифм - y(t)=A*LOG10[B*u(t)+C] ---------------------------------------------------------------------------} function TFun18Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Логарифм десятичный'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun18; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun18Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AY.Ptr(0).Count-1 do begin x:=arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]; if x <= 0.0 then begin Result:=er_negLog;exit end; AY.Ptr(0).arr^[j]:=arr^[0]*LOG10(x) end; end{END CASE} end;{END TFUN18} {--------------------------------------------------------------------------- Натуральный логарифм - y(t)=A*LN[B*u(t)+C] ---------------------------------------------------------------------------} function TFun19Convert(Action: integer; Vars: Pointer; Prop: TPtrArray; PropStr: TStringList; BlockId: integer; var MVTU: IMVTU_Server):integer; const RecName:PChar = 'Логарифм натуральный'; var SL: TStringList; Res: integer; begin case Action of //Возвращаем ссылку на имя записи в базе МВТУ-4 cnv_GetRecName: Result:=integer(RecName); //Конвертируем и устанавливаем параметры при помощи интерфейса МВТУ cnv_Convert: try SL:=TStringList.Create; //Парсим свойство заданное в одной строчке ExtractStrings([' ',';'],[' '],PChar(PropStr[0]),SL); //Присваиваем параметры для блока MVTU.SetBlockProp(BlockId,'a',PChar(SL[0]),Res); MVTU.SetBlockProp(BlockId,'w',PChar(SL[1]),Res); MVTU.SetBlockProp(BlockId,'f',PChar(SL[2]),Res); finally SL.Free; end; end; end; function TFun19; var j : Integer; x : RealType; begin Result:=0; with TSourceRec(Prop.arr^[0]).Parms do case Action of f_GetConvertFuncAdr: Result:=integer(@TFun19Convert); f_GetDeriCount : Result:=0; f_GetStateCount : Result:=0; f_GetInit : Result:=0; f_GetCount : CY.arr^[0]:=CU.arr^[0]; f_RestoreOuts, f_UpdateOuts, f_UpdateJacoby, f_GoodStep, f_InitState : for j:=0 to AY.Ptr(0).Count-1 do begin x:=arr^[1]*AU.Ptr(0).arr^[j]+arr^[2]; if x <= 0.0 then begin Result:=er_negLog;exit end; AY.Ptr(0).arr^[j]:=arr^[0]*LN(x) end; end{END CASE} end;{END TFUN19} end.