home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
MATH
/
VISSIM.ZIP
/
TANK.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-12
|
3KB
|
102 lines
#include "windows.h"
#include "vsuser.h"
#include <stdio.h>
/************ This is the base function in the DLL ************/
/************ Called by VisSim at every step size ************/
void _export PASCAL level (param,inSig, outSig)
double far inSig[],FAR outSig[],FAR param[];
{ double simTime;
outSig[0]=((param[1]+inSig[0]-inSig[1])/(param[0]))*100;
outSig[1]=param[0]; /* display capacity */
getSimTime(&simTime);
outSig[2]=simTime;
if (outSig[0] > 100)
stopSimulation(1);
}
/************** Simulation Start Function ***************/
/********* Called by VisSim at the start of simulation **********/
void FAR PASCAL levelSS (double FAR param[],long FAR *runCount )
{ if(*runCount > 1)
param[1]=5; /* autorestart:reset initial condition */
}
/**************** Simulation End Function ***************/
/************ Called by VisSim at the end of simulation **********/
void FAR PASCAL levelSE (double FAR param[])
{
debMsg("Simulation End");
}
/**************** Parameter Allocation Function **************/
/**************** Called by VisSim on block creation ************/
long FAR PASCAL levelPA(pCount)
short FAR *pCount;
{
*pCount=2; /* number of prompted parameters */
return((*pCount)*sizeof(double)) ;
}
/*************** Parameter Initialization Function *************/
/*********** Called by VisSim after the PA function ************/
void FAR PASCAL levelPI(DOUBLE *param)
{
param[0]=25; /* capacity */
param[1]=5; /* initial level */
}
/***************** Parameter Change Function *****************/
/********* Called by VisSim on right mouse button click ************/
char FAR* PASCAL levelPC (DOUBLE *param)
{
return "Capacity;Initial_level";
}
/*********This code is required for creating a Windows DLL ********/
int DLLInst;
int FAR PASCAL LibMain(hInstance,wDataSeg,cbHeapSize,lpszCmdLine)
HINSTANCE hInstance; WORD wDataSeg, cbHeapSize; LPSTR lpszCmdLine;
{
DLLInst =hInst;
return TRUE;
}
int FAR PASCAL WEP (param)
{
return 1;
}
/****************************** end of file *****************************/