Repository Class: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:InProgress}}
{{Template:InProgress}}{{Template:API}}{{Template:APIBreadcrumb|9, 10|}}
{{Template:APIClass|Repository Class| }}  
This is a class that allows you to access a Synthesis repository. The class has following sections containing methods and properties that allow you to read, create and edit various objects in the repository. See [[#Usage_Example|Example]] at the bottom of this page. Also see the [[#Notes|important note]] for version 9 users.


== Repository ==
 
Represents a Synthesis repository. Use the methods in the [[#Repository|Repository]] group to establish a connection to the Synthesis repository. Once you have a connection, you can use the rest of the methods and properties in this class to read and write data to the repository.
 
See [[#Example|Example]] at the bottom of this page. Also see the [[#Notes|important note]] for version 9 users.
 
==Methods==
===Repository===
*[[Repository.ConnectToRepository|ConnectToRepository]] {{APIComment|{{Template:Repository.ConnectToRepository.Cmt}}}}
*[[Repository.ConnectToRepository|ConnectToRepository]] {{APIComment|{{Template:Repository.ConnectToRepository.Cmt}}}}
*[[Repository.ConnectToAccessRepository|ConnectToAccessRepository]] {{APIComment|{{Template:Repository.ConnectToAccessRepository.Cmt}}}}
*[[Repository.ConnectToAccessRepository|ConnectToAccessRepository]] {{APIComment|{{Template:Repository.ConnectToAccessRepository.Cmt}}}}
Line 11: Line 15:
*[[Repository.EnforceRENOCompliance|EnforceRENOCompliance]] {{APIComment|Disallows spaces and special characters in names of models. This will ensure that all models can be used in RENO equations.}}
*[[Repository.EnforceRENOCompliance|EnforceRENOCompliance]] {{APIComment|Disallows spaces and special characters in names of models. This will ensure that all models can be used in RENO equations.}}


''' Project '''
===Project===
*[[Repository.Project.GetAllProjects|GetAllProjects]] {{APIComment|{{Template:Repository.GetAllProjects.Cmt}}}}
*[[Repository.Project.GetAllProjects|GetAllProjects]] {{APIComment|{{Template:Repository.GetAllProjects.Cmt}}}}
*[[Repository.Project.GetCurrentProject|GetCurrentProject]] {{APIComment|{{Template:Repository.GetCurrentProject.Cmt}}}}
*[[Repository.Project.GetCurrentProject|GetCurrentProject]] {{APIComment|{{Template:Repository.GetCurrentProject.Cmt}}}}
*[[Repository.Project.SetCurrentProject|SetCurrentProject]] {{APIComment|{{Template:Repository.SetCurrentProject.Cmt}}}}
*[[Repository.Project.SetCurrentProject|SetCurrentProject]] {{APIComment|{{Template:Repository.SetCurrentProject.Cmt}}}}


''' Unit '''
===Unit===
*[[Repository.Unit.GetAllUnits|GetAllUnits]] {{APIComment|{{Template:Repository.GetAllUnits.Cmt}}}}
*[[Repository.Unit.GetAllUnits|GetAllUnits]] {{APIComment|{{Template:Repository.GetAllUnits.Cmt}}}}


''' Model '''
===Model===
*[[Repository.Model.GetAllModelsInfo|GetAllModelsInfo]] {{APIComment|{{Template:Repository.GetAllModelsInfo.Cmt}}}}
*[[Repository.Model.GetAllModelsInfo|GetAllModelsInfo]] {{APIComment|{{Template:Repository.GetAllModelsInfo.Cmt}}}}
*[[Repository.Model.GetAllModels|GetAllModels]] {{APIComment|{{Template:Repository.GetAllModels.Cmt}}}}
*[[Repository.Model.GetAllModels|GetAllModels]] {{APIComment|{{Template:Repository.GetAllModels.Cmt}}}}
Line 28: Line 32:
*[[Repository.Model.DeleteModel|DeleteModel]] {{APIComment|Checks if the model is not in use and deletes the model. Returns true if success, false otherwise. Throws an exception if the model is in use.}} [[#Notes|*]]
*[[Repository.Model.DeleteModel|DeleteModel]] {{APIComment|Checks if the model is not in use and deletes the model. Returns true if success, false otherwise. Throws an exception if the model is in use.}} [[#Notes|*]]


''' URD '''
===URD===
*[[Repository.URD.GetAllURDs|GetAllURDs]] {{APIComment|{{Template:Repository.GetAllURDs.Cmt}}}}
*[[Repository.URD.GetAllURDs|GetAllURDs]] {{APIComment|{{Template:Repository.GetAllURDs.Cmt}}}}
*[[Repository.URD.AddURD|AddURD]] {{APIComment|{{Template:Repository.AddURD.Cmt}}}}
*[[Repository.URD.AddURD|AddURD]] {{APIComment|{{Template:Repository.AddURD.Cmt}}}}
Line 34: Line 38:
*[[Repository.URD.GetURD|GetURD]] {{APIComment|Returns the URD with the provided ID. Returns nothing if the URD does not exist.}} [[#Notes|*]]
*[[Repository.URD.GetURD|GetURD]] {{APIComment|Returns the URD with the provided ID. Returns nothing if the URD does not exist.}} [[#Notes|*]]


''' Variable '''
===Variable===
*[[Repository.Variable.GetAllVariables|GetAllVariables]] {{APIComment|{{Template:Repository.GetAllVariables.Cmt}}}}
*[[Repository.Variable.GetAllVariables|GetAllVariables]] {{APIComment|{{Template:Repository.GetAllVariables.Cmt}}}}
*[[Repository.Variable.AddVariable|AddVariable]] {{APIComment|{{Template:Repository.AddVariable.Cmt}}}}
*[[Repository.Variable.AddVariable|AddVariable]] {{APIComment|{{Template:Repository.AddVariable.Cmt}}}}
Line 40: Line 44:
*[[Repository.Variable.GetVariable|GetVariable]] {{APIComment|Returns variable with the provided ID. Returns nothing if the variable doesn't exist.}} [[#Notes|*]]
*[[Repository.Variable.GetVariable|GetVariable]] {{APIComment|Returns variable with the provided ID. Returns nothing if the variable doesn't exist.}} [[#Notes|*]]


''' Task '''
===Task===
*[[Repository.Task.GetAllCorrectiveTasks|GetAllCorrectiveTasks]] {{APIComment|{{Template:Repository.GetAllCorrectiveTasks.Cmt}}}}
*[[Repository.Task.GetAllCorrectiveTasks|GetAllCorrectiveTasks]] {{APIComment|{{Template:Repository.GetAllCorrectiveTasks.Cmt}}}}
*[[Repository.Task.AddCorrectiveTask|AddCorrectiveTask]] {{APIComment|{{Template:Repository.AddCorrectiveTask.Cmt}}}}
*[[Repository.Task.AddCorrectiveTask|AddCorrectiveTask]] {{APIComment|{{Template:Repository.AddCorrectiveTask.Cmt}}}}
Line 51: Line 55:
*[[Repository.Task.GetAllTaskTypes|GetAllTaskTypes]] {{APIComment|{{Template:Repository.GetAllTaskTypes.Cmt}}}}
*[[Repository.Task.GetAllTaskTypes|GetAllTaskTypes]] {{APIComment|{{Template:Repository.GetAllTaskTypes.Cmt}}}}


''' Crew '''
===Crew===
*[[Repository.Crew.GetAllCrews|GetAllCrews]] {{APIComment|{{Template:Repository.GetAllCrews.Cmt}}}}
*[[Repository.Crew.GetAllCrews|GetAllCrews]] {{APIComment|{{Template:Repository.GetAllCrews.Cmt}}}}
*[[Repository.Crew.AddCrew|AddCrew]] {{APIComment|{{Template:Repository.AddCrew.Cmt}}}}
*[[Repository.Crew.AddCrew|AddCrew]] {{APIComment|{{Template:Repository.AddCrew.Cmt}}}}
Line 57: Line 61:
*[[Repository.Crew.GetCrew|GetCrew]] {{APIComment|Returns crew with the provided ID. Returns nothing if the crew doesn't exist.}} [[#Notes|*]]
*[[Repository.Crew.GetCrew|GetCrew]] {{APIComment|Returns crew with the provided ID. Returns nothing if the crew doesn't exist.}} [[#Notes|*]]


''' Pool '''
===Pool===
*[[Repository.Pool.GetAllPools|GetAllPools]] {{APIComment|{{Template:Repository.GetAllPools.Cmt}}}}
*[[Repository.Pool.GetAllPools|GetAllPools]] {{APIComment|{{Template:Repository.GetAllPools.Cmt}}}}
*[[Repository.Pool.AddPool|AddPool]] {{APIComment|{{Template:Repository.AddPool.Cmt}}}}
*[[Repository.Pool.AddPool|AddPool]] {{APIComment|{{Template:Repository.AddPool.Cmt}}}}
Line 63: Line 67:
*[[Repository.Pool.GetPool|GetPool]] {{APIComment|Returns pool with the provided ID. Returns nothing if the pool doesn't exist.}} [[#Notes|*]]
*[[Repository.Pool.GetPool|GetPool]] {{APIComment|Returns pool with the provided ID. Returns nothing if the pool doesn't exist.}} [[#Notes|*]]


''' Action '''
===Action===
*[[Repository.Action.GetAllActionsDictionary|GetAllActionsDictionary]] {{APIComment|Returns a dictionary of all actions in the current project.}} [[#Notes|*]]
*[[Repository.Action.GetAllActionsDictionary|GetAllActionsDictionary]] {{APIComment|Returns a dictionary of all actions in the current project.}} [[#Notes|*]]
*[[Repository.Action.GetAllActions|GetAllActions]] {{APIComment|{{Template:Repository.GetAllActions.Cmt}}}}
*[[Repository.Action.GetAllActions|GetAllActions]] {{APIComment|{{Template:Repository.GetAllActions.Cmt}}}}
Line 70: Line 74:
*[[Repository.Action.GetAction|GetAction]] {{APIComment|Returns action with the provided ID. Returns nothing if the action doesn't exist.}} [[#Notes|*]]
*[[Repository.Action.GetAction|GetAction]] {{APIComment|Returns action with the provided ID. Returns nothing if the action doesn't exist.}} [[#Notes|*]]


''' Control '''
===Control===
*[[Repository.Control.GetAllXfmeaControlsDictionary|GetAllXfmeaControlsDictionary]]{{APIComment|Returns a dictionary of all Xfmea controls in the current project.}} [[#Notes|*]]
*[[Repository.Control.GetAllXfmeaControlsDictionary|GetAllXfmeaControlsDictionary]]{{APIComment|Returns a dictionary of all Xfmea controls in the current project.}} [[#Notes|*]]
*[[Repository.Control.GetAllXfmeaControls|GetAllXfmeaControls]]{{APIComment|Returns an array of all Xfmea controls in the current project.}} [[#Notes|*]]
*[[Repository.Control.GetAllXfmeaControls|GetAllXfmeaControls]]{{APIComment|Returns an array of all Xfmea controls in the current project.}} [[#Notes|*]]
Line 77: Line 81:
*[[Repository.Control.GetXfmeaControl|GetXfmeaControl]] {{APIComment|Returns XfmeaControl with the provided ID.}} [[#Notes|*]]
*[[Repository.Control.GetXfmeaControl|GetXfmeaControl]] {{APIComment|Returns XfmeaControl with the provided ID.}} [[#Notes|*]]


''' BlockSim '''
===BlockSim===
*[[Repository.BlockSim.ImportBlockSimXMLFile|ImportBlockSimXMLFile]] {{APIComment|{{Template:Repository.ImportBlockSimXMLFile.Cmt}}}}
*[[Repository.BlockSim.ImportBlockSimXMLFile|ImportBlockSimXMLFile]] {{APIComment|{{Template:Repository.ImportBlockSimXMLFile.Cmt}}}}
*[[Repository.BlockSim.ExportBlockSimXMLFile|ExportBlockSimXMLFile]] {{APIComment|{{Template:Repository.ExportBlockSimXMLFile.Cmt}}}}
*[[Repository.BlockSim.ExportBlockSimXMLFile|ExportBlockSimXMLFile]] {{APIComment|{{Template:Repository.ExportBlockSimXMLFile.Cmt}}}}


'''DataWarehouse'''
===Synthesis Data Warehouse===
*[[Repository.DataWarehouse.SaveRawDataSet|SaveRawDataSet]] {{APIComment|{{Template:Repository.SaveRawDataSet.Cmt}}}}
*[[Repository.DataWarehouse.SaveRawDataSet|SaveRawDataSet]] {{APIComment|{{Template:Repository.SaveRawDataSet.Cmt}}}}


''' XFRACAS '''
===XFRACAS===
*[[Repository.XFRACAS.GetAllXFRACASEntities|GetAllXFRACASEntities]] {{APIComment|{{Template:Repository.GetAllXFRACASEntities.Cmt}}}}
*[[Repository.XFRACAS.GetAllXFRACASEntities|GetAllXFRACASEntities]] {{APIComment|{{Template:Repository.GetAllXFRACASEntities.Cmt}}}}
*[[Repository.XFRACAS.ImportXFRACASXML|ImportXFRACASXML]] {{APIComment|{{Template:Repository.ImportXFRACASXML.Cmt}}}}
*[[Repository.XFRACAS.ImportXFRACASXML|ImportXFRACASXML]] {{APIComment|{{Template:Repository.ImportXFRACASXML.Cmt}}}}
Line 98: Line 102:
*[[Repository.XFRACAS.AddSystemMetric3|AddSystemMetric3]] {{APIComment|This can be used to insert reported run hours, number of starts, kw run hours, and the date.}} [[#Notes|*]]
*[[Repository.XFRACAS.AddSystemMetric3|AddSystemMetric3]] {{APIComment|This can be used to insert reported run hours, number of starts, kw run hours, and the date.}} [[#Notes|*]]


''' Xfmea '''
===Xfmea===
*[[Repository.Xmea.GetAllItemsInSystemHierarchyDictionary Method|GetAllItemsInSystemHierarchyDictionary]] {{APIComment|Returns the system hierarchy in the current project in the form of the dictionary.}} [[#Notes|*]]
*[[Repository.Xmea.GetAllItemsInSystemHierarchyDictionary Method|GetAllItemsInSystemHierarchyDictionary]] {{APIComment|Returns the system hierarchy in the current project in the form of the dictionary.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllItemsInSystemHierarchy Method|GetAllItemsInSystemHierarchy]] {{APIComment|Returns the system hierarchy in the current project in the form of the array containing classes holding the item properties.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllItemsInSystemHierarchy Method|GetAllItemsInSystemHierarchy]] {{APIComment|Returns the system hierarchy in the current project in the form of the array containing classes holding the item properties.}} [[#Notes|*]]

Revision as of 23:32, 20 July 2015

Template:InProgress

APIWiki.png


Member of: SynthesisAPI9, 10


Represents a Synthesis repository. Use the methods in the Repository group to establish a connection to the Synthesis repository. Once you have a connection, you can use the rest of the methods and properties in this class to read and write data to the repository.

See Example at the bottom of this page. Also see the important note for version 9 users.

Methods

Repository

Project

  • GetAllProjects Returns an array containing all project names and their IDs from the current repository.
  • GetCurrentProject Returns the name and ID of the current project.
  • SetCurrentProject Opens (sets as current) a project with the specified ID.

Unit

  • GetAllUnits Returns an array containing all units of measurement from the current repository.

Model

  • GetAllModelsInfo Returns an array containing all model names and their IDs from the current project.
  • GetAllModels Returns an array containing all models from the current project.
  • AddModel Saves a new model in the repository.
  • UpdateModel Updates the model in the repository.
  • GetModel Returns the model from the current project with the specified ID. Returns nothing if the model does not exist or is not in the current project. *
  • IsModelUsed Checks if the model is currently in use by other items. *
  • DeleteModel Checks if the model is not in use and deletes the model. Returns true if success, false otherwise. Throws an exception if the model is in use. *

URD

  • GetAllURDs Returns an array containing all URDs from the current project.
  • AddURD Saves a new URD in the repository.
  • UpdateURD Updates the URD in the repository.
  • GetURD Returns the URD with the provided ID. Returns nothing if the URD does not exist. *

Variable

  • GetAllVariables Returns an array containing all variables in the current project.
  • AddVariable Saves a new variable in the repository.
  • UpdateVariable Updates the variable in the repository.
  • GetVariable Returns variable with the provided ID. Returns nothing if the variable doesn't exist. *

Task

Crew

  • GetAllCrews Returns an array containing all crews from the current project.
  • AddCrew Saves the crew in the repository.
  • UpdateCrew Updates the crew in the repository.
  • GetCrew Returns crew with the provided ID. Returns nothing if the crew doesn't exist. *

Pool

  • GetAllPools Returns an array containing all spare parts pools from the current project.
  • AddPool Saves the spare parts pool in the repository.
  • UpdatePool Updates the spare parts pool in the repository.
  • GetPool Returns pool with the provided ID. Returns nothing if the pool doesn't exist. *

Action

  • GetAllActionsDictionary Returns a dictionary of all actions in the current project. *
  • GetAllActions Returns an array containing all actions from the current project.
  • AddAction Saves the action in the repository.
  • UpdateAction Updates the action in the repository.
  • GetAction Returns action with the provided ID. Returns nothing if the action doesn't exist. *

Control

BlockSim

  • ImportBlockSimXMLFile Imports from an XML file to the current project.
  • ExportBlockSimXMLFile Creates a new BlockSim XML file and exports items from the current project. If the XML file already exists it will be overridden.

Synthesis Data Warehouse

XFRACAS

Xfmea

Usage Example

In this usage example, the API is used to connect to a repository, retrieve one of the models in it and then calculate the reliability at a specified time, based on that model.

 'Declare a new repository connection object. 
 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.rsr10")
 
 'Get a list of the names/IDs of projects in the connected repository. 
 Dim ListOfProjects() As NameIdPair
 ListOfProjects = MyRepository.Project.GetAllProjects()
 
 'Open the first project in the list. 
 MyRepository.Project.SetCurrentProject(ListOfProjects(0).ID)
 
 'Get a list of the names/IDs of models in the current project. 
 Dim ListOfModels() As NameIdPair
 ListOfModels = MyRepository.Model.GetAllModelsInfo()
 
 'Retrieve the first model in the list. 
 Dim AModel As cModel
 AModel = MyRepository.Model.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()

Notes

  • Important: If you have upgraded from version 9 and have existing code written using Synthesis API version 9, you should modify your code. In version 9, all methods existed in the Repository class, in version 10 they were moved in sections, according to the object type they apply to. For instance, Repository.GetAllModels is now Repository.Model.GetAllModels; Repository.ImportBlockSimXMLFile is now Repository.BlockSim.ImportBlockSimXMLFile etc. The old methods still exist so your code is not broken, but all old methods are deprecated and may be removed in the future releases.