When is the External Element
Called?
The external function is called at the following times:
- At the beginning of the simulation (Etime = 0);
- Every GoldSim timestep A discrete interval of time used in dynamic simulations. (if one of the inputs to the element has changed); and
- At any internal step in which an Event is triggered (if one of the inputs to the element has changed).
It is likely that you may want to treat each of these calls in a different way. For example, you may wish the external function to ignore the call at the beginning of the simulation, or you may want it to carry out some special initialization routines at that time.
You may also want to treat a call in the middle of a timestep (due to an Event) differently from a call at the end of a timestep.
In order to communicate this kind of information to the external function, you would need to send Etime (the current elapsed time) and perhaps Timestep_Length (the length of the current timestep) to the external function as optional input arguments. (Both of these are Run Properties A set of fundamental properties that track the progress of the simulation (e.g., Time, Realization) and can be referenced like outputs in expressions.).
Learn more
- Defining a Lookup Table Using an External Function
- Defining the External Element
- Exporting the External Element Interface
- External (DLL) Elements
- Implementing the External Module
- Locking onto a DLL File
- Running the DLL in a Separate Process
- Saving External Element Outputs
- Using an External Element to Define Lookup Tables
- Using an External Element to Read and/or Output Time Series
- Viewing an External Element in the Browser
- When is the External Element Called?