Delta Function M-Files
Delta files are used to modify the parameters of the models objects during a simulation.
Functional Interface:
The following is the function interface for delta functions:
function [del, curlink, simdata, errmsg] = delfunc(action, del, curlink, simdata)
Delta Function Parameters:
del the “del” variable is the instance of the Delta object that is invoking the delta function.
- currently, no uses for this object within the handler are employed.
curlink the “curlink” variable is the instance of the link that points to the object:
The link labeled T:1 is the curlink for the reflected target. The link labeled R:2 is the next link for the reflected target. The next object after the target object is the look object.
The Delta object has no current link since no link points to it. The link labeled O:3 is the next link for the the Delta. The next object after the delta object is the target object.
The curlink can be used to test what kind of link it is (more)
- istransmitted(curlink) – input are transmitted fields.
- isreflected(curlink) – input are reflected fields
- isoperational(curlink) – input is an operational link.
- issimulated(curlink) – this link was generated by the simulator.
simdata – simdata is a MATLAB structure, and it contains a lot of useful information:
simdata.Ext | Current value for Transmitted Field X | (read/write) |
simdata.Eyt | Current value for Transmitted Field Y | (read/write) |
simdata.Ezt | Current value for Transmitted Field Z | (read/write) |
simdata.Exr | Current value for Reflected Field X | (read/write) |
simdata.Eyr | Current value for Reflected Field Y | (read/write) |
simdata.Ezr | Current value for Reflected Field Z | (read/write) |
simdata.sysxvec | abcissa vector for the fields. | (read/write) |
simdata.sysyvec | ordinate vector for the fields. | (read/write) |
simdata.LAMBDA | the value for LAMBDA | (read/write) |
simdata.SourceType | the source’s type.
|
(read/write) |
simdata.SourceTypePoints | number of source points if SourceType equals 2. | (read/write) |
simdata.NextObject | the instance of the next object. (see: curlink)this is typically the most important simdata variable that a delta function uses.look at the scripttool’s predefined scripts (more) which show how NextObject can be used. |
(read/write) |
simdata.VisitCount | Number of times that this object has been calculated. | (read only) |
simdata.ChainIndex | When objects are added to a chain, an array of objects is created.simdata.ChainIndex is the location of the Delta Object in this array. |
(read only) |
errmsg – If delfunc wishes to report an error, it would execute something similar to the following code fragment:
errmsg = 'Invalid Parameter Value for Stop Diameter';
This causes the simulator to stop simulating.