The development of greenhouses equipped with photovoltaic (PV) panels to simultaneously produce food and energy is gaining attention, driven by the concept of agrivoltaics. In this work, an east-west oriented, uneven structured greenhouse equipped with photovoltaic panels was investigated through developing a mathematical model. The required cooling and heating loads, mature tomato production, and electricity generation were all calculated by integrating energy, growth, and solar photovoltaic panel models. To meet the cooling demand in cold months, the ratio of ventilator area to greenhouse floor area was determined through natural ventilation analysis. The effect of changing the number of PV panels on energy consumption, inside photosynthetic active radiation, and tomato and electricity production was evaluated. Assessments of the PV greenhouse in a location near Tehran revealed that a south roof angle of 25 degrees and a PV cover ratio of 25 % provided better outcomes. Energy consumption per 1.0 kg of tomato production at a 25 % PV cover ratio was 14.88 kWh, which was 15.06 % less than in a no -panel scenario. In this case, over a 9-month growing period, the total tomato yield and power production were 15.52 tons and 46.4 MWh, respectively. To achieve uniform natural sunlight distribution, various configurations of the photovoltaic panels on the greenhouse roof were examined. The findings indicated that the most suitable arrangement was an asymmetric checkerboard layout. This proposed model provided a valuable opportunity for decision-makers to analyze the benefits and drawbacks of PV greenhouses in preferred locations.