subroutine TopDrive_Inputs
    
    ! Use CSimulationVariables
    use CTopDrivePanelVariables
    use SimulationVariables
    use UnitySignalsModule
    use SimulationVariables
    Use TD_DrillStemComponents
    
    IMPLICIT NONE
    
    integer :: i
    
    
    
    data%State%TDS%String_Torque    = data%State%TD_String%StringTorque*12.d0         ![lb.ft]*12 ---> [lb.in]  ?????????
    !data%State%TDS%String_Torque   = 20000.         
    data%State%TDS%String_Torque    = 0.112984829d0*data%State%TDS%String_Torque      ![N.m]
    data%State%TDS%PowerState       = data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState
    data%State%TDS%RpmKnob          = data%EquipmentControl%TopDrivePanel%RpmKnob
    !data%State%TDS%MotorFaileMalf    ! jayi meghdardehi nashode ??????????????????
    data%State%TDS%RateChange       = 193.d0     ![RPM/s] motaghayere voroudi ???
    data%State%TDS%DrillTorqueState = data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState
    data%State%TDS%TorqueLimitKnob  = data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob     ! bayad hazf shavad??????????????/
    
    
    
    !===> data%State%TDS%String_JCoef Calculation
    if ( (data%State%TDS%DrillTorqueState==-1) .and. ((Get_TdsConnectionModes()==TDS_CONNECTION_STRING).or.(Get_TdsConnectionModes()==TDS_CONNECTION_SPINE)) ) then    !if TopDrive connected to string
        data%State%TDS%String_JCoef = 0.d0
        Do i = 1,data%State%TD_String%StringConfigurationCount
            data%State%TDS%String_JCoef = data%State%TDS%String_JCoef+( (data%State%TD_DrillStem(i)%TotalWeight*((data%State%TD_DrillStem(i)%Id**2.d0)+(data%State%TD_DrillStem(i)%Od**2.d0)))/8.d0 )              ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2)
        End Do
        data%State%TDS%String_JCoef  = data%State%TDS%String_JCoef*0.0421401d0   ![kg.m^2]
    else
        data%State%TDS%String_JCoef  = 0.d0
        data%State%TDS%String_Torque = 0.d0
    end if
    data%State%TDS%String_JCoef = data%State%TDS%String_JCoef/10.d0  !???????? /10: bi dalil, check it
    
    
    
    
    
end subroutine