Andres,
Two changes are needed:
1) enclose the whole expression in single quotes (because it includes spaces)
2) enclose the unit h in square brackets (because a unit is an object)
Your final expression will be:
'([Generator1].SimTime < 17[h])*1+([Generator1].SimTime >=17[h])*2'
You can write this expression more clearly using the ternary operator:
'[Generator1].SimTime < 17[h] ? 1 : 2'
Also, every entity has the output SimTime, including the Branch object, so you can write the expression as:
'this.SimTime < 17[h] ? 1 : 2'
Harry