|
There are two versions of this software, and this help file applies to both:
|
ModelRisk
can be used in any programming language that supports calls to DLLs, for
example Visual Basic, C++ and Delphi. ModelRisk has a COM-object called
ModelRisk Library which is automatically registered in a local system
when ModelRisk is installed.
To access ModelRisk functions from Visual Basic, for example, one needs to register ModelRisk as a reference for the VB project.
In the Excel VBA editor (brought up with ALT+F11), select Tools from the menu, then References... In the References window presented, mark the ModelRisk Library in the list (see screenshot on the right).
Now when you are writing VBA code, you can call ModelRisk functions, so you can use commands like
x=ModelRisk.VoseNormal(0,2)
To see the available functions in the ModelRisk Library once it is added to the references, open the Object Browser (F2) and then select ModelRisk from the first combo-box.
An example of a VB routine is given below:
Sub TestMR() ' Sample from the bounded Normal(0,1) distribution Dim Sample As Double Sample = ModelRisk.VoseNormal(0, 1, , VosePBounds(0.1, 0.9)) ' Calculate the combined probability of observing ' the values 125, 112 and 94 from Poisson(100) distribution Dim Prob as Double Dim Values As Variant Values = Array(125, 112, 94) Prob = ModelRisk.VosePoissonProb(Values, 100, 0) ' Use Central Limit Theorem to sample from the ' distribution of the sum of 120 Normal(25,3) distributions Dim CLT As Double CLT = ModelRisk.VoseCLTSum(120, 25, 3) ' Print the output values to the Debug console Debug.Print Sample, Prob, CLT End Sub |
ModelRisk’s COM Object offers a limited number of ModelRisk tools, such as distributions.
The full set of ModelRisk tools is available to programmers in the ModelRisk Dynamic-Link Library (DLL), which allows integrating the full power of ModelRisk into custom, non-spreadsheet standalone applications. For more information regarding the ModelRisk DLL please contact us at info@vosesoftware.com.