You will be able to implement your MPPT algorithm with the C block. I will not comment on the accuracy of your code.
Some comments about the c block,
Static variables will only be initialized once at the beginning and can be used to hold remember a value from a previous timestep. A regular variable definition will cause the variable to be re-initialized every time step. Also the c block will run at every time step, if you want to define a sampling rate for the c block you should put a ZOH element on all of the inputs to the c block which will force it to execute at the defined rate.