*Set Var krokVIntervalu=1
*Set Var krokVIntervaluActivity=1
*If(IntvData(Number_of_LOAD_STEPs,Int)>0 && (IntvData(Generate_Multiple_Steps,Int)>0 || IntvData(Define_Loading_History,Int)>0))
*#
*Set Var StartTIME =IntvData(INTERVAL_STARTING_TIME,Real)
*Set Var TargetTIME=IntvData(INTERVAL_END_TIME,Real)
*Set Var IncrementTIME=Operation(TargetTIME-StartTIME)
*#
*For(StepNumberI=1;StepNumberI<=IntvData(Number_of_LOAD_STEPs,Int);StepNumberI=StepNumberI+1)
*Set Var StepIndex=Operation(StepIndex+1)
*#
*If(1==1) *#GenData(Restart_of_Analysis,Int)==0 || StepIndex > GenData(Stored_Step_For_Restart,Int))
*#
*If(GenData(IMPORT_TRANSPORT_RESULTS,Int)==1 && GenData(APPLY_IN_INTERVAL_DATA,Int)==1 && IntvData(READ_TRANSPORT_DATA,Int)==1 )
*# && IntvData(Number_of_Transport_LOAD_STEPs,Int)>0
*If(strcmp(IntvData(TRANSPORT_IMPORT),"EACH_STEP")==0)
*#
*Set Var SubIncrTIME=Operation(IncrementTIME/IntvData(Number_of_LOAD_STEPs,Int))
*Set Var TargetTIME=Operation(StartTIME+SubIncrTIME)
*include ..\include.src.bas\read_transport_temperature.bas
*Set Var StartTIME=TargetTIME
*#
*ElseIf(strcmp(IntvData(TRANSPORT_IMPORT),"INTERVAL_BEGINNING")==0 && StepNumberI==1)
*Set Var SubIncrTIME=IncrementTIME
*include ..\include.src.bas\read_transport_temperature.bas
*EndIf
*EndIf
*# začátek fatigue ///////////////////////////
*# // Fatigue_Interval = *IntvData(Fatigue_Interval)
*If( strcmp(IntvData(Fatigue_Interval),"AUTOMATIC")==0)
*#
*If(StepNumberI==1)
//   AUTOMATIC FATIGUE - START OF LOAD SUBINTERVAL (*IntvData(Num_step_Load,Int) steps)
*Set Var FatLoadType = 1
*# // Fat_load_type   1=LOAD, 2=UNLOAD, 3=APPLY
*Set Var FatLoadTypeStart = 1
*Set Var FatLoadTypeEnd = 0
*Set Var FatStep = 0
*Set Var FatNumbersOfApply = 0
*EndIf
*Set Var FatStep=Operation(FatStep+1)
*#
*#
*If(FatLoadType==1)
*Set Var multip=Operation(IntvData(INTERVAL_Multiplier,Real)/IntvData(Num_step_Load,Real))
*EndIf
*#
*If(FatLoadType==2)
*Set Var multip=Operation(-1.0*IntvData(INTERVAL_Multiplier,Real)/IntvData(Num_step_Unload,Real))
*EndIf
*#
*If(FatLoadType==3)
*Set Var multip = 0
*EndIf
*#
*If(FatLoadType==1 && IntvData(Num_step_Load,Int)==FatStep)
*Set Var FatLoadTypeEnd = 1
*EndIf
*#
*If(FatLoadType==2 && IntvData(Num_step_Unload,Int)==FatStep)
*Set Var FatLoadTypeEnd = 1
*EndIf
*#
*If(FatLoadType==3 && FatStep==IntvData(Num_step_Apply,Int))
*Set Var FatLoadTypeEnd = 1
*EndIf
*#      // fat FatStep = *FatStep
*#      // fat FatLoadType = *FatLoadType
*#      // fat FatLoadTypeStart = *FatLoadTypeStart
*#      // fat FatLoadTypeEnd = *FatLoadTypeEnd
*#      
*#
*#
*#EndIf
*If( FatLoadTypeStart==1)
*#Set Var FatLoadTypeStart = 0
*If( FatLoadType==1)
SET FATIGUE_TASK 3

*ElseIf( FatLoadType==2)

*ElseIf( FatLoadType==3)
SET FATIGUE_TASK 8
SET FATIGUE_MAX_FRACT_STRAIN_MULT *Operation(1.0/IntvData(Num_step_Apply,Int))

*EndIf
*# // konec ( Fat_load_type_start==1 )
*EndIf
*#
*#
*If( FatLoadTypeEnd==1 )
*#Set Var FatLoadTypeEnd = 0
*If( FatLoadType==1)
*Set Var FatNumbersOfCycles=IntvData(Number_of_Fatigue_Cycles,Int)
*Set Var FatNumbersOfApply=Operation(FatNumbersOfApply+1)
*for(FatSubIntI=1;FatSubIntI<=IntvData(Cycles_in_substeps,Int);FatSubIntI=FatSubIntI+1)
*If(FatSubIntI==FatNumbersOfApply)
*Set Var FatNumbersOfCycles=IntvData(Cycles_in_substeps,*FatSubIntI,Int)
*EndIf
*End
SET FATIGUE_TASK 4
SET FATIGUE_CYCLES *FatNumbersOfCycles
SET FATIGUE_COD_LOAD_COEFF *IntvData(Fatigue_Cod_Load_Coeff,real)
*ElseIf( FatLoadType==3)
*EndIf
*# // konec ( Fat_load_type_end==1 )
*#
*EndIf
*# // konec ( strcmp(IntvData(Fatigue_Interval),"AUTOMATIC")==0)
*#
*EndIf
*# // začatek neAutomatic
*If( StepNumberI==1 )
*If( strcmp(IntvData(Fatigue_Interval),"RESET_AND_CALCULATE")==0)
SET FATIGUE_TASK 3
*#
*ElseIf( strcmp(IntvData(Fatigue_Interval),"CALCULATE")==0)
SET FATIGUE_TASK 1
*#
*ElseIf( strcmp(IntvData(Fatigue_Interval),"APPLY")==0)
SET FATIGUE_TASK 8
SET FATIGUE_MAX_FRACT_STRAIN_MULT *Operation(1.0/IntvData(Number_of_LOAD_STEPs,Int))
*#
*EndIf
*EndIf
*#
*If(StepNumberI==IntvData(Number_of_LOAD_STEPs,Int))
*If( strcmp(IntvData(Fatigue_Interval),"RESET_AND_CALCULATE")==0 || strcmp(IntvData(Fatigue_Interval),"CALCULATE")==0)

SET FATIGUE_TASK 4
SET FATIGUE_CYCLES *IntvData(Number_of_Fatigue_Cycles,Int)
SET FATIGUE_COD_LOAD_COEFF *IntvData(Fatigue_Cod_Load_Coeff,real)

*EndIf
*EndIf
*# konec fatigue ///////////////////////////
*#
*include ..\include.src.bas\ElementActivityStep.bas
*If(IntvData(Digicon_settings,Int)==1)
// digicon - set time
*If(StepNumberI==1)
SET TRANSIENT TIME INCREMENT *IntvData(TRANSIENT_TIME_INCREMENT_FIRST_STEP,real)
*Else
SET TRANSIENT TIME INCREMENT *IntvData(TRANSIENT_TIME_INCREMENT_OTHERS_STEPS,real)
*EndIf
*EndIf

STEP ID *StepIndex *GenData(Type_Analysis) NAME "*IntvData(LOAD_NAME) BC#*IntervalIndex(int)"
LOAD CASE
*#
*If(IntvData(Define_Loading_History,Int)==1)
*Set Var oj=Operation(2*StepNumberI+2)
*Set Var nl_multip=IntvData(Incremental_Multiplicators,*oj,real)
      *IntervalIndex ** *Operation(1*nl_multipl)
*Else
      *IntervalIndex ** *multip
*EndIf
      *Operation(IntervalIndex+AddFireIncrementLC) ** 1.0 // absolute load case
*If(IntvData(Add_Aditional_Load_Cases,Int)==1)
*for(adlc=1;adlc<=IntvData(Load_Cases,Int);adlc=adlc+5)
*Set Var adlcdvfrom=IntvData(Load_Cases,*Operation(adlc+2),int)
*Set Var adlcdvto=IntvData(Load_Cases,*Operation(adlc+3),int)
*Set Var adlcmultip=Operation(IntvData(Load_Cases,*Operation(adlc+1),real)*multip)
*# *adlc *adlcdvfrom *adlcdvto
*If(StepNumberI>=adlcdvfrom && StepNumberI<=adlcdvto)
  *IntvData(Load_Cases,*adlc,Int) ** *\
*Realformat "%10.4e"
*adlcmultip 
*EndIf
*End
*EndIf
*#
*If(GenData(IMPORT_TRANSPORT_RESULTS,Int)==1 && GenData(APPLY_IN_INTERVAL_DATA,Int)==1 && IntvData(READ_TRANSPORT_DATA,Int)==1)
*# && IntvData(Number_of_Transport_LOAD_STEPs,Int)>0
*#Set Var niLS=IntvData(Number_of_Transport_LOAD_STEPs,Int)
*Set Var niLS=IntvData(Number_of_LOAD_STEPs,Int)
*Set Var j=1
*If(strcmp(IntvData(TRANSPORT_IMPORT),"EACH_STEP")==0)
*Format "        %d * %10.5f"
      *Operation(IntervalIndex*IncrTemperatureLC+StepNumberI) 1.0
*ElseIf(strcmp(IntvData(TRANSPORT_IMPORT),"INTERVAL_BEGINNING")==0)
*Format "        %d * %10.5f"
      *Operation(IntervalIndex*IncrTemperatureLC+1) *Operation(1.0/IntvData(Number_of_LOAD_STEPs,Int))
*EndIf
*EndIf
Execute
*# /////////////////////////////////////////////////////////////////////////////////
*If( strcmp(IntvData(Store_Data_for_this_Interval_Steps),"WITHOUT_SAVING")==0)
*set var LabelFromStoreStep = 0
*include ..\include.src.bas\LabelStepID.bas
*EndIf
*If( strcmp(IntvData(Store_Data_for_this_Interval_Steps),"WITHOUT_SAVING")!=0) Then
*# Begin not without saving
*#
*# // zrovna je krokVIntervalu = *krokVIntervalu
*If( strcmp(IntvData(Store_Data_for_this_Interval_Steps),"SAVE_ALL")==0)
*# Begin Save all
OUTPUT LOCATION ELEMENTS RECOVERY *GenData(Nodal_data_recovery) ;
STORE TO
*include ..\include.src.bas\StoreStepID.bas
*# End Save all
*#
*ElseIf( strcmp(IntvData(Store_Data_for_this_Interval_Steps),"SAVE_EACH_Nth_PLUS_LAST_ONE")==0)
*#
*# Begin Save each n plus last one
*#// StepNumberI = *StepNumberI
*#// Nth_Step_to_Store= *IntvData(Nth_Step_to_Store,Int) 
*If(krokVIntervalu==IntvData(Nth_Step_to_Store,Int) || StepNumberI==IntvData(Number_of_LOAD_STEPs,Int) || StepNumberI==1)
*If( (StepNumberI!=1 && IntvData(Nth_Step_to_Store,Int)!=1) || (IntvData(Nth_Step_to_Store,Int)==1))
*set var krokVIntervalu=0
*EndIf
OUTPUT LOCATION ELEMENTS RECOVERY *GenData(Nodal_data_recovery) ;
STORE TO
*include ..\include.src.bas\StoreStepID.bas
*else
*set var LabelFromStoreStep = 0
*include ..\include.src.bas\LabelStepID.bas
*EndIf
*# End Save each n plus last one
*#
*#
*ElseIf( strcmp(IntvData(Store_Data_for_this_Interval_Steps),"SAVE_LAST_ONE")==0)
*#
*# Begin Save last one
*If(StepNumberI==IntvData(Number_of_LOAD_STEPs,Int))
OUTPUT LOCATION ELEMENTS RECOVERY *GenData(Nodal_data_recovery) ;
STORE TO
*include ..\include.src.bas\StoreStepID.bas
*else
*set var LabelFromStoreStep = 0
*include ..\include.src.bas\LabelStepID.bas
*EndIf
*# End Save last one
*#
*#
*EndIf
*# End not without saving
*EndIf
*#
*#
*include ..\include.src.bas\PrintMonitor.bas
*#
*#
*# začátek fatigue ///////////////
*If( strcmp(IntvData(Fatigue_Interval),"AUTOMATIC")==0)
*#
*If( FatLoadTypeEnd==1 )
*Set Var FatLoadTypeEnd = 0
*If( FatLoadType==1)
SET FATIGUE_TASK 0
*ElseIf( FatLoadType==3)
SET FATIGUE_TASK 0
*EndIf
*EndIf
*# // konec ( Fat_load_type_end==1 )
*#
*If( FatLoadTypeStart==1)
*Set Var FatLoadTypeStart = 0
*If( FatLoadType==1)
SET FATIGUE_TASK 0
*ElseIf( FatLoadType==2)
*ElseIf( FatLoadType==3)
*EndIf
*# // konec ( Fat_load_type_start==1 )
*EndIf
*#
*If(FatLoadType==1 && IntvData(Num_step_Load,Int)==FatStep)

//   AUTOMATIC FATIGUE - END OF LOAD SUBINTERVAL
*If(strcmp(IntvData(Fatigue_Apply),"BOTTOM")==0 )
//   AUTOMATIC FATIGUE - START OF UNLOAD SUBINTERVAL (*IntvData(Num_step_Unload,Int) steps)
*Set Var FatLoadType = 2
*Set Var FatLoadTypeStart = 1
*Set Var FatStep = 0
*Else
//   AUTOMATIC FATIGUE - START OF APPLY SUBINTERVAL (*IntvData(Num_step_Apply,Int) steps)
*Set Var FatLoadType = 3
*Set Var FatLoadTypeStart = 1
*Set Var FatStep = 0
*EndIf

*EndIf
*#
*If(FatLoadType==2 && IntvData(Num_step_Unload,Int)==FatStep)

//   AUTOMATIC FATIGUE - END OF UNLOAD SUBINTERVAL
*If(strcmp(IntvData(Fatigue_Apply),"BOTTOM")==0)
//   AUTOMATIC FATIGUE - START OF APPLY SUBINTERVAL (*IntvData(Num_step_Apply,Int) steps)
*Set Var FatLoadType = 3
*Set Var FatLoadTypeStart = 1
*Set Var FatStep = 0
*Else
//   AUTOMATIC FATIGUE - START OF LOAD SUBINTERVAL (*IntvData(Num_step_Load,Int) steps)
*Set Var FatLoadType = 1
*Set Var FatLoadTypeStart = 1
*Set Var FatStep = 0
*EndIf

*EndIf
*#
*If(FatLoadType==3 && FatStep==IntvData(Num_step_Apply,Int))

//   AUTOMATIC FATIGUE - END OF apply SUBINTERVAL
*If(strcmp(IntvData(Fatigue_Apply),"BOTTOM")==0 )
//   AUTOMATIC FATIGUE - START OF LOAD SUBINTERVAL (*IntvData(Num_step_Load,Int) steps)
*Set Var FatLoadType = 1
*Set Var FatLoadTypeStart = 1
*Set Var FatStep = 0
*Else
//   AUTOMATIC FATIGUE - START OF UNLOAD SUBINTERVAL (*IntvData(Num_step_Unload,Int) steps)
*Set Var FatLoadType = 2
*Set Var FatLoadTypeStart = 1
*Set Var FatStep = 0
*EndIf

*EndIf
*#      // na konci kroku
*#      // fat FatStep = *FatStep
*#      // fat FatLoadType = *FatLoadType
*#      // fat FatLoadTypeStart = *FatLoadTypeStart
*#      // fat FatLoadTypeEnd = *FatLoadTypeEnd
*#  // konec automatic
*EndIf

*If((strcmp(IntvData(Fatigue_Interval),"RESET_AND_CALCULATE")==0 || strcmp(IntvData(Fatigue_Interval),"CALCULATE")==0) && (StepNumberI==1 || StepNumberI==IntvData(Number_of_LOAD_STEPs,Int)))
SET FATIGUE_TASK 0

*EndIf
*#
*If(strcmp(IntvData(Fatigue_Interval),"APPLY")==0 && StepNumberI==IntvData(Number_of_LOAD_STEPs,Int))
SET FATIGUE_TASK 0

*EndIf
*# konec fatigue /////////////////
*#
*Set Var krokVIntervalu=Operation(krokVIntervalu+1)
*Set Var krokVIntervaluActivity=Operation(krokVIntervaluActivity+1)
*include ..\include.src.bas\delete_transport_temperature.bas
*#
*EndIf
*#
*#// kontrola StepNumberI = *StepNumberI
*End
*#
*EndIf