put constrain for model and model_code, change beam_parameter.lattice_id tp beam_parameter.beam_parameter_id