Ive just come up with an alternative solution to this. Since i already have triacs here i thought it would be nice if i can use them. Well i can. I put AC into the triac and a rectifier after the triac and before the solenoid. Works perfectly