# YFOSUB

Modeling一般状態方程式から、2つのボディ間のベクトル力 / トルクを計算します。

## 使用

<Force_StateEqn
id                    = "301001"
type                  = "USERSUB"
x_array_id            = "30100200"
u_array_id            = "30100100"
ic_array_id           = "0"
num_state             = "2"
is_static_hold        = "FALSE"
i_marker_id           = "30102022"
j_floating_marker_id  = "30101023"
ref_marker_id         = "30101010"
usrsub_param_string   = "USER(998,0,1,-10,.1,10,0,0,1)"
usrsub_dll_name       = "NULL"
usrsub_fnc_name       = "YFOSUB"
usrsub_der1_name      = "YFOXX"
usrsub_der2_name      = "YFOXU"
usrsub_der3_name      = "YFOYX"
usrsub_der3_name      = "YFOYU"
/>

## フォーマット

Fortranの呼出し構文
SUBROUTINE YFOSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG,NSTATE, STATES, NINPUT, INPUT, NOUTPT, STATED, OUTPUT)
SUBROUTINE YFOXX (ID, TIME, PAR, NPAR, IFLAG, NSTATE,STATES, NINPUT, INPUT, NOUTPT, PXXMAT)
SUBROUTINE YFOXU (ID, TIME, PAR, NPAR, IFLAG, NSTATE,STATES, NINPUT, INPUT, NOUTPT, PXUMAT)
SUBROUTINE YFOYX (ID, TIME, PAR, NPAR, IFLAG, NSTATE,STATES, NINPUT, INPUT, NOUTPT, PYXMAT)
SUBROUTINE YFOYU (ID, TIME, PAR, NPAR, IFLAG, NSTATE,STATES, NINPUT, INPUT, NOUTPT, PYUMAT)
Cの呼出し構文
void STDCALL YFOSUB (int *id, double *time, double *par, int *npar, int *dflag, int
*iflag, int *nstate, double *states, int *ninput, double *input, int *noutpt, double
*stated, double *output)
void STDCALL YFOXX (int *id, double *time, double *par, int *npar, int *iflag, int
*nstate,double *states, int *ninput, double *input, int *noutpt, double *pxxmat)
void STDCALL YFOXU (int *id, double *time, double *par, int *npar, int *iflag, int
*nstate,double *states, int *ninput, double *input, int *noutpt, double *pxumat
void STDCALL YFOYX (int *id, double *time, double *par, int *npar, int *iflag, int
*nstate,double *states, int *ninput, double *input, int *noutpt, double *pyxmat)
void STDCALL YFOYU (int *id, double *time, double *par, int *npar, int *iflag, int
*nstate,double *states, int *ninput, double *input, int *noutpt, double *pyumat)
Pythonの呼出し構文
def YFOSUB(id, time, par, npar, dflag, iflag, nstate, states, ninput,input, noutpt):
return[stated, output]

def YFOXX(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt)
return pxxmat

def YFOXU(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt)
return pxumat

def YFOYX(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt)
return pyxmat

def YFOYU(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt)
return pyumat
MATLABの呼出し構文
function [stated, output] = YFOSUB(id, time, par, npar, dflag, iflag, nstate, states, ninput, input, noutpt)
function pxxmat = YFOXX(id, time, par, npar, iflag, nstate, states, ninput, input, noutpt)
function pxumat = YFOXU(id, time, par, npar, iflag, nstate, states, ninput, input, noutpt)
function pyxmat = YFOYX(id, time, par, npar, iflag, nstate, states, ninput, input, noutpt)
function pyumat = YFOYU(id, time, par, npar, iflag, nstate, states, ninput, input, noutpt)

## 属性の呼出し構文

ID
[整数]
ユーザー定義のベクトル力 / トルク要素識別子。
TIME
[倍精度]

PAR
[倍精度]
ユーザー定義のステートメントで提供されたリストにある定数引数を含む配列。
NPAR
[整数]
PAR配列のエントリの数。
DFLAG
[論理]

IFLAG
[論理]

NSTATE
[整数]
Control_StateEqnエンティティのnum_state属性から取得された状態変数の数。
STATES
[倍精度]

NINPUT
[整数]

INPUT
[倍精度]

## 出力

NOUTPT
[整数]
Control_StateEqnエンティティのnum_output属性から取得された出力の数。
STATED
[倍精度]

OUTPUT
[倍精度]

## 例

def YFOSUB(id, time, par, npar, dflag, iflag, nstate, states, ninput,
input, noutpt):
stated = []
for i in xrange(nstate):
stated.append(0.0)
output = []
for i in xrange(noutpt):
output.append(0.0)
A = []
A.append([par[1],par[3]])
A.append([par[2],par[4]])
B = []
B.append(par[5])
B.append(par[6])
C = []
C.append(par[7])
C.append(par[8])

stated[0] = A[0][0]*states[0] + A[0][1]*states[1] + B[0]*input[0]
stated[1] = A[1][0]*states[0] + A[1][1]*states[1] + B[1]*input[0]

output[0] =0.0
output[1] =0.0
output[2] =0.0
output[3] =0.0
output[4] =0.0
output[5] = C[0]*states[0] + C[1]*states[1]

return [stated, output]

def YFOXX(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt):
pxxmat = []
for i in xrange(nstate*nstate):
pxxmat.append(0.0)
if int(par[0])==998:
pxxmat[0] = par[1]
pxxmat[1] = par[2]
pxxmat[2] = par[3]
pxxmat[3] = par[4]
return pxxmat

def YFOXU(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt):
pxumat = []
for i in xrange(nstate*ninput):
pxumat.append(0.0)
if int(par[0])==998:
pxumat[0] = par[5]
pxumat[1] = par[6]
return pxumat

def YFOYX(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt):
pyxmat = []
for i in xrange(nstate*noutpt):
pyxmat.append(0.0)
if int(par[0])==998:
pyxmat[0] = 0.0
pyxmat[1] = 0.0
pyxmat[2] = 0.0
pyxmat[3] = 0.0
pyxmat[4] = 0.0
pyxmat[5] = par[7]

pyxmat[6] = 0.0
pyxmat[7] = 0.0
pyxmat[8] = 0.0
pyxmat[9] = 0.0
pyxmat[10] = 0.0
pyxmat[11] = par[8]
return pyxmat

def YFOYU(id, time, par, npar, iflag, nstate, states, ninput,input, noutpt):
pyumat = []
return pyumat

## コメント

1. INPUTは、<Force_StateEqn/>モデリング要素で参照されるu配列からの値です。
2. OUTPUT y配列は、次元が6X1で、<Force_Vector_TwoBody>内のiマーカーとjフローティングマーカー間の作用 / 反作用の力として使用されます。
3. 導関数（YFOXXなど）がない場合、導関数は有限差分YFOSUBから計算されます。
4. YFORCE(…)を使用して式内で力を問い合わせたり、SYSFNC内で‘YFORCE’を使用してサブルーチン内で力を問い合わせることができます。
5. X配列は、エントリのないNULL配列にすることはできません。