Greet 2014
Documentation for the GREET 2014 API
 All Classes Namespaces Functions Variables Enumerations Properties Events
Greet.Model.ModelControler Class Reference
Inheritance diagram for Greet.Model.ModelControler:
Greet.Model.Interfaces.IGREETController

Public Member Functions

void Compress (Stream inp, Stream outp)
 Uses an input stream and compresses it using deflate More...
 
void Decompress (Stream inp, Stream outp)
 Uses an input stream and decompresses it More...
 
string DownloadDatabaseFromServer (int revNumber=0)
 Orders the software to download a specific version of the database from the webservice More...
 
void ExportResultsToXml (string fileName)
 Export the calculated results in an xml file More...
 
string FormatValue (double valueSIUnit, string SIUnitOrGroup, int format=-1, bool scaleIfSelected=true, int scientificFigures=4)
 Formats a value according to the options chosen by the user in the main form More...
 
string GetDefaultFolder ()
 Get the default folder used by GREET to store data, by default the MyDocument/Greet folder More...
 
int GetModelYear ()
 Returns the current modeling year chosen by the user More...
 
Dictionary< int, string > GetResourcesGroups ()
 This methods access the resource groups available in the loaded database and returns a dictionary containing their unique IDs and their Names. More...
 
Dictionary< string, IResultsGetVehicleResults (GData data, int simulationRun, int vehicleID)
 Get a dictionary representing the vehicle results, the key may be "wtw", "wtp" or "ptw" the values represents the results associated with each items More...
 
IResults GetVehicleResults (IData data, int vehicleID)
 Get a dictionary representing the vehicle results, the key may be "wtw", "wtp" or "ptw" the values represents the results associated with each items More...
 
void LoadPlugIns ()
 
IProject LoadProjectFile (string filename)
 
delegate void NewProjectLoaded (string fileName)
 
void OpenProject (string fileName, bool rememberLastDatabase)
 Orders the main GUI to open a specific file as the current project Warning this will simply discard the currently loaded data and all changes that are not saved to a real file When the new file is loaded into the main form, the onDatabaseLoaded method will be called for all plugins More...
 
void RunSimalation (bool testMinMaxMonitor)
 Starts the simulations and waits it to be done before returning More...
 
void RunSimalationAsync ()
 Starts asynchronously the simulations More...
 
string SaveProject (IProject project, string fileName)
 Saves the given project to a file More...
 
void TellFinalize ()
 Called when GREET main routine ends, triggers an event for all the plugin in order to warn them to finalize. This is the last call before everything gets unallocated from the memory More...
 
void TellMainFormClosing ()
 Called when GREET main form is getting closed. After that we'll check if the data has been changed and prompt the user to save the file More...
 

Public Attributes

NewProjectLoaded NewProjectLoadedEvent
 
GData.ReadingXMLFilesInProgressEvent ReadingDataInProgressEvent
 

Properties

IProject CurrentProject [get]
 Returns the project currently in use in GREET More...
 
Dictionary< string, IQuantityUnitGroupsAvailable [get]
 
Dictionary< string, IUnitUnitsAvailable [get]
 
- Properties inherited from Greet.Model.Interfaces.IGREETController
IProject CurrentProject [get]
 Returns the project currently in use More...
 
Dictionary< string, IQuantityUnitGroupsAvailable [get]
 Returns a dictionary with unit groups available in GREET More...
 
Dictionary< string, IUnitUnitsAvailable [get]
 Returns a dictionary with units available in GREET More...
 

Events

EventHandler CalculationsFinished
 
- Events inherited from Greet.Model.Interfaces.IGREETController
EventHandler CalculationFinished
 When the calculations are done, this event fires up to warn any plugin that we are going to have some results available now. More...
 

Member Function Documentation

void Greet.Model.ModelControler.Compress ( Stream  inp,
Stream  outp 
)

Uses an input stream and compresses it using deflate

Parameters
inpNot compressed stream
outpCompressed stream

Implements Greet.Model.Interfaces.IGREETController.

void Greet.Model.ModelControler.Decompress ( Stream  inp,
Stream  outp 
)

Uses an input stream and decompresses it

Parameters
inpCompressed input stream to be compressed
outpDecompressed stream using deflate

Implements Greet.Model.Interfaces.IGREETController.

string Greet.Model.ModelControler.DownloadDatabaseFromServer ( int  revNumber = 0)

Orders the software to download a specific version of the database from the webservice

Parameters
revNumber
Returns

Implements Greet.Model.Interfaces.IGREETController.

void Greet.Model.ModelControler.ExportResultsToXml ( string  fileName)

Export the calculated results in an xml file

Parameters
fileNameFull path for the XML file to be written
string Greet.Model.ModelControler.FormatValue ( double  valueSIUnit,
string  SIUnitOrGroup,
int  format = -1,
bool  scaleIfSelected = true,
int  scientificFigures = 4 
)

Formats a value according to the options chosen by the user in the main form

Parameters
valueSIUnitThe numerical value to be formated
SIUnitOrGroupThe unit or unit group in which this value is represented
formatFormat: -1 GUI user preference, 0 unit specific, 1 scientific notation, 2 all digits
scaleIfSelectedIf format is different than -1, scaling is selected in the options the method will use prefixes like k for kilo, M for mega...
scientificFiguresIf format is 1, then this parameter set how many digits are displayed for scientific notation
Returns
Formatted value according to the desired format option

Implements Greet.Model.Interfaces.IGREETController.

string Greet.Model.ModelControler.GetDefaultFolder ( )

Get the default folder used by GREET to store data, by default the MyDocument/Greet folder

Returns

Implements Greet.Model.Interfaces.IGREETController.

int Greet.Model.ModelControler.GetModelYear ( )

Returns the current modeling year chosen by the user

Returns

Implements Greet.Model.Interfaces.IGREETController.

Dictionary<int, string> Greet.Model.ModelControler.GetResourcesGroups ( )

This methods access the resource groups available in the loaded database and returns a dictionary containing their unique IDs and their Names.

Returns
IDs and Names of the resources groups
Dictionary<string, IResults> Greet.Model.ModelControler.GetVehicleResults ( GData  data,
int  simulationRun,
int  vehicleID 
)

Get a dictionary representing the vehicle results, the key may be "wtw", "wtp" or "ptw" the values represents the results associated with each items

Parameters
vehicleIDThe desired vehicle ID
Returns
A dictionary containing the results or null if either no results are available or if the vehicle ID does not exists in the database
IResults Greet.Model.ModelControler.GetVehicleResults ( IData  data,
int  vehicleID 
)

Get a dictionary representing the vehicle results, the key may be "wtw", "wtp" or "ptw" the values represents the results associated with each items

Parameters
vehicleIDThe desired vehicle ID
Returns
A dictionary containing the results or null if either no results are available or if the vehicle ID does not exists in the database
IProject Greet.Model.ModelControler.LoadProjectFile ( string  filename)

Load a data file.

If the given file is saved using an old format, it will be converted first, and a backup of the old version will be saved

Parameters
filenameFilename of the datafile to load
Returns
The loaded entities

Implements Greet.Model.Interfaces.IGREETController.

void Greet.Model.ModelControler.OpenProject ( string  fileName,
bool  rememberLastDatabase 
)

Orders the main GUI to open a specific file as the current project Warning this will simply discard the currently loaded data and all changes that are not saved to a real file When the new file is loaded into the main form, the onDatabaseLoaded method will be called for all plugins

Parameters
fileNameFull file path + name for the database to be opened
rememberLastDatabaseIf set to true, next time GREET opens this file will be loaded automatically

Implements Greet.Model.Interfaces.IGREETController.

void Greet.Model.ModelControler.RunSimalation ( bool  testMinMaxMonitor)

Starts the simulations and waits it to be done before returning

Implements Greet.Model.Interfaces.IGREETController.

void Greet.Model.ModelControler.RunSimalationAsync ( )

Starts asynchronously the simulations

Implements Greet.Model.Interfaces.IGREETController.

string Greet.Model.ModelControler.SaveProject ( IProject  project,
string  fileName 
)

Saves the given project to a file

Parameters
projectThe project to save, can be the current project
fileNameFilename to be used to create the data file
Returns

Implements Greet.Model.Interfaces.IGREETController.

void Greet.Model.ModelControler.TellFinalize ( )

Called when GREET main routine ends, triggers an event for all the plugin in order to warn them to finalize. This is the last call before everything gets unallocated from the memory

void Greet.Model.ModelControler.TellMainFormClosing ( )

Called when GREET main form is getting closed. After that we'll check if the data has been changed and prompt the user to save the file

Property Documentation

IProject Greet.Model.ModelControler.CurrentProject
get

Returns the project currently in use in GREET


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