|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- subroutine TopDrive_Solver
-
-
- Use TopDrive_VARIABLES
- Use CTdsConnectionModesEnumVariables
-
- IMPLICIT NONE
-
-
-
- TDS%TDS_wOld = ((pi*TDS%Speed)/30.d0) ![rad/s]
-
-
- !******************************************************************
-
-
- if ( TDS%PowerState==-1 .or. TDS%OldPowerMode==-1 ) then !FWD
-
- if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = 30.d0
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 30
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0
- TDS%OldPowerMode = -1
- else if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 1000.d0
- TDS%OldPowerMode = -1
- else if ( TDS%DrillTorqueState==1 ) then ! TdsMu_Torque
- if ( TDS%RpmKnob>0. ) then
- TDS%OperationFaultLed = 1
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- else
- TDS%OperationFaultLed = 0
- if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = max( 1000.d0,((TDS%TorqueLimitKnob/10.d0)*60000.d0) ) ![ft.lbf] ????
- TDS%OldPowerMode = -1
- else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 1000.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- end if
- end if
- else if ( TDS%DrillTorqueState==-1 ) then ! TdsMu_DRILL
- if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- TDS%OperationFaultLed = 0
- TDS%Speed = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM]
- TDS%Speed = min(TDS%Speed,TDS%MaxRPM)
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = INT(TDS%Speed)
- TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((((pi*TDS%N_ref)/30.d0)/TDS%Conv_Ratio)-TDS%TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf]
- TDS%Torque = min(TDS%Torque,TDS%MaxTorque) ! [ft.lbf]
- TDS%TorqueGaugeOutput = TDS%Torque
- TDS%OldPowerMode = -1
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.0d0
- TDS%RpmGaugeOutput = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM]
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = INT(TDS%N_ref/TDS%Conv_Ratio)
- TDS%Torque = 0.0d0
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- if ( TDS%RpmKnob>0. ) then
- TDS%OperationFaultLed = 1
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- else
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- end if
- end if
- else
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- end if
-
- else if ( TDS%PowerState==1 .or. TDS%OldPowerMode==1 ) then !REV
-
- if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = 30.d0
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 30
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0
- TDS%OldPowerMode = 1
- else if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = 30.d0
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 1000.d0
- TDS%OldPowerMode = 1
- else if ( TDS%DrillTorqueState==1 ) then ! TdsMu_Torque
- if ( TDS%RpmKnob>0.d0 ) then
- TDS%OperationFaultLed = 1
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = 1
- else
- TDS%OperationFaultLed = 0
- if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 2000.d0
- TDS%OldPowerMode = 1
- else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = 1
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 1000.d0 ![ft.lbf]
- TDS%OldPowerMode = -1
- end if
- end if
- else if ( TDS%DrillTorqueState==-1 ) then ! TdsMu_DRILL
- if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- TDS%OperationFaultLed = 0
- TDS%Speed = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM]
- TDS%Speed = min(TDS%Speed,TDS%MaxRPM)
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = INT(TDS%Speed)
- TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((((pi*TDS%N_ref)/30.d0)/TDS%Conv_Ratio)-TDS%TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf]
- TDS%Torque = min(TDS%Torque,TDS%MaxTorque) ! [ft.lbf]
- TDS%TorqueGaugeOutput = TDS%Torque
- TDS%OldPowerMode = 1
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.0d0
- TDS%RpmGaugeOutput = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM]
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = INT(TDS%N_ref/TDS%Conv_Ratio)
- TDS%Torque = 0.0d0
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = 1
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- if ( TDS%RpmKnob>0. ) then
- TDS%OperationFaultLed = 1
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = 1
- else
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = 1
- end if
- end if
- else
- TDS%OperationFaultLed = 0
- TDS%Speed = 0.d0 !Speed [RPM]
- TDS%RpmGaugeOutput = TDS%Speed
- TDS%RPMUnityOutput = -TDS%RpmGaugeOutput
- TDS%SoundRPM = 0
- TDS%Torque = 0.d0 ![ft.lbf]
- TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf]
- TDS%OldPowerMode = 1
- end if
-
- end if
-
-
-
- !******************************************************************
-
-
-
-
- END subroutine
|