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