The KATRIM computer code is presented. It calculates key values of tritium systems, especially those related to complete fuel cycles. First, a deterministic model is discussed. Then, a stochastic model is presented based on dynamic systems with different dynamic states, each with its own system of equations. Such an approach allows the modeling of reactors with different degrees of availability and/or different operational strategies. Results of simulations for different availabilities, variable frequencies of interruptions in reactor operation, and changing tritium burnup in the plasma are presented.