Ground combat happens when a hostile ship drops colonists on a foreign planet, using the ship-to-planet cargo transporters.

During ground combat, attacking colonists and defenders annihilate each other, subject to their attack and defense ratios, until one party remains.

Ground_attack_result =
   "attacker wins with Trunc(Result/Attacker_rate) clans remaining"
                     ...if Result ≥ 0
   "defender wins with Trunc(-Result/Defender_rate) clans remaining"
                     ...if Result < 0
   ...with
      Attacker_rate =
         GroundKillFactor[Ship_owner]
      Defender_rate =
         GroundDefenseFactor[Planet_owner] + Planet_defense / 20
      Result =
         (Attacking_clans * Attacker_rate) - (Defending_clans * Defender_rate)

Note that if the result yields 0 clans remaining (maybe due to rounding), the planet gets unowned.

Imperial Assault: When a successful Imperial Assault is performed, the result is always "attacker wins with Attacking_clans clans remaining", independant of the number of Defending_clans and their attack/defense ratios. Imperial Assault is successful if the preconditions for the Imperial Assault device are fulfilled.

This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.