<?xml version="1.0"?>

<!--Adapted from  F-4N by Dave Culp-->



<system name="hook">

  <property>systems/hook/tailhook-cmd-norm</property>
  <property  value="0">/controls/gear/tailhook</property>
  <property>systems/hook/tailhook-pos-deg</property>
  <property value="0.01429">systems/hook/coef-degtopos</property>
  
<!--Values from the model 3D drawing -->
  <property value="2.5">systems/hook/tailhook-length-ft</property> 
  <property value="-5">systems/hook/tailhook-pos-min-deg</property>
  <property value="70">systems/hook/tailhook-pos-max-deg</property>
  <property value="176">systems/hook/tailhook-offset-x-in</property>
  <property value="0">systems/hook/tailhook-offset-y-in</property>
  <property value="-15">systems/hook/tailhook-offset-z-in</property>
  
 
  
  <channel name="Hook">
      
<!--added, to keep the compatibility with YASim version-->
      <pure_gain name="systems/hook/tailhook-gearcontrol">
          <input>/controls/gear/tailhook</input>
          <gain>1</gain>
          <output>systems/hook/tailhook-cmd-norm</output>
     </pure_gain>
  

     <kinematic name="systems/hook/tailhook-control">
         <input>systems/hook/tailhook-cmd-norm</input>
       <traverse>
        <setting>
          <position> 0 </position>
          <time> 0 </time>
        </setting>
        <setting>
          <position> 1 </position>
          <time>1 </time>
        </setting>
       </traverse>
       <output>systems/hook/tailhook-pos-norm</output>
     </kinematic>
     
     
     <!--we recalculate the visual position of the hook according to the deg-position-->
     
     <fcs_function name="systems/hook/real-pos-norm">
         <function>
             <product>
                 <difference>
                     <property>systems/hook/tailhook-pos-deg</property>
                     <property>systems/hook/tailhook-pos-min-deg</property>
                </difference>
                     <property>systems/hook/coef-degtopos</property>
             </product>
         </function>
         <output>gear/tailhook-pos-norm</output>
    </fcs_function>

     <switch name="systems/hook/ready">
          <default value="0"/>
          <test  logic="AND" value="1">
              systems/hook/tailhook-control gt 0.99
          </test>
     </switch>

     <scheduled_gain name="systems/hook/hook-decel-multiplier">
      <input>systems/hook/ready</input>
      <table>
        <independentVar lookup="row">gear/unit[1]/wheel-speed-fps</independentVar>
         <tableData>
            0     0.00
            1     0.00
            80    3.00
         </tableData>
      </table>
     </scheduled_gain>

     <pure_gain name="systems/hook/hook-decel-force">
        <input>systems/hook/hook-decel-multiplier</input>
        <gain>inertia/weight-lbs</gain>
     </pure_gain>
     
     <pure_gain name="systems/holdback/total_thrust">
         <input>forces/fbx-prop-lbs</input>
         <gain>1.6</gain>
     </pure_gain>

     <summer name="systems/hook/force">
        <input>systems/hook/hook-decel-force</input>
        <input>systems/holdback/total_thrust</input>
     </summer>

    

  </channel>

</system>
