Repository Class: Difference between revisions
Jump to navigation
Jump to search
John Leavitt (talk | contribs) |
Alex Ulanov (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
== Constructors == | == Constructors == | ||
* | *New() {{APIComment|Creates a new Repository object for connecting to Synthesis repositories.}} | ||
== Methods == | == Methods == |
Revision as of 19:45, 28 April 2015
Constructors
- New() Creates a new Repository object for connecting to Synthesis repositories.
Methods
Connect to / Disconnect from Repository
- ConnectToRepository( String ) Connects to any local repository (MS Access, MS SQL or Oracle).
- ConnectToAccessRepository( String ) Connects to an MS Access repository.
- ConnectToSQLRepository( String, String, [Boolean], [String], [String], [String] ) Connects to an MS SQL repository.
- ConnectToOracleRepository( Integer ,String, String, String, String ) Connects to an Oracle repository.
- DisconnectFromRepository Disconnects from the current 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( Integer ) Opens (sets as current) a project with the specified ID.
Units of Measurement
- GetAllUnits Returns an array containing all units of measurement from the current repository.
Models
- GetAllModelsInfo Returns an array containing all model names and their IDs from the current project.
- GetModel( Integer ) 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.
- GetAllModels Returns an array containing all models from the current project.
- AddModel( cModel ) Saves a new model in the repository.
- UpdateModel( cModel ) Updates the model in the repository.
- DeleteModel(Integer) 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.
- IsModelUsed(Integer) Version 10 Only- Checks if the model is currently in use by other items.
URDs
- GetAllURDs Returns an array containing all URDs from the current project.
- GetURD (cURD) Version 10 Only- Returns URD(s) with the provided ID. Returns nothing if the URD(s) does/do not exist.
- AddURD( cURD ) Saves a new URD in the repository.
- UpdateURD( cURD ) Updates the URD in the repository.
Variables
- GetAllVariables Returns an array containing all variables in the current project.
- AddVariable( cVariable ) Saves a new variable in the repository.
- UpdateVariable( cVariable ) Updates the variable in the repository.
- GetVariable( cVariable ) Version 10 Only- Returns variable with the provided ID. Returns nothing if the variable doesn't exist.
Corrective Tasks
- GetAllCorrectiveTasks Returns an array containing all corrective tasks from the current project.
- AddCorrectiveTask( cCorrectiveTask ) Saves the corrective task in the repository.
- UpdateCorrectiveTask( cCorrectiveTask ) Updates the corrective task in the repository.
- GetCorrectiveTask Version 10 Only - Returns corrective task with the provided ID. Returns nothing if the task doesn't exist.
Scheduled Tasks
- GetAllScheduledTasks Returns an array containing all scheduled tasks from the current project.
- AddScheduledTask(cScheduledTask) Saves the scheduled task in the repository.
- UpdateCorrectiveTask(cScheduledTask) Updates the scheduled task in the repository.
- GetScheduledTask(cScheduledTask) Version 10 Only - Returns scheduled task with the provided ID. Returns nothing if the task doesn't exist.
Task Types
- GetAllTaskTypes Retuns an array containing all task types in the repository.
Crews
- GetAllCrews Returns an array containing all crews from the current project.
- AddCrew(cCrew) Saves the crew in the repository.
- UpdateCrew( cCrew ) Updates the crew in the repository.
- GetCrew(cCrew) Version 10 Only - Returns crew with the provided ID. Returns nothing if the crew doesn't exist.
Pools
- GetAllPools Returns an array containing all spare parts pools from the current project.
- AddPool(cPool) Saves the spare parts pool in the repository.
- UpdatePool(cPool) Updates the spare parts pool in the repository.
- GetPool (cPool) Version 10 Only - Returns pool with the provided ID. Returns nothing if the pool doesn't exist.
Action
- GetAllActions Returns an array containing all actions from the current project.
- AddAction(cAction) Saves the action in the repository.
- UpdateAction(cAction) Updates the action in the repository.
- GetAction(cAction) Version 10 Only - Returns action with the provided ID. Returns nothing if the action doesn't exist.
BlockSim
- ImportBlockSimXMLFile(String) Imports from an XML file to the current project.
- ExportBlockSimXMLFile(String) Creates a new BlockSim XML file and exports items from the current project. If the XML file already exists it will be overridden.
Reliability Data Warehouse (RDW)
XFRACAS
- GetAllXFRACASEntities
- ImportXFRACASXML( Integer, XFRACASImportType, Byte(), String, String ) Uploads an import file byte stream for processing and returns the system ID of the uploaded byte array.
- ImportXFRACASXMLFile( Integer, XFRACASImportType, String, String ) Uploads an import file for processing and returns the system ID of the uploaded XML file.
- ImportXFRACASXMLString(( Integer, XFRACASImportType, String, String, String ) Uploads an import file string for processing and returns the system ID of the uploaded XML string.
- SerializeXMLObjectToByteArray( Byte, Object ) A helper function to create an array of bytes from a serializable XML object.
- ProcessXfracasImports Runs the import process.
- WriteToDiagnosticsLog(string, XFRACASDiagnosticEntryType) Writes a message to the diagnostics log
- WriteToDiagnosticsLog(System.Exception, XFRACASDiagnosticEntryType, String) Writes exception information to the diagnostics log
- XFRACASCommandTimeout(Integer) Version 10 Only- Gets or sets the wait time before terminating the attempt to execute an XFRACAS command.
- AddSystemMetric1(Integer, Double, Date) Version 10 Only - This can be used to insert reported run hours and the date of the reported run hours.
- AddSystemMetric2(Integer, Double, Double, Date) Version 10 Only - This can be used to insert reported run hours, number of starts, and the date.
- AddSystemMetric3(Integer, Double, Double, Double, Date) Version 10 Only - This can be used to insert reported run hours, number of starts, kw run hours, and the date.
Properties
Synthesis Setup Option
- EnforceRENOCompliance (as boolean) Disallows spaces and special characters in names of models and analysis workbooks. This will ensure that all models and analysis workbooks can be used in RENO equations.
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()