gem300_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gem300_scripts [2021/07/12 18:31]
wikiadmin
gem300_scripts [2024/09/19 14:54] (current)
wikiadmin
Line 80: Line 80:
   print ("State Change for " + prJob.getPrJobId() + " From: " + ProcessJob.getStateName(oldState) + " to " + ProcessJob.getStateName(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   // send the new state for the process job to the PLC
-  /E40PLC/ProcessJobId->setStringValue(prJob.getPrJobId()); +  /GEM300PLC/ProcessJobId->setStringValue(prJob.getPrJobId()); 
-  /E40PLC/CurrentProcessJobState->setIntValue(newState);+  /GEM300PLC/CurrentProcessJobState->setIntValue(newState);
  },  },
  prJobCreate : function (prJob) {  prJobCreate : function (prJob) {
Line 89: Line 89:
    print ("Job Creation of " + prJob.getPrJobId() + " permitted");    print ("Job Creation of " + prJob.getPrJobId() + " permitted");
    // indicate that this job is not allocated    // indicate that this job is not allocated
-   /E40PLC/Allocated->setIntValue(0);+   /GEM300PLC/Allocated->setIntValue(0);
    // record the id    // record the id
-   /E40PLC/ProcessJobId->setStringValue(prJob.getPrJobId());+   /GEM300PLC/ProcessJobId->setStringValue(prJob.getPrJobId());
  },  },
  prSetRecipeVariable : function (prJob, recVarList) {  prSetRecipeVariable : function (prJob, recVarList) {
Line 122: Line 122:
      
   // first indicate which process job the command is being executed on   // first indicate which process job the command is being executed on
-  /E40PLC/ProcessJobId->setStringValue(prJob.getPrJobId());+  /GEM300PLC/ProcessJobId->setStringValue(prJob.getPrJobId());
   // send the parameters - here we just print them   // send the parameters - here we just print them
   if ( prCmdParameterList != null ) {   if ( prCmdParameterList != null ) {
Line 132: Line 132:
   // get the index of the command   // get the index of the command
   cmdId = cmds.indexOf(prCmd);   cmdId = cmds.indexOf(prCmd);
-  /E40PLC/PrCmd->setIntValue(cmdId);+  /GEM300PLC/PrCmd->setIntValue(cmdId);
  }  }
   };   };
Line 143: Line 143:
         //print("host is still null");           //print("host is still null");  
         Thread.sleep(50); //wait 50 ms         Thread.sleep(50); //wait 50 ms
-        controller = TransSecsController.findController("E40PLCTool");+        controller = TransSecsController.findController("GEM300PLCTool");
     } while (controller == null);     } while (controller == null);
              
Line 173: Line 173:
  }  }
 </code> </code>
-        +==== E40 Python Example ==== 
 +<code python> 
 +#!/usr/bin/python3 
 +import jpype 
 +from jpype import JProxy, JArray, JInt 
 +import jpype.imports 
 +from jpype.types import * 
 + 
 +jpype.startJVM(classpath=['.', './GEMTool.jar']) 
 + 
 +# Importing the necessary Java classes 
 +from com.ergotech.secs.e39 import E39MessageHandler 
 +from com.ergotech.secs.e40 import E40MessageHandler, E40ServiceWrapper, E40CallbackInterface, ProcessJob 
 +from com.ergotech.transsecs.secs import TransSecsController 
 +from java.lang import Thread 
 + 
 +# Create the callback interface using a proxy 
 +class E40CallbackImplementation(E40CallbackInterface): 
 +    def prStateChange(self, prJob, oldState, newState): 
 +        print(f"State Change for {prJob.getPrJobId()} From: {ProcessJob.getStateName(oldState)} to {ProcessJob.getStateName(newState)}"
 +        # Send the new state for the process job to the PLC 
 +        # /GEM300PLC/ProcessJobId->setStringValue(prJob.getPrJobId()); 
 +        # /GEM300PLC/CurrentProcessJobState->setIntValue(newState); 
 + 
 +    def prJobCreate(self, prJob): 
 +        print(f"Job Creation of {prJob.getPrJobId()} permitted"
 +        # Indicate that this job is not allocated 
 +        # /GEM300PLC/Allocated->setIntValue(0); 
 +        # Record the id 
 +        # /GEM300PLC/ProcessJobId->setStringValue(prJob.getPrJobId()); 
 + 
 +    def prSetRecipeVariable(self, prJob, recVarList): 
 +        if recVarList is not None: 
 +            for counter in range(recVarList.size()): 
 +                print(f"Host Requested Recipe Variable \"{recVarList.get(counter).getStringValue()}\" on {prJob}"
 + 
 +    def prSetMtrlOrder(self, prCurrentMtrlOrder, prNewMtrlOrder): 
 +        # Set the order in which process jobs should be processed 
 +        pass 
 + 
 +    def prCommandCallback(self, prJob, prCmd, prCmdParameterList): 
 +        print(f"Host Requested \"{prCmd}\" on {prJob} with parameters {prCmdParameterList}"
 +        cmds = ['NONE', 'ABORT', 'STOP', 'CANCEL', 'PAUSE', 'RESUME', 'STARTPROCESS'
 +        # First indicate which process job the command is being executed on 
 +        # /GEM300PLC/ProcessJobId->setStringValue(prJob.getPrJobId()); 
 + 
 +        if prCmdParameterList is not None: 
 +            for counter in range(prCmdParameterList.size()): 
 +                print(f"Host Requested Parameter \"{prCmdParameterList.get(counter).getStringValue()}\" on {prJob}"
 + 
 +        # Get the index of the command 
 +        cmdId = cmds.index(prCmd) 
 +        # /GEM300PLC/PrCmd->setIntValue(cmdId); 
 + 
 +# Instantiate the callback 
 +E40Callback = E40CallbackImplementation() 
 + 
 +# Main Python code 
 +print("Register GEM300"
 + 
 +controller = None 
 +while controller is None: 
 +    Thread.sleep(50)  # wait 50 ms 
 +    controller = TransSecsController.findController("GEM300PLCTool"
 + 
 +try: 
 +    E39MessageHandler.addMessageHandler(controller.getControllerName()) 
 +    E40MessageHandler.addMessageHandler() 
 +except Exception as e: 
 +    print(e) 
 + 
 +# Register the callback 
 +E40ServiceWrapper.getInstance().registerCallback(E40Callback) 
 + 
 +print("E40 Registered"
 + 
 +</code>
 ==== E94 ==== ==== E94 ====
  
Line 180: Line 256:
 === E94 Service Wrapper === === E94 Service Wrapper ===
  
-The E94 Service Wrapper provides access to control the flow of E94, however there are not actions required by the tool controller to manage a control job.+The E94 Service Wrapper provides access to control the flow of E94, however there are no actions required by the tool controller to manage a control job.
  
 === E94 Callback Interface === === E94 Callback Interface ===
Line 275: Line 351:
 </code> </code>
  
-=== E94 Callback Interface ===+=== E87 Callback Interface ===
  
 The E87 Callback Interface provides notification of activity from the host.  A sample implementation of the interface is provided below. The tool control system should implement as many of the methods are required to progress the carrier through the tool. The E87 Callback Interface provides notification of activity from the host.  A sample implementation of the interface is provided below. The tool control system should implement as many of the methods are required to progress the carrier through the tool.
  
 <code> <code>
-var E40Callback = new E87CallbackInterface() {+var E87Callback = new E87CallbackInterface() {
      
  
  • gem300_scripts.1626132693.txt.gz
  • Last modified: 2021/07/12 18:31
  • by wikiadmin