.NET Interface to CHEMCAD  1.1.11
CCAPI.ServerImpl Class Reference

Entry object for using CHEMCAD as a COM server More...

+ Inheritance diagram for CCAPI.ServerImpl:

Public Member Functions

 ServerImpl (string licenseKey)
 Initialize a Server, load the configuration and validates the license. More...
 
void Dispose (bool disposing)
 Realease chemcad server and deactivete license. More...
 
Flowsheet LoadFlowsheet (string path)
 Opens a flowsheet from a user defined path and allows access to this flowsheet. Table of errors thrown:

Code Error
100 No license found.
200 File not found.
201 The file exists, but cannot be loaded.
202 CHEMCAD cannot write to the temp directory.
203 Another user opened the simulation.
204 The simulation is already open.
205 The simulation ZIP file is corrupted.
More...
 
void CloseSimulation ()
 
void Run ()
 Executes the simulation. More...
 
void Save ()
 Saves this flowsheet to file. More...
 
void Pause ()
 Pause simulation. More...
 
void RunOptimization ()
 Run optimization. More...
 
void RunOptimizationFile (string path)
 Run optimization from specified file. More...
 
OptimizationVariables GetOptimizationVariables (string path)
 Run all units in a steady state simulation. More...
 
void SetOptimizationVaraibles (string filePath, OptimizationVariables optimizationVariables)
 Set Optimization variables in the file. More...
 
void RunDataReconciliation ()
 Run Data reconciliation and parameter estimation. More...
 
void RunAllUnits ()
 Run all units in a steady state simulation. More...
 
void RunSelectedUnits (params UnitOperation[] unitOps)
 Run selected units in a steady state simulation. Select Units More...
 
void RunNamedSequence (string name)
 Run a namend sequence in a steady state simulation. More...
 
void RunAllSteps ()
 Run all steps in a dynamic simulation. More...
 
void RunStep ()
 Run one step in a dynamic simulation. More...
 
void RestoreToInitialState ()
 Restore dynamic simulation to initial state. More...
 
void SetCurrentAsInitialState ()
 Sets the current state as the initial state. More...
 
void TakeSnapshot (string name)
 Take snapshot of the current simulation state. More...
 
void LoadSnapshot (string name)
 Load snapshot of simulation state. More...
 
string GetJobAt (short jobIndex)
 Gets the job at specified index. More...
 
short GetNumberOfCasesInJob (string jobpath)
 Gets the number of cases in the job. More...
 
string GetCaseAt (string jobPath, short caseIndex)
 Gets the case from the job at specified number More...
 

Protected Member Functions

void ExecuteAndLogUsage (string command, Action action)
 
void LogUsage (string command, string message, TimeSpan duration, Exception ex=null)
 
string Sha1Hash (string input)
 

Properties

override Flowsheet CurrentFlowsheet [get]
 The flowsheet that is currently loaded More...
 
string RuntimeMessages [get]
 Returns the runtime messages of CHEMCAD. More...
 
float TimeInMinute [get]
 Returns the time of a dynamic simulation in minutes. More...
 
float TimeStepInMinute [get]
 Returns the time step of a dynamic simulation in minutes. More...
 
float TimeScale [get, set]
 Time scale used for operator training system. More...
 
new int Version [get]
 Returns the current version of CHEMCAD. More...
 
string WorkingDirectory [get, set]
 Gets the working directory used by CHEMCAD. More...
 
short GetNumberOfJobsInWorkDirectory [get]
 Gets the number of jobs in the working directory. More...
 
int PId [get]
 
- Properties inherited from CCAPI.Chemcad
abstract Flowsheet CurrentFlowsheet [get]
 The currently opened flowsheet. More...
 
int Version [get]
 Returns the current version of CHEMCAD. More...
 
- Properties inherited from CCAPI.IServer
int PId [get]
 
Flowsheet CurrentFlowsheet [get]
 
string RuntimeMessages [get]
 
float TimeInMinute [get]
 
float TimeStepInMinute [get]
 
float TimeScale [get, set]
 
int Version [get]
 
string WorkingDirectory [get, set]
 

Detailed Description

Entry object for using CHEMCAD as a COM server

Constructor & Destructor Documentation

◆ ServerImpl()

CCAPI.ServerImpl.ServerImpl ( string  licenseKey)

Initialize a Server, load the configuration and validates the license.

Exceptions
LicenseExceptionCode 1010. Thrown if a license was deactivated

Member Function Documentation

◆ Dispose()

void CCAPI.ServerImpl.Dispose ( bool  disposing)

Realease chemcad server and deactivete license.

Parameters
disposingDispose any managed objects

◆ GetCaseAt()

string CCAPI.ServerImpl.GetCaseAt ( string  jobPath,
short  caseIndex 
)

Gets the case from the job at specified number

◆ GetJobAt()

string CCAPI.ServerImpl.GetJobAt ( short  jobIndex)

Gets the job at specified index.

◆ GetNumberOfCasesInJob()

short CCAPI.ServerImpl.GetNumberOfCasesInJob ( string  jobpath)

Gets the number of cases in the job.

◆ GetOptimizationVariables()

OptimizationVariables CCAPI.ServerImpl.GetOptimizationVariables ( string  path)

Run all units in a steady state simulation.

◆ LoadFlowsheet()

Flowsheet CCAPI.ServerImpl.LoadFlowsheet ( string  path)

Opens a flowsheet from a user defined path and allows access to this flowsheet. Table of errors thrown:

Code Error
100 No license found.
200 File not found.
201 The file exists, but cannot be loaded.
202 CHEMCAD cannot write to the temp directory.
203 Another user opened the simulation.
204 The simulation is already open.
205 The simulation ZIP file is corrupted.


Exceptions
ChemcadAndFlowsheetVersionsDoNotMatchExceptionThrown if CHEMCAD and Flowsheet version doesn't match
ChemcadVersionNotSupportedExceptionCode=2002. CHEMCAD version not yet supported.
ChemcadLicenseNotFoundExceptionCode=100. Could not load flowsheet, no CHEMCAD license found.
FlowsheetFileNotFoundExceptionCode=200. Could not load flowsheet, file not found.
FlowsheetFileExistsButCannotBeLoadedExceptionCode=201. Could not load flowsheet, the file exists but cannot be loaded.
ChemcadCannotWriteToTheTempDirectoryExceptionCode=202. Could not load flowsheet, CHEMCAD cannot write to the temp directory.
AnotherUserOpenedTheSimulationExceptionCode=203. Could not load flowsheet, another user opened the simulation.
TheSimulationIsAlreadyOpenExceptionCode=204. Could not load flowsheet, the simulation is already open.
TheSimulationZipFileIsCorruptedCode=205. Could not load flowsheet, the simulation ZIP file is corrupted.
ChemcadExceptionThrown if CHEMCAD response with an unknown error code

Implements CCAPI.IServer.

◆ LoadSnapshot()

void CCAPI.ServerImpl.LoadSnapshot ( string  name)

Load snapshot of simulation state.

Parameters
name

Implements CCAPI.IServer.

◆ Pause()

void CCAPI.ServerImpl.Pause ( )

Pause simulation.

Implements CCAPI.IServer.

◆ RestoreToInitialState()

void CCAPI.ServerImpl.RestoreToInitialState ( )

Restore dynamic simulation to initial state.

Implements CCAPI.IServer.

◆ Run()

void CCAPI.ServerImpl.Run ( )

Executes the simulation.

Exceptions
FlowsheetConvergenceExceptionCode 2010. Thrown if running the job failed

Implements CCAPI.IServer.

◆ RunAllSteps()

void CCAPI.ServerImpl.RunAllSteps ( )

Run all steps in a dynamic simulation.

Exceptions
FlowsheetConvergenceExceptionCode 2020. Thrown if could not run all steps

Implements CCAPI.IServer.

◆ RunAllUnits()

void CCAPI.ServerImpl.RunAllUnits ( )

Run all units in a steady state simulation.

Exceptions
FlowsheetConvergenceExceptionCode 2012. Thrown if running the flowsheet failed
UnitOpRuntimeErrorExceptionCode 2012. Thrown if running the flowsheet failed

Implements CCAPI.IServer.

◆ RunDataReconciliation()

void CCAPI.ServerImpl.RunDataReconciliation ( )

Run Data reconciliation and parameter estimation.

Exceptions
ChemcadExceptionCode 2011. Thrown if could not run optimization

◆ RunNamedSequence()

void CCAPI.ServerImpl.RunNamedSequence ( string  name)

Run a namend sequence in a steady state simulation.

Parameters
name
Exceptions
ChemcadExceptionCode 2014. Thrown if could not run namend sequence

Implements CCAPI.IServer.

◆ RunOptimization()

void CCAPI.ServerImpl.RunOptimization ( )

Run optimization.

Exceptions
ChemcadExceptionCode 2011. Thrown if could not run optimization

Implements CCAPI.IServer.

◆ RunOptimizationFile()

void CCAPI.ServerImpl.RunOptimizationFile ( string  path)

Run optimization from specified file.

Exceptions
ChemcadExceptionCode 2011. Thrown if could not run optimization

◆ RunSelectedUnits()

void CCAPI.ServerImpl.RunSelectedUnits ( params UnitOperation[]  unitOps)

Run selected units in a steady state simulation. Select Units

Parameters
unitOps
Exceptions
ChemcadExceptionCode 2013. Thrown if running the selected units failed

Implements CCAPI.IServer.

◆ RunStep()

void CCAPI.ServerImpl.RunStep ( )

Run one step in a dynamic simulation.

Exceptions
FlowsheetConvergenceExceptionCode 2021. Thrown if could not run step

Implements CCAPI.IServer.

◆ Save()

void CCAPI.ServerImpl.Save ( )

Saves this flowsheet to file.

Returns
Overwrites actual CHEMCAD file.
Exceptions
ChemcadExceptionThrown if saving the flowsheet failed

Implements CCAPI.IServer.

◆ SetCurrentAsInitialState()

void CCAPI.ServerImpl.SetCurrentAsInitialState ( )

Sets the current state as the initial state.

Implements CCAPI.IServer.

◆ SetOptimizationVaraibles()

void CCAPI.ServerImpl.SetOptimizationVaraibles ( string  filePath,
OptimizationVariables  optimizationVariables 
)

Set Optimization variables in the file.

◆ TakeSnapshot()

void CCAPI.ServerImpl.TakeSnapshot ( string  name)

Take snapshot of the current simulation state.

Parameters
name

Implements CCAPI.IServer.

Property Documentation

◆ CurrentFlowsheet

override Flowsheet CCAPI.ServerImpl.CurrentFlowsheet
get

The flowsheet that is currently loaded

◆ GetNumberOfJobsInWorkDirectory

short CCAPI.ServerImpl.GetNumberOfJobsInWorkDirectory
get

Gets the number of jobs in the working directory.

◆ RuntimeMessages

string CCAPI.ServerImpl.RuntimeMessages
get

Returns the runtime messages of CHEMCAD.

◆ TimeInMinute

float CCAPI.ServerImpl.TimeInMinute
get

Returns the time of a dynamic simulation in minutes.

Returns

◆ TimeScale

float CCAPI.ServerImpl.TimeScale
getset

Time scale used for operator training system.

◆ TimeStepInMinute

float CCAPI.ServerImpl.TimeStepInMinute
get

Returns the time step of a dynamic simulation in minutes.

Returns

◆ Version

new int CCAPI.ServerImpl.Version
get

Returns the current version of CHEMCAD.

◆ WorkingDirectory

string CCAPI.ServerImpl.WorkingDirectory
getset

Gets the working directory used by CHEMCAD.


The documentation for this class was generated from the following file: