Script functions - iat-cener/tonatiuh GitHub Wiki
Tonatiuh has de capability to design and run the simulations using the scripting. To use the scripting open the script editor in Automation>Script Editor.
Through the functions that are implemented it is possible to build and simulate optic systems. All these functions are collected herein, they have been sorted based on an functionality and alphabetic order.
-
New(): Opens an empty Tonatiuh scene. -
Open( QString fileName ): Opens thefileNamefile. -
Save(): Saves the current system. -
SaveAs( QString fileName ): Saves the current system intofileName.
-
Copy(): Copies the selected node to the clipboard. -
Copy( QString nodeURL ): Copies the node defined bynodeURLto the clipboard. -
CreateGroupNode(): Creates a separator node as a child of the current selected node. -
CreateComponentNode( QString componentType, QString nodeName, int numberOfParameters, QVector< QVariant > parametersList ): Creates a component structure usingcomponentType. The node that groups the component will be callednodeName. The parameters needed for the component are defined inparametersListandnumberOfParametersis the length of the previous mentioned list. -
CreateMaterial( QString materialType ): Creates material node of typematerialTypeas a child of current selected node. -
CreateShape( QString shapeType ): Creates a new shape node of typeshapeTypeas a child of current selected node. -
CreateSurfaceNode(): Creates a Surface node as a child of current selected node. -
CreateTracker( QString trackerType ): Creates a new tracker of typetrackerTypeas child of the current selected node. -
Cut(): Cuts the selected node and saves it at the clipboard. -
Cut( QString nodeURL ): Cuts the node defined asnodeURLand saves it at the clipboard. -
Delete(): Deletes selected node. -
Delete( QString nodeURL ): Deletes the node defined asnodeURLand the children of this node form the scene. -
InsertFileComponent( QString componentFileName ): Inserts as a child of the selected node the Tonatiuh component saved at the filecomponentFileName. -
Paste( QString nodeURL, QString pasteType ): Pastes the node allocated on the clipboard as a child ofnodeURL. The second argument,pasteType, indicates the type of paste,SharedorCopied. -
PasteCopy(): Pastes the node allocated on the clipboard as a new child of the selected node. -
PasteLink(): Pastes the node allocated on the clipboard as a child of the selected node. Instead a new node, this function creates a new pointer to the physical node. -
SelectNode( QString nodeURL ): Selects thenodeURL. -
SetAimingPointAbsolute(): Sets the AimingPoint parameter value to Absolute value. -
SetAimingPointRelative(): Sets the AimingPoint parameter value to Relative value. -
SetNodeName( QString nodeName ): Changes the selected node name tonodeName. -
SetValue( QString nodeURL,QString parameter, QString value): Sets the parameter with the nameparameterof the nodenodeURL, to the value defined intovalue.
-
ChangeSunPosition(double azimuth, double elevation): Sets the sun azimuth and sun elevation to those new values. The sun will be automatically updated. -
ChangeSunPosition( int year, int month, int day, double hours, double minutes, double seconds, double latitude, double longitude ): Changes the sun position to the defined position for a location (latitudeandlongitudein degrees) and an time in UT. -
SetRandomDeviateType( QString typeName ): Sets the type of random number generator totypeName. Current Tonatiuh version has availableMersenne TwisterandRng Streamgenerators. -
SetRayCastingGrid(int widthDivisions, int heightDivisions): Sets the number of sun divisions. -
SetSunshape( QString sunshapeType ): Sets the sunshape type tosunshapeTypeif it is valid type. CurrentlyBuie_SunshapeandPillbox_Sunshape. -
SetSunshapeParameter( QString parameter, QString value ): Assignsvalueto the sun parameterparameter. -
SetTransmissivity( QString transmissivityType ): Sets the scene transmissivity totransmissivityType. The following types are available currently:Default TransmissivityBallestrin TransmissivityMirval TransmissivitySengupta-NREL TransmissivityVantHull TransmissivityVittitoeBiggs Transmissivity
-
SetTransmissivityParameter( QString parameter, QString value ): Assings the value intovalueto theparameterinto the current defined transmissivity.
-
AddExportSurfaceURL( QString nodeURL ): Adds the surface with the URL nodeURL to the export surfaces list. The nodeURL is the tree node name of the surface node ( the node that contains the surface shape and material) starting form the root ("\SunNode\ROOTNODENAME ", where ROOTNODENAME is the name of the root node in the scene ). -
Run(): Runs the ray tracer for the current scene. -
RunFluxAnalysis( QString nodeURL, QString sufaceSide, unsigned int rays, int heightDivisions, int widthDivisions, QString directory, QString filename, bool saveCoords ): Runs ray trace to calculate a flux distribution map in the surface of the nodenodeURLrelated to the sidesurfaceSide. The map will be calculated with the parametersnOfRays,heightDivisionsandheightDivisions. The results will save in a file calledfilenameallocated in thedirectory. The coordinates of the cells will be saved depending on the variablesaveCoord. -
SetExportAllPhotonMap(): Sets to save all intersection photons. -
SetExportCoordinates( bool enabled, bool global ): Ifenabledisfalsethe photons coordintates will not be saved into simulations results. Otherwise, the coordinates will be saved into scene coordinates ifglobalistrueor in local coordinates relative to intersection surface. -
SetExportIntersectionSurface( bool enabled ): Ifenabledistruethe intersection surface will be saved for all photons. Otherwise, this information will not be saved. -
SetExportIntersectionSurfaceSide( bool enabled ): Ifenabledistruethe side of the surface where ray has been intersected. Otherwise, this information will not be saved. -
SetExportPhotonMapType( QString exportModeType ): Sets the export photon type toexportModeType. Currently theSQL_Database,Binary_fileandNot exportare available. -
SetExportPreviousNextPhotonID( bool enabled ): Ifenabledistruethe photon previous and next photons ID will be saved. Otherwise, this information will not be saved. -
SetExportTypeParameterValue( QString parameterName, QString parameterValue ): Sets to current selected export type parameter calledparameterNamethe valueparameterValue.- For
Binary_filethe parameters are:-
ExportDirectory: the directory path to store binary files. -
ExportFile: the binary files root name. -
FileSize: the maximum photons that can be stored into a file. Use "-1" to save into a one file.
-
- For
SQL_Databasethe parameters are:-
ExportDirectory: the path of directory where the DB will be stored. -
DBFilename: The file name for the database.
-
- For
-
SetIncreasePhotonMap( bool increase ): Decides whether increase the photonMap or not for consecutive ray tracer executions. -
SetPhotonMapBufferSize( unsigned int nPhotons ): Sets tonPhotonsthe maximum number of photons that the photon map can store. -
SetRaysDrawingOptions( bool drawRays, bool drawPhotons ): Sets to draw rays and photons after simulations. -
SetRaysPerIteration( unsigned int rays ): Sets the number of rays to trace per each ray trace execution.
In the Tutorials section there is an example of how use this functions to create a tower system a simulate it. Go to Small heliostats Tower using script.
