subroutine RTable_Traction_Motor use CDrillingConsoleVariables use CDataDisplayConsoleVariables use CSimulationVariables use RTable_VARIABLES use equipments_PowerLimit IMPLICIT NONE !integer :: jnomb !jnomb = 0 !>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< RTable%TL = (RTable%String_Torque+RTable%ConstLoad)/(RTable%Mech_Efficiency*RTable%Conv_Ratio) !RTable%TL = 5700. !print*, 'RTable%TLtr=', RTable%TL , RTable%Te !print*, 'RTable%String_JCoef=', RTable%String_JCoef , RTable%J_coef+(RTable%String_JCoef/(RTable%Mech_Efficiency*RTable%Conv_Ratio)) La = 1700.*1d-6 Lf = 260.*1d-6 Ra = 9.5*1d-3 !Rf = 5.4*1d-3 Rf = 0. !******** controller ******* Kpn = 50.d0 Kin = 3.d0 Kpi = 100.d0 Kii = 900.d0 RTable%time = RTable%time_step RTable%dt = 1.d-5 RTable%error = .001 !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RTable%n = RTable%time/RTable%dt RTable%w_ref = (pi*(RTable%N_ref)/30.d0) RTable%ia_ref_limit = RTTorqueLimitKnob*100.d0 !print* , 'N_ref=' , RTThrottle , RTable%w_ref , RTable%N_ref RTable%ia_er = 1. RTable%w_er = 1. RTable%x_er = 1. RTable%y_er = 1. RTable%i = 1 !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< DO WHILE (RTable%i<=RTable%n) !>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< call RTable_dx((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%x,RTable%y) call RTable_dy((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%x,RTable%y) call RTable_dia((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%fii,RTable%x,RTable%y) call RTable_dw((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%fii,RTable%TL) RTable%K1x = RTable%dt*RTable%dx RTable%K1y = RTable%dt*RTable%dy RTable%K1ia = RTable%dt*RTable%dia RTable%K1w = RTable%dt*RTable%dw call RTable_dx((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%x+(RTable%K1x/2.),RTable%y+(RTable%K1y/2.)) call RTable_dy((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%x+(RTable%K1x/2.),RTable%y+(RTable%K1y/2.)) call RTable_dia((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%fii,RTable%x+(RTable%K1x/2.),RTable%y+(RTable%K1y/2.)) call RTable_dw((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%fii,RTable%TL) RTable%K2x = RTable%dt*RTable%dx RTable%K2y = RTable%dt*RTable%dy RTable%K2ia = RTable%dt*RTable%dia RTable%K2w = RTable%dt*RTable%dw call RTable_dx((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%x+(RTable%K2x/2.),RTable%y+(RTable%K2y/2.)) call RTable_dy((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%x+(RTable%K2x/2.),RTable%y+(RTable%K2y/2.)) call RTable_dia((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%fii,RTable%x+(RTable%K2x/2.),RTable%y+(RTable%K2y/2.)) call RTable_dw((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%fii,RTable%TL) RTable%K3x = RTable%dt*RTable%dx RTable%K3y = RTable%dt*RTable%dy RTable%K3ia = RTable%dt*RTable%dia RTable%K3w = RTable%dt*RTable%dw call RTable_dx((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%x+RTable%K3x,RTable%y+RTable%K3y) call RTable_dy((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%x+RTable%K3x,RTable%y+RTable%K3y) call RTable_dia((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%fii,RTable%x+RTable%K3x,RTable%y+RTable%K3y) call RTable_dw((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%fii,RTable%TL) RTable%K4x = RTable%dt*RTable%dx RTable%K4y = RTable%dt*RTable%dy RTable%K4ia = RTable%dt*RTable%dia RTable%K4w = RTable%dt*RTable%dw RTable%x_new = RTable%x_old+((RTable%K1x+(2.*RTable%K2x)+(2.*RTable%K3x)+RTable%K4x)/6.) RTable%y_new = RTable%y_old+((RTable%K1y+(2.*RTable%K2y)+(2.*RTable%K3y)+RTable%K4y)/6.) RTable%ia_new = RTable%ia_old+((RTable%K1ia+(2.*RTable%K2ia)+(2.*RTable%K3ia)+RTable%K4ia)/6.) RTable%w_new = RTable%w_old+((RTable%K1w+(2.*RTable%K2w)+(2.*RTable%K3w)+RTable%K4w)/6.) !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RTable%x_old = RTable%x_new RTable%y_old = RTable%y_new RTable%ia_old = RTable%ia_new RTable%w_old = RTable%w_new RTable%x = RTable%x_new RTable%y = RTable%y_new RTable%ia = RTable%ia_new RTable%w = RTable%w_new RTable%Te = RTable%fii*RTable%ia_new !if (jnomb==0) then ! print*, 'RTable%Vt0=', RTable%Vt ! jnomb=1 !end if RTable%ia_ref = RTable%y_new+Kpn*((30.0*RTable%w_ref/pi)-(30.0*RTable%w_new/pi)) call RTTorqueLimit RTable%Vt = RTable%x_new+(Kpi*(RTable%ia_ref-RTable%ia_new)) !call PowerLimits !if (Power_sigma>max_Power_sigma) then ! RTable%Vt = RTable%Vt !else ! RTable%Vt = RTable%x_new+(Kpi*(RTable%ia_ref-RTable%ia_new)) !end if IF (RTable%Vt>810.) THEN RTable%Vt = 810.0 ELSE IF (RTable%Vt<0.) THEN RTable%Vt = 0.0 END IF RTable%i = RTable%i+1 END DO !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< !print*, 'RTable%wtr=', RTable%w_new , RTable%ia_new , RTable%dw , RTable%dia END subroutine RTable_Traction_Motor