The following source files, led by gray banners, contain all the class functions needed for Project Cool. The sections highlighted by a yellow background Color are manually entered. Code sections with white background color are generated by the SansGUI Source Code Framework. The source files are compiled into a dynamic linked library to be invoked by SansGUI during simulation runs.
Functions in Class Base.CoffeeCup
Functions in Class Collection.Clock
For more details about this example, please read A Tour of SansGUI Examples in the SansGUI Getting Started Guide.
Functions in Class Base.CoffeeCup [Go To Top] |
/*
Base_CoffeeCup.c #include
<stdio.h> #ifdef
__cplusplus SG_EXPORT SG_SIM_FUNC SG_xEval_Base_CoffeeCup; #ifdef
__cplusplus /*
Macros for attribute indices in class version [1.0.alpha.4] */ |
/*
Macros added by hand for simCtrl class attribute access */ |
/*
============================================================ /* TODO: declare your local variables here */ |
float* pfTemp = &self->zValues[SG_NDX_FTEMP].fData[0];
const float cfDt = simCtrl->zValues[SG_NDX_FDT].fData[0]; |
if (!SG_IsSchemaOK(self->nSGobjSchema)) /* TODO: put your simulator code here */ |
*pfTemp += (-cfR * (*pfTemp - cfRoomT) * cfDt); |
return SG_R_OK; |
Functions in Class Collection.Clock [Go To Top] |
/*
Collection_Clock.c #include
<stdio.h> #ifdef
__cplusplus SG_EXPORT SG_SIM_FUNC SG_xEval_Collection_Clock; #ifdef
__cplusplus |
/*
Macros added by hand for simCtrl class attribute access */ #define SG_NDX_FDT 9 #define SG_NDX_FTIME 10 |
/*
============================================================ |
const float cfDt = simCtrl->zValues[SG_NDX_FDT].fData[0]; |
if (!SG_IsSchemaOK(self->nSGobjSchema)) /* TODO: put your simulator code here */ |
*pfTime += cfDt; |
return SG_R_OK; |
SansGUI Modeling and Simulation Environment version 1.2
Copyright © 2000-2003 ProtoDesign, Inc. All rights reserved.