| 
    
     |  | ▼横入り さん: >>Dim dh, ft(), fr(), fu(), fv(), m(), e() As Double
 >こういう書き方だとDoubleなのは e() だけです。
 ありがとうございます。知りませんでした。
 
 >再現性のある、最低限のコードを省略せずにアップされてはどうでしょうか。
 わかりました。以下になります。
 
 Private Sub physics(row As Integer)
 
 Dim r As Double 'カッタ半径
 
 Dim order As String
 Dim length As Integer
 Dim v As Double '切削速度
 v = Worksheets("付加情報").Cells(10, 2).Value
 r = Worksheets("付加情報").Cells(2, 2).Value / 2
 
 length = Worksheets("付加情報").Cells(4, 2).Value
 
 order = Worksheets("解析").Cells(row, 6).Value
 If order = "" Or order = "早送り" Then
 Exit Sub
 End If
 
 '切削幅と切削深さ
 Dim width, depth, z, oldz As Double
 If row = 4 Then
 oldz = 0
 z = Worksheets("解析").Cells(row, 5).Value
 Else
 z = Worksheets("解析").Cells(row, 5).Value
 oldz = Worksheets("解析").Cells(row - 1, 5).Value
 End If
 
 If row < 634 Then
 width = 2 * r '荒加工の切削幅は全て2r
 Else
 width = 2 * r * 0.1 '仕上げ加工の切削幅は1/10
 End If
 
 '切削深さの算出
 If oldz > 0 Then
 depth = -z
 Else
 depth = -(oldz - z)
 End If
 
 
 'エンゲージ角
 Dim engage As Double
 Dim cos As Double 'コサインの値
 
 If Worksheets("解析").Cells(row, 6).Value = "円弧切削(時計回り)" Then
 cos = 1 - width / r - (width * (r - 0.5 * width)) / ((Worksheets("解析").Cells(row, 9).Value) * r)
 ElseIf Worksheets("解析").Cells(row, 6).Value = "円弧切削(反時計回り)" Then
 cos = 1 - width / r - (width * (r - 0.5 * width)) / ((Worksheets("解析").Cells(row, 9).Value) * r)
 ElseIf Worksheets("解析").Cells(row, 6).Value = "直線切削" Then
 cos = 1 - (width / r)
 End If
 
 engage = WorksheetFunction.Acos(cos) 'アークコサイン(ラジアン)
 engage = WorksheetFunction.Degrees(engage) 'ラジアン⇒度
 
 If engage >= 180 Then
 engage = 360 - engage
 End If
 
 
 '一刃当りの送り
 Dim rev, feed, edge As Integer
 Dim anedge As Double
 feed = Worksheets("解析").Cells(row, 8).Value
 rev = Worksheets("解析").Cells(row, 7).Value
 anedge = feed / (edge * rev)
 
 
 Dim ks, kp, kt, kr As Double
 
 'ksの決定
 If anedge <= 0.03 Then
 ks = 0.03
 Else
 ks = anedge
 End If
 
 
 Dim angle, encounter As Integer
 
 For angle = 1 To 180
 'kpの決定
 If angle <= 7.2 Then
 kp = 1.2
 Else
 kp = 1
 End If
 
 '接触しているか否か
 If angle <= engage Then
 encounter = 1
 Else
 encounter = 0
 End If
 
 'ktとkrの算出
 kt = 2165 * kp * (ks / anedge) ^ 0.5 * (1 - 0.14 * v / 60)
 kr = 1245 * kp * (ks / anedge) ^ 0.5 * (1 - 0.3 * v / 60)
 
 
 '微少切れ刃当たりの切削力Aの算出
 Dim h, A() As Double
 ReDim A(180)
 h = depth / 360
 A(angle) = anedge * Sin(WorksheetFunction.Radians(angle)) * encounter * h
 
 
 '角度angleにおける切削力の算出
 Dim dh, ft(), fr(), fu(), fv(), m(), e() As Double
 ReDim ft(180, 180), fr(180, 180), fu(180, 180), fv(180, 180), m(180, 180), e(180, 180)
 Dim count As Integer
 count = 0
 For dh = 0 To depth Step h
 count = count + 1
 ft(angle, count) = kt * A(angle)
 fr(angle, count) = kr * A(angle)
 
 
 fu(angle, count) = fr(angle, dh) * Sin(WorksheetFunction.Radians(angle)) - ft(angle, dh) * cos(WorksheetFunction.Radians(angle))
 fv(angle, count) = -(fr(angle, dh) * cos(WorksheetFunction.Radians(angle)) - ft(angle, dh) * Sin(WorksheetFunction.Radians(angle)))
 
 
 >cosが小文字で、Sinが大文字なのは何か意味がありますか?
 Sinは関数として機能しているので、自動で大文字になります。
 
 >別のところで配列cosがあったりしますか?
 ほかの場所でcosは使っていません。
 
 以上になります。お忙しい中申し訳ありませんが、宜しくお願い致します。
 
 |  |