As the error states, the capacitor state is directly dependent on the voltage source. What this means has been elaborately answered here -- https://www.plexim.com/support/solutions/166. If you add a small resistance in series either to the source or to the capacitor, you won't have this direct dependence anymore.
Also, if all you're trying to do is find out the peak value of your periodic waveform, then this could be implemented in a better way either using the C-script block or the State Machine block. Please see the attached example.