Skip to content

lpdx/sawtooth_psim_dll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sawtooth_psim_dll

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. comparativo figure 1

The FFT from both signals shows in figure 2 the correct frequency at 25kHz. 25kHz figure 2

Compiling DLL for PSIM using gcc

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/