This paper aims at maximizing the sum rate of secondary users (SUs) in Orthogonal Frequency Division Multiplexing (OFDM)-based Heterogeneous Cognitive Radio (CR) Networks by considering some practical limitations such as various traffic demands of SUs, interference constraint and imperfect spectrum sensing. The CR system operates in a slotted mode, in which the SUs have no power supplies and harvest energy from ambient radio signal. Assuming SUs operate in a time switching fashion, the time slot is partitioned into three non-overlapping parts devoted for energy harvesting, spectrum sensing and data transmission. Then, the general problem of sum rate maximization is formulated as a mixed integer programming task. Since this problem is intractable, we propose a sub-channel allocation scheme based on a factor called Energy Figure of Merit to approximately satisfy SUs' rate requirements. Then, the integer constraints of the optimization problem are removed and the problem can be reduced to a convex optimization task. Considering the trade-off between fractions of the time slot, we focus on finding the optimal structures of SUs that maximize the total throughput while guaranteeing the rate requirements of both real-time (RT) and non-real-time (NRT) SUs. The numerical results validate the effectiveness and efficiency of our sub-channel allocation method as well as performance gain of the optimal structure.