Run a simulation using the command line
Summary
This tutorial aims to show you how to run a simulation on the new command line Bladed executable.
Prerequisites
- Latest version of Bladed Next Gen and Samples installed including the Bladed Python packages. Check the setting up page if you have not done so already.
- Licence for Bladed Next Gen (request a licence).
- Bladed Results Viewer.
Subjects covered
By the end of this tutorial you should have:
- Run bladed.exe with a sample input.
- Visualised the results with Results Viewer.
Bladed Next Gen input
The new Bladed input uses the JSON file format, the next tutorials go into detail on the contents of these files, for now we only want to be able to run a simulation.
Sample input decks
There are two example models provided in the samples that can be executed in this tutorial.
Running a simulation
Bladed Next Gen is a command line application, which means you will need a Windows terminal to be able to execute the simulation you want. The good news is that the Bladed tools set is automatically added to you system path and are able to run from anywhere in your file system by simply using the following command:
bladed -d <full_path_to_json_input>
Running Demo A example
If you have not done this already, unzip the samples folder and locate demo_a_pcoeffs.json
.
Open Windows Command Line (cmd) or PowerShell terminal.
The CMD can be started by typing cmd
in your start menu and pressing enter:
You might want to move to the samples folder in your command line. The following command is just an example you will have to adapt to the folder where you downloaded the samples:
C:\> cd c:\downloads\bladed-ng-samples_0.5.1\
Once you are in the folder where you have the samples, the following command will run the simulation with the demo_a_pcoeffs.json
input file:
C:\downloads\bladed-ng-samples_0.5.1\> bladed.exe -d demo_a_pcoeffs.json
Depending on your chosen folder structure, and whether or not you have moved to the samples folder, you might need to adjust the path where your input file is. Instead of calling the input file just by name you might need to add the full path of the file. This can be done automatically if you drag the file from your Windows Explorer into the command line.
C:\> bladed.exe -d c:\downloads\bladed-ng-samples_0.5.1\demo_a_pcoeffs.json
Tip
You can drag a file from a Windows Explorer into a Windows command line (cmd) or PowerShell terminal, and this will paste the path to the file into the prompt, avoiding the risk of a mistype. You can also use the Tab key to complete a folder or file path.
Specifying the output path
The current Demo A example defaults the output to your current working folder (the folder where in the command line you invoke bladed.exe
) because it has that specified inside the sample input file. If no path is specified in the input, then Bladed will stop the simulation with an error. Currently the error message in Bladed does not always display on screen, but it always shows in $TE file.
*** ERROR: Could not find the output directory at Outputs->OutputDirectory Exiting with return code 3
This behaviour might change in a future version of Bladed but for now, as a norm you should always specify where your outputs go by stating the -o <output_folder>
in the command line when invoking bladed.exe
. In the following command change <output_folder>
to the desired output location:
bladed demo_a_pcoeffs.json -o <output_folder>
Simulation command line extended options
The command line execution extended options can be visualised by calling the help documentation:
bladed.exe -h
It will yield the following output:
Bladed is wind turbine simulation software for the design and certification of onshore and offshore wind turbines.
Usage:
bladed [OPTION...] *.json
-h, --help Print a help statement to std out.
-v, --version Print the product version number and quit.
-s, --schema Print the supported schema version of the input models
and quit.
-u, --unattended Run as unattended, no user prompts are issued.
-d, --datamodel arg The full path to JSON datamodel file (if not provided,
a file named 'bladed.json' will be looked for in the
working directory). (default: bladed.json)
-i, --input arg The full path to input file (if not provided, a file
named 'DTBLADED.IN' will be looked for in the working
directory). (default: DTBLADED.IN)
-o, --output arg An output directory to write results and message files
to. This will override the location specified in the
input file. (default: )
-n, --runname arg A name stem to use for all of the output files. This
will override the name specified in the input file.
Analysing the results
If your simulation run correctly it will have produced the output files you are already used to see when working with Bladed 4.16.
You will be able to open the outputs using the latest version of Bladed Results Viewer.