i want constraint my variable Pg , how can i do?
You currently can’t do this. You need to use indexed definitions or set the bounds after creating the variable
Side note: It looks like you are developing an AC OPF model. These reference implementations may be of interest,
https://github.com/lanl-ansi/PowerModelsAnnex.jl/tree/master/src/model