Variable parameters for blocks during simulation in PLECS standalone

Hello,

I want to know if a block parameter is variable when the simulation is running. The problem is explained below using the above circuit as an example:

I want to change the frequency ‘f’ of the triangle wave generator based on the voltage input value ‘Vin’ that’s been generated by the step function in the circuit. The desired code is shown and has been put in parameter initialization. When I run this code, it shows me an error that ‘Vin’ is undefined. Is it possible that the ‘Vin’ calculated during simulation can be used to calculate frequency ‘f’ of the triangle waveform generator?

If not, how can I generate a triangle waveform whose various parameters can be varied during simulation? I trying to use the triangle waveform for generating PWM signals.

The initialization commands are executed prior to the simulation and you can not change parameters from there once the simulation is running.

Not sure what the best solution is. I have used the state machine block to generate PWM signals in the past like this (f, d are inputs to the state machine):