This sawtooth wave generator was tested in PSIM 2022.3.0.60 64bits and its intended to overrun the issue with the element "Saw-tooth voltage source (grounded)".
The sawtooth-wave voltage generator doesn't work properly when the frequency is about 1/10 of the frequency of the simulation.
As shown in figure 1, the signal vtri_cg (blue) not always get to value of 1. figure 1
The FFT from both signals shows in figure 2 the correct frequency at 25kHz. figure 2
Toolchain: gcc 64 bits
PATHS = src/
PATHB = build/
PATHO = build/objs/
MKDIR = mkdir -p
all:
$(MKDIR) $(PATHO)
gcc -c -o $(PATHO)main.o $(PATHS)main.c
gcc -o $(PATHB)sawtooth.dll $(PATHO)main.o -s -shared -Wl,--subsystem,windows
clean:
rm -rf build/