The fan object is passed as an argument to the ZoneHVACTerminalUnitVariableRefrigerantFlow constructor: https://s3.amazonaws.com/openstudio-s...
 So if you wanted to create a terminal unit with a Fan:SystemModel, you would first create your fan (and coils) and pass them into the constructor for the terminal unit, like: 
 fan = OpenStudio::Model::FanSystemModel.new(model)
ccoil = OpenStudio::Model::CoilCoolingDXVariableRefrigerantFlow.new(model)
hcoil  = OpenStudio::Model::CoilHeatingDXVariableRefrigerantFlow.new(model)
tu = ZoneHVACTerminalUnitVariableRefrigerantFlow(model, ccoil, hcoil, fan)
 Also note how the EneryPlus input data dictionary limits the fan types for this terminal (which OpenStudio should enforce):
   A7 ,  \field Supply Air Fan Object Type
        \type choice
        \key Fan:SystemModel
        \key Fan:OnOff
        \key Fan:ConstantVolume
        \key Fan:VariableVolume
        \default Fan:ConstantVolume
        \note Supply Air Fan Object Type must be Fan:SystemModel, Fan:OnOff, or Fan:ConstantVolume
        \note if AirConditioner:VariableRefrigerantFlow is used to model VRF outdoor unit
        \note Supply Air Fan Object Type must be Fan:SystemModel or Fan:VariableVolume if
        \note AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl or
        \note AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR
        \note is used to model VRF outdoor unit
        \note Required for zone equipment. Leave blank if terminal unit is used in AirLoopHVAC:OutdoorAirSystem:EquipmentList.
        \note Also leave blank if terminal unit is used on main AirloopHVAC branch and terminal unit has no fan.