This is an old revision of the document!
GEM300 Scripts
GEM300 standards consist of state models. This Intel transcript provides an overview. As you move product, or carriers through your tool the control system must update the current state to ensure that the host can correctly manage tool operation.
In all the TransSECS GEM300 implementations there are two, fundamental part.
- “Callback” interface - this is how you are notified of the host's requests
- “Service Wrapper” - this is how you indicate that changes at the tool.
Individual standards have other components, E40 Process Jobs, E87 Carriers, E90 Substrates, E94 Control Jobs, etc.
Note: You do not need to implement, or parse SECS messages. This is all done for you within the interface. Do not add GEM300 messages to the TransSECS interface.
E39
E39 is a required standard to support GEM300, however the implementation and operation of E39 is completely transparent to the TransSECS GEM300 operation. You need only initiailize the interface.
E40
Provides a model of the process state within the tool, primarily through the management of “Process Jobs”. A Process Job is created by the host, or on rare occasions by the tool. In a simple example, the process job may go through the following steps:
- Allocated - state transition 2 - the Process Job is removed from the queue in preparation for execution - processJob.allocated();
- Material Arrived - no state transition - indicate that the material for the Process Job is at the tool - processJob.materialArrived();
- Start the Job - state transition 4 - start execution of the Process Job - processJob.readyToStart(); (Note: If the process job is not set to start automatically a “Start” command will be required from the host - see below).
- Processing Complete - state transition 6 - The material processing is complete - processJob.complete();
- Material Departed - state transition 7 - The material has been removed from the tool. The process job is complete and will be deleted - processJob.materialDeparted();
E40 Service Wrapper
The E40 Service Wrapper provides access to control the flow of E40. Most importantly, it provides access to the individual Process Jobs.
A listing of all process jobs is provided by:
E40ServiceWrapper.getInstance().getAllPRJobs();
A particular process job can be obtained by the job id:
E40ServiceWrapper.getInstance().getPRJob(jobID)
E40 Callback Interface
The E40 Callback Interface provides notification of activity from the host. There are four methods:
prStateChange : function (prJob, oldState, newState)
Indicates that the state of a process job has change.
prJobCreate : function (prJob)
A request to create a process job. No action is required if the creation of the process job is acceptable. If not, throw an E40Exception with the reason it's not acceptable. prSetRecipeVariable : function (prJob, recVarList) This method provides recipe variable. Support is option, if supported this must set the provided recipe variables on the job id.
prSetMtrlOrder : function (prCurrentMtrlOrder, prNewMtrlOrder)
Set the order in which process jobs should be processed. Possible options are: 1 = ARRIVAL process whichever material first arrives 2 = OPTIMIZE process in an order that maximizes throughput 3 = LIST follow the order in the list
prCommandCallback : function (prJob, prCmd, prCmdParameterList)
Called when the host requests that a command be executed on the process job. Possible commands are ABORT,STOP,CANCEL,PAUSE,RESUME,STARTPROCESS Only ABORT must be supported. If the command is not supported, throw an E40Exception
Sample Implementation
var E39MessageHandler = Java.type("com.ergotech.secs.e39.E39MessageHandler"); var E40MessageHandler = Java.type("com.ergotech.secs.e40.E40MessageHandler"); var E40ServiceWrapper = Java.type("com.ergotech.secs.e40.E40ServiceWrapper"); var E40CallbackInterface = Java.type("com.ergotech.secs.e40.E40CallbackInterface"); var ProcessJob = Java.type("com.ergotech.secs.e40.ProcessJob"); var TransSecsController = Java.type("com.ergotech.transsecs.secs.TransSecsController"); var Thread = Java.type("java.lang.Thread"); // create the callback interface. var E40Callback = new E40CallbackInterface() { prStateChange : function (prJob, oldState, newState) { print ("State Change for " + prJob.getPrJobId() + " From: " + ProcessJob.getStateName(oldState) + " to " + ProcessJob.getStateName(newState)); // send the new state for the process job to the PLC /E40Modbus/ProcessJobId->setStringValue(prJob.getPrJobId()); /E40Modbus/CurrentProcessJobState->setIntValue(newState); }, prJobCreate : function (prJob) { // a request to create a process job. It;s possible to query the PLC (or any other subsystem // to determine if this process job is allowable. If not, throw an E40Exception with the // reason it's not acceptable. Here's we'll always accept it print ("Job Creation of " + prJob.getPrJobId() + " permitted"); // indicate that this job is not allocated /E40Modbus/Allocated->setIntValue(0); // record the id /E40Modbus/ProcessJobId->setStringValue(prJob.getPrJobId()); }, prSetRecipeVariable : function (prJob, recVarList) { // set the provided recipe variables on the job id. // that is, send the recVarList to the PLC if ( recVarList != null ) { for ( counter = 0 ; counter < recVarList() ; counter++ ){ print("Host Requested Recipe Variable \"" + recVarList(counter).getStringValue() + "\" on " + prJob ); } } }, prSetMtrlOrder : function (prCurrentMtrlOrder, prNewMtrlOrder) { // Set the order in which process jobs should be processed // possible options are: //1 = ARRIVAL process whichever material first arrives //2 = OPTIMIZE process in an order that maximizes throughput //3 = LIST follow the order in the list }, prCommandCallback : function (prJob, prCmd, prCmdParameterList) { print("Host Requested \"" + prCmd + "\" on " + prJob + " with parameters " + prCmdParameterList); // called when the host reequests that a command be executed on the process job // possible commands are ABORT,STOP,CANCEL,PAUSE,RESUME,STARTPROCESS; cmds = ['NONE','ABORT','STOP','CANCEL','PAUSE','RESUME','STARTPROCESS']; // should never be 'NONE' // A different PLC register could be used for each of these and so the command // could be indicated by, for example: // /ModbusE4/STARTPROCESS->setIntValue(1); // Here we use a single register and indicate the commands, ABRORT=1, STOP=2, etc. // first indicate which process job the command is being executed on /E40Modbus/ProcessJobId->setStringValue(prJob.getPrJobId()); // send the parameters - here we just print them if ( prCmdParameterList != null ) { for ( counter = 0 ; counter < prCmdParameterList.size() ; counter++ ){ print("Host Requested Parameter \"" + prCmdParameterList.get(counter).getStringValue() + "\" on " + prJob ); } } // get the index of the command cmdId = cmds.indexOf(prCmd); /E40Modbus/PrCmd->setIntValue(cmdId); } }; /// START OF MAIN JAVASCRIPT CODE /// print("wait for controller THREAD started"); var controller = null; do { //print("host is still null"); Thread.sleep(50); //wait 50 ms controller = TransSecsController.findController("E40PLCTool"); } while (controller == null); try { E39MessageHandler.addMessageHandler(controller.getControllerName()); E40MessageHandler.addMessageHandler(); } catch ( e) { print (e); } E40ServiceWrapper.getInstance().registerCallback(E40Callback); print("E40 Registered");
As noted above, if the process job is not set to auto start, you will need to start the job at the tool after the host sends the start command. In this case, you may want to check the transition to “PROCESSING” in the state change function. Here's a quick code snippet.
prStateChange : function (prJob, oldState, newState) { if (newState == ProcessJobStates.PROCESSING.getStateId() && oldState == ProcessJobStates.WAITINGFORSTART.getStateId() ) { // send the commands to the control system to start executing the process job } // similar checks may be needed for transitions from PAUSED // additional state-change related code. }