Declaring digital signal

 if ("G1")

An if test generally compares two things. If a equals b, do this. If c greater than d, do that.

When only one value is used, "equals true" is implied.

Since false is 0, and non-zero is true, your test always evaluates to true, since "G1" is not 0.