Template:Repository.Ex: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
    
    
  {{APIComment|'Retrieve the first model in the list.}}
  {{APIComment|'Retrieve the first model in the list.}}
   Dim AModel as cModel
   Dim AModel As cModel
   AModel = MyRepository.GetModel(ListOfModels(0).ID)
   AModel = MyRepository.GetModel(ListOfModels(0).ID)
    
    
  {{APIComment|'Calculate the reliability at time = 50 and save the result. See [[CModel.Reliability|Reliability]].}}
  {{APIComment|'Calculate the reliability at time = 50 and save the result. See [[CModel.Reliability|Reliability]].}}
   Dim Rel as Double
   Dim Rel As Double
   Rel = AModel.Reliability(50)
   Rel = AModel.Reliability(50)
    
    
  {{APIComment|'Disconnect from the repository.}}
  {{APIComment|'Disconnect from the repository.}}
   MyRepository.DisconnectFromRepository()
   MyRepository.DisconnectFromRepository()

Revision as of 21:48, 27 May 2014

 Dim MyRepository As New Repository
 
 'Connect to a Synthesis repository. 
 Dim Success As Boolean = False
 Success = MyRepository.ConnectToRepository("C:\Users\Name\Documents\ReliaSoft\Files\repository.rsr9")
 
 'Get a list of the names/IDs of projects in the connected repository. 
 Dim ListOfProjects() As NameIdPair
 ListOfProjects = MyRepository.GetAllProjects()
 
 'Open the first project in the list. 
 MyRepository.SetCurrentProject(ListOfProjects(0).ID)
 
 'Get a list of the names/IDs of models in the current project. 
 Dim ListOfModels() As NameIdPair
 ListOfModels = MyRepository.GetAllModelsInfo()
 
 'Retrieve the first model in the list. 
 Dim AModel As cModel
 AModel = MyRepository.GetModel(ListOfModels(0).ID)
 
 'Calculate the reliability at time = 50 and save the result. See Reliability. 
 Dim Rel As Double
 Rel = AModel.Reliability(50)
 
 'Disconnect from the repository. 
 MyRepository.DisconnectFromRepository()