# FUNCDEMO.MOD

### From Support

*See also: How to read .MOD pages*

## Contents |

# Description

FUNCDEMO.MOD demonstrates the use of the following functions:

1.ASK{X}: Displays the value of expression, X, during the run and allows you to change it (Also used in ASKDEMO.MOD).

2.COS{Y}: Returns the cosine of Y (Y in radians).

3.DISK{F,I}: Reads the Ith expression from the file F, to read sequentially set I=0 if I>number of entries, the reader will wrap around. The file name, F, must include the disk and path if necessary.

4.LN{Y}: Returns the natural logarithm of Y.

5.MAX{Y,X}: Returns the maximum of X and Y.

6.MIN{Y,X}: Returns the minimum of X and Y.

7.MOD{Y,X}: Y modulo X. Returns the integer remainder of Y is divided by X. See modular arithmetic.

8.SIN{Y}: Returns the sine of Y (Y in radians).

# State Variables

Variable Name | Abbreviation | Variable Description | Size | Type |
---|---|---|---|---|

X | X | The function argument | 1 | Real |

LOG | L | The log of X | 1 | Real |

SIN | S | The sin of X | 1 | Real |

COS | C | The cos of X | 1 | Real |

M | M | The max, min, or mod of X | 1 | Real |

D | D | Value read from the disk in FUNCTEST.DAT | 1 | Real |

Y | Y | The integer part of X*10 (For DISKFN) | 1 | Integer |

I | I | Index to count iterations | 1,1 | Integer |

# Vertices

Vertex Name | Vertex Description | State Changes |
---|---|---|

RUN | The simulation is started | None |

NEXT | Incrementing of X | X=CLK/10 |

MAXFN | Computation of the max of X and .5 | M=MAX{X;.5} |

LOGFN | Taking the log of X | L = LN{X} |

MODFN | Remainder when Y=X*10 is divided by 2 | M=MOD{Y;2} |

SINFN | Taking the sin of X | S = SIN{X} |

COSFN | Taking the cosine of X | C = COS{X} |

MINF | Minimum of X and .5 | M=MIN{X;.5} |

SET | Reset variable to zero (see outgoing edge) | None |

DISKFN | Reading of the X*10th item on FUNCTEST.DAT | D=DISK{FUNCDEMO.DAT;Y}, I=D+10 |

# Initialization Conditions

Variable | Description |
---|---|

I | Index to count iterations |

X | The function argument |

LOG | The log of X |

SIN | The sin of X |

COS | The cos of X |

M | The max,min, or mod of X |

D | Value read from the disk in FUNCTEST.DAT |

# Event Relationship Graph

# English Translation

An English translation is a verbal description of a model, automatically generated by SIGMA.

The SIGMA Model, FUNCDEMO.MOD, is a discrete event simulation. It models A DEMONSTATION OF SOME SIGMA FUNCTIONS.

I. STATE VARIABLE DEFINITIONS.

For this simulation, the following state variables are defined:

X: THE FUNCTION ARGUMENT (real valued) L: THE LOG OF X (real valued) S: THE SIN OF X (real valued) C: THE COSINE OF X (real valued) M: THE MAX,MIN,OR MOD (real valued) D: VALUE READ FROM THE DISK IN FUNCTEST.DAT (real valued) Y: THE INTEGER PART OF X*10 (FOR DISKFN) (integer valued) I: INDEX TO COUNT ITERATIONS (integer valued)

II. EVENT DEFINITIONS.

Simulation state changes are represented by event vertices (nodes or balls) in a SIGMA graph. Event vertex parameters, if any, are given in parentheses. Logical and dynamic relationships between pairs of events are represented in a SIGMA graph by edges (arrows) between event vertices. Unless otherwise stated, vertex execution priorities, to break time ties, are equal to 5.

1. The RUN() event occurs when START OF THE RUN. After every occurrence of the RUN event: Unconditionally, START THE RUN ; that is, schedule the NEXT(I) event to occur without delay... using the parameter value(s) of 0.

2. The NEXT(I) event occurs when INCREMENTING OF X . This event causes the following state change(s): X=CLK/10 After every occurrence of the NEXT event: If I<=14, then DO THE NEXT VALUE OF X; that is, schedule the NEXT(I) event to occur in 1 time units... using the parameter value(s) of I+1. Unconditionally, FIND THE MAXIMUM OF X AND .5; that is, schedule the MAXFN() event to occur without delay. If X>.3, then schedule the SET() event to occur without delay. (Time ties are broken by an execution priority of 6.) If X>0, then TAKE THE LOG OF X; that is, schedule the LOGFN() event to occur without delay. Unconditionally, FIND THE VALUE OF 10*X MOD 3; that is, schedule the MODFN(Y) event to occur without delay... using the parameter value(s) of X*10. Unconditionally, TAKE THE SINE OF X ; that is, schedule the SINFN() event to occur without delay. Unconditionally, TAKE THE COSINE OF X; that is, schedule the COSFN() event to occur without delay. Unconditionally, schedule the MINF() event to occur without delay.

3. The LOGFN() event occurs when TAKING THE LOG OF X. This event causes the following state change(s): L = LN{X} No additional events are scheduled here.

4. The SINFN() event occurs when TAKING THE SIN OF X. This event causes the following state change(s): S = SIN{X} No additional events are scheduled here.

5. The COSFN() event occurs when TAKING THE COSINE OF X. This event causes the following state change(s): C = COS{X} No additional events are scheduled here.

6. The MAXFN() event occurs when COMPUTATION OF THE MAX OF X AND .5. This event causes the following state change(s): M=MAX{X;.5} No additional events are scheduled here.

7. The MODFN(Y) event occurs when REMAINDER WHEN Y=X*10 IS DIVIDED BY 2. This event causes the following state change(s): M=MOD{Y;2} No additional events are scheduled here.

8. The DISKFN(Y) event occurs when READING OF THE X*10TH ITEM ON FUNCTEST.DAT. This event causes the following state change(s): D=DISK{FUNCDEMO.DAT;Y} I=D+10 After every occurrence of the DISKFN event: Unconditionally, schedule the NEXT(I) event to occur without delay... using the parameter value(s) of ASK{I}.

9. The SET() event occurs when RESET VARIABLE TO ZERO (SEE OUTGOING EDGE). After every occurrence of the SET event: If SET{12345}, then immediately cancel the next scheduled occurrence of the NEXT event... provided that the following attribute(s) match for that NEXT event. I+5 (Time ties are broken by an execution priority of 4.) Unconditionally, READ ITEM, 10*X, ON DISK FILE, FUNCTEST.DAT; that is, schedule the DISKFN(Y) event to occur without delay... using the parameter value(s) of X*10.

10. The MINF() event occurs when MINIMUM OF X AND .5. This event causes the following state change(s): M=MIN{X;.5} No additional events are scheduled here.