Repository Class: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 99: Line 99:


===Xfmea===
===Xfmea===
<div style="margin: 20px;">
====System Hierarchy====
*[[Repository.Xfmea.GetAllItemsInSystemHierarchyDictionary Method|GetAllItemsInSystemHierarchyDictionary]] {{APIComment|Returns the system hierarchy in the current project in the form of the dictionary.}} [[#Notes|*]]
*[[Repository.Xfmea.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|*]]
Line 104: Line 106:
*[[Repository.Xfmea.UpdateItemInSystemHierarchy Method|UpdateItemInSystemHierarchy]] {{APIComment|Updates the item in the system hierarchy in the current project.}} [[#Notes|*]]
*[[Repository.Xfmea.UpdateItemInSystemHierarchy Method|UpdateItemInSystemHierarchy]] {{APIComment|Updates the item in the system hierarchy in the current project.}} [[#Notes|*]]


====Functions====
*[[Repository.Xfmea.GetAllXfmeaFunctionsDictionary Method|GetAllXfmeaFunctionsDictionary]] {{APIComment|Returns a dictionary containing all XfmeaFunctions that belong to the item. The keys are the IDs of the XfmeaFunctions.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaFunctionsDictionary Method|GetAllXfmeaFunctionsDictionary]] {{APIComment|Returns a dictionary containing all XfmeaFunctions that belong to the item. The keys are the IDs of the XfmeaFunctions.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaFunctions Method|GetAllXfmeaFunctions]] {{APIComment|Returns an array containing all XfmeaFunctions that belong to the item.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaFunctions Method|GetAllXfmeaFunctions]] {{APIComment|Returns an array containing all XfmeaFunctions that belong to the item.}} [[#Notes|*]]
Line 110: Line 113:
*[[Repository.Xfmea.UpdateXfmeaFunction Method|UpdateXfmeaFunction]] {{APIComment|Updates the XfmeaFunction in the repository.}} [[#Notes|*]]
*[[Repository.Xfmea.UpdateXfmeaFunction Method|UpdateXfmeaFunction]] {{APIComment|Updates the XfmeaFunction in the repository.}} [[#Notes|*]]


====Failures====
*[[Repository.Xfmea.GetAllXfmeaFailuresDictionary Method|GetAllXfmeaFailuresDictionary]] {{APIComment|Returns a dictionary containing all XfmeaFailures that belong to the function. The keys are the IDs of the XfmeaFailures.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaFailuresDictionary Method|GetAllXfmeaFailuresDictionary]] {{APIComment|Returns a dictionary containing all XfmeaFailures that belong to the function. The keys are the IDs of the XfmeaFailures.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaFailures Method|GetAllXfmeaFailures]] {{APIComment|Returns an array containing all XfmeaFailures that belong to the function.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaFailures Method|GetAllXfmeaFailures]] {{APIComment|Returns an array containing all XfmeaFailures that belong to the function.}} [[#Notes|*]]
Line 116: Line 120:
*[[Repository.Xfmea.UpdateXfmeaFailure Method|UpdateXfmeaFailure]] {{APIComment|Updates the XfmeaFailure in the repository.}} [[#Notes|*]]
*[[Repository.Xfmea.UpdateXfmeaFailure Method|UpdateXfmeaFailure]] {{APIComment|Updates the XfmeaFailure in the repository.}} [[#Notes|*]]


====Effects====
*[[Repository.Xfmea.GetAllXfmeaEffectsDictionary Method|GetAllXfmeaEffectsDictionary]] {{APIComment|Returns a dictionary containing all XfmeaEffects that belong to the failure. The keys are the IDs of the XfmeaEffects.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaEffectsDictionary Method|GetAllXfmeaEffectsDictionary]] {{APIComment|Returns a dictionary containing all XfmeaEffects that belong to the failure. The keys are the IDs of the XfmeaEffects.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaEffects Method|GetAllXfmeaEffects]] {{APIComment|Returns an array containing all XfmeaEffects  that belong to the failure.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaEffects Method|GetAllXfmeaEffects]] {{APIComment|Returns an array containing all XfmeaEffects  that belong to the failure.}} [[#Notes|*]]
Line 122: Line 127:
*[[Repository.Xfmea.UpdateXfmeaEffect Method|UpdateXfmeaEffect]] {{APIComment|Updates the XfmeaEffect in the repository.}} [[#Notes|*]]
*[[Repository.Xfmea.UpdateXfmeaEffect Method|UpdateXfmeaEffect]] {{APIComment|Updates the XfmeaEffect in the repository.}} [[#Notes|*]]


====Causes====
*[[Repository.Xfmea.GetAllXfmeaCausesDictionary Method|GetAllXfmeaCausesDictionary]] {{APIComment|Returns a dictionary containing all XfmeaCauses that belong to the failure. The keys are the IDs of the XfmeaCauses.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaCausesDictionary Method|GetAllXfmeaCausesDictionary]] {{APIComment|Returns a dictionary containing all XfmeaCauses that belong to the failure. The keys are the IDs of the XfmeaCauses.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaCauses Method|GetAllXfmeaCauses]] {{APIComment|Returns an array containing all XfmeaCauses  that belong to the failure.}} [[#Notes|*]]
*[[Repository.Xfmea.GetAllXfmeaCauses Method|GetAllXfmeaCauses]] {{APIComment|Returns an array containing all XfmeaCauses  that belong to the failure.}} [[#Notes|*]]
Line 127: Line 133:
*[[Repository.Xfmea.AddXfmeaCause Method|AddXfmeaCause]] {{APIComment|Adds a new XfmeaCause in the repository.}} [[#Notes|*]]
*[[Repository.Xfmea.AddXfmeaCause Method|AddXfmeaCause]] {{APIComment|Adds a new XfmeaCause in the repository.}} [[#Notes|*]]
*[[Repository.Xfmea.UpdateXfmeaCause Method|UpdateXfmeaCause]] {{APIComment|Updates the XfmeaCause in the repository.}} [[#Notes|*]]
*[[Repository.Xfmea.UpdateXfmeaCause Method|UpdateXfmeaCause]] {{APIComment|Updates the XfmeaCause in the repository.}} [[#Notes|*]]
 
</div>


==Properties==
==Properties==

Revision as of 22:01, 21 July 2015

Template:InProgress

APIWiki.png



Represents a Synthesis repository. Use the methods in the Repository group to establish a connection to a 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.

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

System Hierarchy

Functions

Failures

Effects

Causes

Properties

  • EnforceRENOCompliance Disallows spaces and special characters in names of models. This will ensure that all models can be used in RENO equations.


Version Information

Methods and properties marked with an asterisk (*) require Synthesis API Version 10 or greater.

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 into 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 Version 9 methods still exist so your code is not broken, but they are deprecated and may be removed in future versions of the API.

Example

In this example, the API is used to connect to a repository, open the first available project in that repository, and then get the first available model in the project. It then calculates 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()