ID : 2243
Cao object
Cao object controls the generation and/or delete of a provider.
It corresponds with CaoWorkspace object of ORiN2.
"Cao" and "gCao"
In PacScript language, Cao object and gCao object are the same data type (CaoWorkspace).
The figure above shows the relationship of Cao and gCao in PacScript language.
Each task (program) has only one local “Cao” object, which is an embedded object.
Cao objects in different tasks are independent, so they do not affect each other.
On the other hand, a “gCao” object exists outside of the task (program) as a global object.
Therefore, if different tasks refer the same element number of gCao, these tasks will affect each other.
(For example; when both Task 1 and Task 2 refer gCao[0].)
Creation and Delete of a Object
Cao objects are managed by each task of PacScript.
A Cao object is created immediately before the task execution and then deleted automatically once the task completes.
For a provider that is managed by a Cao object, "Provider cancel request" (ProviderCancel) is executed in order to cancel an ongoing process at the timing of task stop, and also "Provider clear request" (ProviderClear) is executed in order to revoke the cancel command against the provider at the timing of task start.
Related Command
Command name | Function |
---|---|
Cao.AddController | Create a provider. |
Cao.Index | Look up the provider number. |
Cao.Name | Obtain a provider name. |
Cao.Controllers | Look up the control object (collection) being controlled. |
Example
'Pro1.pcs
Sub Main
PrintDbg "Cao.Name = " & Cao.Name
PrintDbg "Cao.Index = " & Cao.Index
' Connect to controller whose external IP is "192.168.0.1".
Call Cao.AddController("RC1", "CaoProv.DENSO.RC8", "", "Conn=eth:192.168.0.1")
' Connect to controller whose external IP is "192.168.0.2".
Call Cao.AddController("RC2", "CaoProv.DENSO.RC8", "", "Conn=eth:192.168.0.2")
' Display the number of object added to "Cao.Controllers".
PrintDbg "Cao.Controllers.Count = " & Cao.Controllers.Count()
' Clear an error of RC1 (RC1 is an controller whose external IP is "192.168.0.1")
Call Cao.Controllers("RC1").Execute("ClearError" )
' Clear an error of RC2 (RC2 is an controller whose external IP is "192.168.0.2")
Call Cao.Controllers("RC2").Execute("ClearError" )
End Sub
ID : 2243