Repository Class
Jump to navigation
Jump to search
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
- ConnectToRepository Connects to any local repository (MS Access, MS SQL or Oracle).
- ConnectToAccessRepository Connects to an MS Access repository.
- ConnectToSQLRepository Connects to an MS SQL repository.
- ConnectToOracleRepository Connects to an Oracle repository.
- DisconnectFromRepository Disconnects from the current repository.
- EnforceRENOCompliance Disallows spaces and special characters in names of models. This will ensure that all models can be used in RENO equations.
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
- GetAllCorrectiveTasks Returns an array containing all corrective tasks from the current project.
- AddCorrectiveTask Saves the corrective task in the repository.
- UpdateCorrectiveTask Updates the corrective task in the repository.
- GetCorrectiveTask Returns corrective task with the provided ID. Returns nothing if the task doesn't exist. *
- GetAllScheduledTasks Returns an array containing all scheduled tasks from the current project.
- AddScheduledTask Saves the scheduled task in the repository.
- UpdateScheduledTask Updates the scheduled task in the repository.
- GetScheduledTask Returns scheduled task with the provided ID. Returns nothing if the task doesn't exist. *
- GetAllTaskTypes Retuns an array containing all task types in the repository.
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
- GetAllXfmeaControlsDictionary Returns a dictionary of all Xfmea controls in the current project. *
- GetAllXfmeaControls Returns an array of all Xfmea controls in the current project. *
- AddXfmeaControl Adds a new XfmeaControl in the repository. *
- UpdateXfmeaControl Updates XfmeaControl in the repository. *
- GetXfmeaControl Returns XfmeaControl with the provided ID. *
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
- GetAllXFRACASEntities
- ImportXFRACASXML Uploads an import file byte stream for processing and returns the system ID of the uploaded byte array.
- ImportXFRACASXMLFile Uploads an import file for processing and returns the system ID of the uploaded XML file.
- ImportXFRACASXMLString Uploads an import file string for processing and returns the system ID of the uploaded XML string.
- SerializeXMLObjectToByteArray A helper function to create an array of bytes from a serializable XML object.
- ProcessXfracasImports Runs the import process.
- WriteMessageToDiagnosticsLog Writes a message to the diagnostics log
- WriteExceptionToDiagnosticsLog Writes exception information to the diagnostics log
- XFRACASCommandTimeout Gets or sets the wait time before terminating the attempt to execute an XFRACAS command. *
- AddSystemMetric1 This can be used to insert reported run hours and the date of the reported run hours. *
- AddSystemMetric2 This can be used to insert reported run hours, number of starts, and the date. *
- AddSystemMetric3 This can be used to insert reported run hours, number of starts, kw run hours, and the date. *
Xfmea
- GetAllItemsInSystemHierarchyDictionary Returns the system hierarchy in the current project in the form of the dictionary. *
- GetAllItemsInSystemHierarchy Returns the system hierarchy in the current project in the form of the array containing classes holding the item properties. *
- AddItemToSystemHierarchy Adds the item in the system hierarchy in the current project. *
- UpdateItemInSystemHierarchy Updates the item in the system hierarchy in the current project. *
- GetAllXfmeaFunctionsDictionary Returns a dictionary containing all XfmeaFunctions that belong to the item. The keys are the IDs of the XfmeaFunctions. *
- GetAllXfmeaFunctions Returns an array containing all XfmeaFunctions that belong to the item. *
- GetXfmeaFunction Returns XfmeaFunction with the provided ID. *
- AddXfmeaFunction Adds a new XfmeaFunction in the repository. *
- UpdateXfmeaFunction Updates the XfmeaFunction in the repository. *
- GetAllXfmeaFailuresDictionary Returns a dictionary containing all XfmeaFailures that belong to the function. The keys are the IDs of the XfmeaFailures. *
- GetAllXfmeaFailures Returns an array containing all XfmeaFailures that belong to the function. *
- GetXfmeaFailure Returns XfmeaFailure with the provided ID. *
- AddXfmeaFailure Adds a new XfmeaFailure in the repository. *
- UpdateXfmeaFailure Updates the XfmeaFailure in the repository. *
- GetAllXfmeaEffectsDictionary Returns a dictionary containing all XfmeaEffects that belong to the failure. The keys are the IDs of the XfmeaEffects. *
- GetAllXfmeaEffects Returns an array containing all XfmeaEffects that belong to the failure. *
- GetXfmeaEffect Returns XfmeaEffect with the provided ID. *
- AddXfmeaEffect Adds a new XfmeaEffect in the repository. *
- UpdateXfmeaEffect Updates the XfmeaEffect in the repository. *
- GetAllXfmeaCausesDictionary Returns a dictionary containing all XfmeaCauses that belong to the failure. The keys are the IDs of the XfmeaCauses. *
- GetAllXfmeaCauses Returns an array containing all XfmeaCauses that belong to the failure. *
- GetXfmeaCause Returns XfmeaCause with the provided ID. *
- AddXfmeaCause Adds a new XfmeaCause in the repository. *
- UpdateXfmeaCause Updates the XfmeaCause in the repository. *
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.