The block base class also defines methods for performing pre- and post-execution processing. These methods can be overridden in any derived class to provide the needed functionality. The Entity Generator block provides an example of how this feature is used. A Entity Generator block generates entities in a simulation model. To determine the time between entity creation events, the Entity Generator block pulls a numeric value from its InterArrivalTime port. If there are no connections to the InterArrivalTime port, the Entity Generator does not know when to generate the next entity. Therefore, before a simulation model begins to run, all Entity Generator blocks verify that connections to their InterArrivalTime ports exist. If no connections exist, the Entity Generator block logs a SEVERE message and prevents the simulation model from running. Other blocks contain similar pre-execution logic. In addition, blocks can perform post-execution processing. An example of this behavior might be found in blocks that store data and then write the data to disk after each run.
Most log and trace messages come from blocks. Blocks generate log messages when they encounter a situation, state, or value that presents a potential problem or abnormal condition for them. Each block is responsible for identifying the problem and also for the content of the log message. In a similar vein, blocks (or more accurately, block designers) are responsible for trace messages generated by each block. Log and trace capabilities in Simulation Studio are discussed in more detail in Chapter 10: Model Debugging and Verification.
Simulation Studio is based on the Java programming language, and the base block class is a Java class. Therefore, you can potentially write your own blocks by deriving them from the base block class. The details about creating your own custom blocks classes will be provided in future releases of Simulation Studio.