The following table summarizes the kinds of blocks you can write using ModL. In the public ModL course, we usually concentrate on types 1,2,3, and 6. We will introduce DB-aware blocks (type 7), and do an overview of item blocks (4). We recommend that you avoid types 4 and 5, and leave these to the experts! Other block types (including SC) can be emphasized in custom courses.
Type of Block |
Construction |
Issues to Know |
Typical Use |
|
1 |
True Generic- no Connector Message Handlers |
Code in "On Simulate". Standard GetSimulateMsgs(False) in "On InitSim"-
see Add block. |
Very simple. Connector Message Emulation |
Local Controllers |
2 |
Generic with Connector Message Handlers |
Code in "On ConIn" and/or "On ConOut" to
handle the forward or backward (query) messages, respectively. |
You must understand the conditions under which surrounding blocks send messages. |
Tricky Control or where too many calculations occurring. |
3 |
Event-Posting |
Set myIndex on checkData. Get timeArray & timeBlocks on initSim. To post events, set nextTime and timeArray[myIndex]= nextTime. |
This is very simple (also fun & useful) to learn. Requires familiarity w/dynamic arrays, & how
the timeArray is configured and used by the Executive block. |
Controllers with Timing issues. Scheduling blocks |
4 |
Item-Handling |
Lots of issues. Start by modifying a copy of another block; e.g., -Generator (Make an item) -Information (Pass through) -Exit (Destroy) -Activity, Delay (Delay) |
Complex- Knowledge of Item Arrays, Costing arrays, attribute arrays. ItemArrays changing size- see rCount. Connector Messages: Item handshake architecture. |
Item-compatible blocks |
5 |
Flow Requires Industry Developer |
Start by modifying another block. Include Bulk.h |
Not as difficult as item blocks but still quite difficult. Many issues with connector message propagation. |
Flow-compatible blocks |
6 |
Wireless- Block Messages |
Find Partner through Name or Label using: for i=0 to numBlocks(), blockName(I), getBlockLabel(I) Send data via SetDialogParameter, SendMsgToBlock |
Very simple to learn. Simple tricks with ModL block functions. |
Custom tracing blocks, passwords, tricks |
7 |
SDI DB-Aware Requires Industry Developer |
#include "SDI\Includes\SdiDLLs.h"; #include "SDI\Includes\UtilityAPI.h"; #include "SDI\Includes\dbAPI.h"; Then, call GetDatabaseFunctions(); |
Custom Reports, Schedule Generators, Complex table relationships or linked lists, etc. Many SDI blocks leverage this API. |
|
8 |
Supply Chain Requires Supply Chain Builder |
SC.h - Includes plus initilizing calls |
DB API required 1st. SC API Methods are the basis for all SC blocks. Moderate learning curve. |
SC-compatible blocks |