-
Notifications
You must be signed in to change notification settings - Fork 15
Script functions
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 thefileName
file. -
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 bynodeURL
to 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 inparametersList
andnumberOfParameters
is the length of the previous mentioned list. -
CreateMaterial( QString materialType )
: Creates material node of typematerialType
as a child of current selected node. -
CreateShape( QString shapeType )
: Creates a new shape node of typeshapeType
as 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 typetrackerType
as child of the current selected node. -
Cut()
: Cuts the selected node and saves it at the clipboard. -
Cut( QString nodeURL )
: Cuts the node defined asnodeURL
and saves it at the clipboard. -
Delete()
: Deletes selected node. -
Delete( QString nodeURL )
: Deletes the node defined asnodeURL
and 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,Shared
orCopied
. -
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 nameparameter
of 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 (latitude
andlongitude
in degrees) and an time in UT. -
SetRandomDeviateType( QString typeName )
: Sets the type of random number generator totypeName
. Current Tonatiuh version has availableMersenne Twister
andRng Stream
generators. -
SetRayCastingGrid(int widthDivisions, int heightDivisions)
: Sets the number of sun divisions. -
SetSunshape( QString sunshapeType )
: Sets the sunshape type tosunshapeType
if it is valid type. CurrentlyBuie_Sunshape
andPillbox_Sunshape
. -
SetSunshapeParameter( QString parameter, QString value )
: Assignsvalue
to the sun parameterparameter
. -
SetTransmissivity( QString transmissivityType )
: Sets the scene transmissivity totransmissivityType
. The following types are available currently:Default Transmissivity
Ballestrin Transmissivity
Mirval Transmissivity
Sengupta-NREL Transmissivity
VantHull Transmissivity
VittitoeBiggs Transmissivity
-
SetTransmissivityParameter( QString parameter, QString value )
: Assings the value intovalue
to theparameter
into 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 nodenodeURL
related to the sidesurfaceSide
. The map will be calculated with the parametersnOfRays
,heightDivisions
andheightDivisions
. The results will save in a file calledfilename
allocated 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 )
: Ifenabled
isfalse
the photons coordintates will not be saved into simulations results. Otherwise, the coordinates will be saved into scene coordinates ifglobal
istrue
or in local coordinates relative to intersection surface. -
SetExportIntersectionSurface( bool enabled )
: Ifenabled
istrue
the intersection surface will be saved for all photons. Otherwise, this information will not be saved. -
SetExportIntersectionSurfaceSide( bool enabled )
: Ifenabled
istrue
the 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_file
andNot export
are available. -
SetExportPreviousNextPhotonID( bool enabled )
: Ifenabled
istrue
the 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 calledparameterName
the valueparameterValue
.- For
Binary_file
the 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_Database
the 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 tonPhotons
the 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.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License