Block level functions

To interface smoothly with Embed, Embed can call seven Pascal-style functions that share the base DLL function name and have an event code suffix corresponding to an Embed event. You should supply a function for each event that you want your DLL code to handle. The additional functions are described below:

Function name

Purpose

When it’s called

userBlock()

Block time step

Each simulation time step

userBlockEvent()

Block event handler

On occurrence of a block-related event

userBlock PA()

Block parameter allocation

Block creation

userBlock PC()

Block parameter change

Right button click

userBlock PI()

Block parameter initialization

Immediately after userBlockPA()

userBlock SE()

Block simulation end

Simulation end time

userBlock SS()

Block simulation start

Simulation start time

 

The term userBlock is a placeholder for your DLL base function name. You specify the DLL base function name when you bind the DLL to a userFunction block. For more information, see Accessing a custom block from Embed.  

You can have any number of user-written blocks in a single DLL file.

All definitions are kept in the VSUSER.H file. This file should be included in every user DLL.