Function & Argument Type(s)
|
Description
|
Example
|
.getClockCycle (double cycle_time) |
Return the number of cycle_time clock cycles in a Time Value. |
MyTime = 1.0e-6 X = MyTime.getClockCycle(1.0E-9) = 999 |
.getSlotCycle (double cycle_time, |
|
X = (5.5e-9).getSlotCycle(1.0E-9, 10.0E-9) = 5 |
.incr(int max) Return Type: Integer |
Increment a number and if it equals the argument of max, the result will be set to 0. |
MyToken = 7 X = MyToken.incr(8) = 0 |
.irand() Return Type: Integer (0 or 1) |
Return either 0 or 1 based on an internally generated random(). If the internally generated number is < 0.5, it is 0 else 1. |
MyInteger = 100 X = MyInteger.irand() |
.irand(int max) Return Type: Integer |
Return a uniform random number |
MyInteger = 100 X = MyInteger.irand(104) = 101 |
rand(DoubleNumber,10.0) |
Perform rand(N.N) and it will generate values from 0.0 to 10.0. If DoubleNumber was 1.0, the generated values would be from 1.0 to 10.0 uniformly distributed. |
DblNum = 0.0 MyRnd = rand(DblNum,10.0) = 6.4613426633106 |
.random() Return Type: Double |
Return a uniform random number |
MyDouble = 100.0 X = MyDouble.random() = 0.368463 |
.random(double max) Return Type: Double |
Return a uniform random number |
MyDouble = 0.0 X = MyDouble.random(4.0) = 1.513136 |
.check () Return Type: Boolean |
Checks if the name is a Parameter, Virtual Connection, Queue, SstemResource or a variable. |
>> b = VirtualDevice.check() true |
.check (string fieldname) Return Type: Boolean |
Checks if the name is a field of the data structure. |
>> b = DS.check(Priority) true |
longValue() Return Type: Integer, long |
To convert an integer to long. |
IntNumber = 1 MyLong = IntNumber.longValue |
.doubleValue() Return Type: double, integer, long |
Convert an integer or long to double. |
IntNumber = 1 MyDouble = IntNumber.doubleValue() |
newToken(Value) Return Type: Create a new data structures |
Create
a new data structure with the data structure template (Value).
This RegEx does not support CLASSPATH or PATH. It uses the same
format for the Data Structure text files as the Traffic block. Please
see he examples of the possible formats. |
x = newToken("Header")
--File in $VS/VisualSim/data: "Processor_DS" --Relative path in $VS: "VisualSim.data.Processor_DS" --Absolute path is required for accessing files located anywhere: "C:.VisualSim.DS.Processor_DS" on Windows and ".VisualSim.DS.Processor_DS" on Unix/Linux. |
Event() Return Type: Boolean type, true if exists |
Generate a Model Event, where MyEventName is a string of the event name. |
EVENT(MyEventName) |
.read() Return Type: Any data type |
Reads a local memory in a different Hierarchical block. To get the path to the variable, look at the top-bar of the hierarchical view. |
X = ( ModelName + '.' |
.read(string Block_Name) Return Type: Any data type |
Reads a variable in any Script, |
X = MemoryName.read(VirtualMachineName) |
.write(Value) Return Type: Any data type |
Writes to a local variable in a different Hierarchical block. To get the path to the variable location, look at the top-bar of the hierarchical view. |
X = (ModelName + '.' |
.write(string Block_Name, Value) Return Type: Any data type |
Write to a variable in any Script, |
X = MemoryName.write(VirtualMachineName, Token) |
.setFields Array: (array of field names, array of field values) Return Type: Data structure |
Add or update fields in a Data Structure Note: You can add a single field by assigning a value on the RHS to a new name field on the LHS. |
a = {x=1,y=2} X = a.setFields({"y","z"}, {6,true}) = {x=1,y=6,z=true} |
.setField(Field_Name,Value) Field_Name is a single field name (field name, field value) Return Type: Data structure | Add or update field in a Data Structure Note: You can add a single field by assigning a value on the RHS to a new name field on the LHS. | a = {x=1,y=2} X = a.setField("y", 6) = {x=1,y=6} |
.getFields Array: (array of field names) Return Type: Array |
Array of values in the listed fields of the Data Structure Note: In the ExpressionList and Script, you can get a single field by typing DS.fieldname |
a = {x=1,y=6,z=true} X = a.getFields({"y","z"}) = {6,true} |
.removeFields (array field names) Return Type: Data Structure |
Remove fields from a Data structureToken, based on an Array of field names. |
a = {x=1,b=2,c=3} e = a.removeFields({"b","c"}) = {x = 1} |
.missingFields (array field_names) Return Type: Boolean |
Checks if any of the fields listed are missing. Returns an array with list of missing fields |
>> a = {x=1,y=2} {x = 1, y = 2} >> b = a.missingFields({"y","a"}) ={"a"} |
setFields Array: (data Structure name, array of field names, array of field values) Return Type: Data structure |
Add or update fields in a Data Structure Note: You can add a single field by assigning a value on the RHS to a new name field on the LHS. |
a = {x=1,y=2} X = setFields(a,{"y","z"}, {6,true}) = {x=1,y=6,z=true} |
getFields Array: (data Structure name, array of field names) Return Type: Array |
Array of values for the list of fields in a Data Structure Note: In the ExpressionList and Script, you can get a single field by typing DS.fieldname |
a = {x=1,y=6,z=true} X = getFields(a,{"y","z"}) = {6,true} |
removeFields (data Structure name, array field names) Return Type: Data Structure |
Remove fields from a Data structureToken, based on an Array of field names. |
a = {x=1,b=2,c=3} e = removeFields(a, {"b","c"}) = {x = 1} |
checkField (data structure name, string field_name) Return Type: Boolean |
Checks if the data structure contains a field. Returns true if found and false, if not found. |
>> a = {x=1,y=2} {x = 1, y = 2} >> b = checkField(a,"z") false >> b = checkField(a,"x") true |
checkField (data structure name, array field_names) Return Type: Boolean |
Checks if the data structure contains the list field. Returns an array with true if found and false, if not found. The array will list the responses in the order of the field names |
>> a = {x=1,y=2} {x = 1, y = 2} >> b = checkField(a,{"y","a"}) ={true,false} |
.words(int width) Return Type: integer |
Determines the number of words (4 bytes) in a integer value for a given width of transfer. The count is rounded (ceiling) to the next higher integer value. |
>> Value = 10 |
.removeField(string field_name) Return Type: Boolean, true if removed, else false returned |
Remove a field of a Data Structure. |
MyDS = {a=1,b=2,c=3} MyDS.removeField("a") = true MyDS ={b = 2, |
$VS\doc\Training_Material\General\RegEx\RegEx_DS_Test.xml
Created with the Personal Edition of HelpNDoc: Full-featured Help generator