Cyclist problem

From COSSAN Wiki
Jump to: navigation, search
Cossan-X Tutorial

Cyclist Power Problem

Mark Briggs, Nestoras Chalkidis, Kira Henshaw, Elpida Kontsioti

Introduction to the Problem

When riding a bicycle a cyclist experiences a range of factors which influence the power required to maintain a certain steady-state speed. The aim of this tutorial is to implement a model using Cossan-X and multiple analysis techniques in order to determine the likelihood that the power a rider’s legs deliver to the wheels of a bicycle and hence the power provided by the cyclist must change in response to various uncertain features.

Factors which have an impact on the required power are:

Weight (W) = Wb + Wc

Weight of bicycle (Wb)

Weight of cyclist (Wc)

Coefficient of drag (Cd)

Percentage gradient of hill (G)

Air density (Rho)

Velocity (V)

Frontal area (A)

Coefficient of rolling resistance (Crr)

Drivetrain loss (Lossdt)

Aerodynamic drag acting on cyclist (Fdrag)

Force of gravity acting on cyclist (Fgravity)

Force of rolling resistance acting on cyclist (Frolling)

The features which will be addressed include uncertain elements such as the weight of the cyclist, the magnitude of loss due to friction experienced within the drivechain through components such as chains and gears, in addition to uncertainty in relation to friction between the bicycle tyres and road surface, represented by the coefficient of rolling resistance. Each of these factors will be modelled by random variables with specified distributions.

Both the drag coefficient and frontal area of the rider vary depending on the position of the cyclist. Three of these positions are displayed in the figure below along with their corresponding measurements.

Drag Coefficient:

Cyclist (Tops) = 1.15

Cyclist (Hoods) = 1.0

Cyclist (Drops) = 0.88

Frontal Area:

Cyclist (Tops) = 0.632

Cyclist (Hoods) = 0.4

Cyclist (Drops) = 0.32

Below is an image displaying how the frontal area is calculated:


Frontal1235.png


A sample of the various positions a rider may take are included in the following image:


Positions1236.JPG


During this tutorial, the model assumes that the rider takes the tops position on the bicycle. A suggestion for further investigation would be to simulate the model assuming both the hoods and drops positions in order to compare the effect on the required power.

Input Values For Simulation

Parameters

Parameter Value
Coefficient of drag (Cd) [tops]
1.15
Velocity (V)
35 km/h
Frontal Area (A) [tops]
0.632 m2
Weight of bicycle (Wb)
9 kg
Percentage gradient of hill (G)
0.1 %
Temperature
21°C


Random Variables

Random Variables Distribution
Weight of cyclist (Wc)
N(62,7) kg
Drivetrain loss (Lossdt)
0.632 m2
Coefficient of rolling resistance (Crr)
N(0.005,1x10-4)


Input Functions

1. Air density (Rho) = - 0.005 * Temperature (°C) + 1.295
2. Fgravity (N) = 9.8067 (ms-2) * sin(arctan(G/100)) * W (kg)
3. Frolling(N) = 9.8067 (ms-2) * cos(arctan(G/100)) * W (kg)* Crr
4. Fdrag(N) = 0.5 * Cd * A (m2) * Rho (kgm-3) * (V (ms-1))2
5. Ftotal(N) = Fgravity + Frolling + Fdrag

Output Functions

1. Plegs(W) = (1-(Lossdt/100))-1 * (Fgravity + Frolling + Fdrag) * V (ms-1)
2. Pwheel(W) = (1 - (Lossdt/100)) * Plegs(W)

Problem Definition in COSSAN-X

Create a Project

To start click the File tab, followed by New, then Project.


Project123456.png


Next, give the project a name and brief description, making sure the project is to be saved in the default location (tick box). Click Finish upon completion.


Projectscreen234.png


The project will now appear in the work space, to access the sub folders i.e. parameters, matlab scripts etc, select the arrow next to the main headings.


Projectscreen123.png

Input

Parameters

Parameters must be added to the project file in order for Matlab scripts and functions to be able to use them in the calculation of Plegs and Pwheels. The parameters are the values which are specified and remain constant throughout. The input folder facilitates the definition of parameters in the following steps:

1. Open Input then Parameters.

2. Right click the Parameters folder and select Add Parameter.


Sc1.png


3. Give the parameter a name and description, ensuring the script is to be saved in the current project i.e., Cyclist_Power_Problem.


Sc2.png


4. Click Finish, this will enable the value of the specified parameter to be inserted.


Sc3.png


5. Remember to save the parameter after defining it by clicking Ctrl + s.

6. Repeat this process for all parameters required for the problem.

Random Variables

A random variable can be added to the project and its distribution specified i.e., normal distribution, lognormal distribution etc. These random variables will enable a probability distribution to be assigned to each uncertain feature and are required for the creation of Matlab scripts and definition of functions. The input folder facilitates this in the following steps:

1. Open Input then Random Variables.

2. Right click Random Variables and select Add Random Variable.


Sc4.png


3. Give the random variable a name and description, ensuring the script is to be saved in the current project i.e., Cyclist_Power_Problem. Finally, click Finish.


Sc5.png


4. Next, choose the random variable’s distribution i.e. normal distribution, lognormal distribution etc. Once the distribution is selected input the parameters for the given distribution i.e. for a normally distributed random variable input the mean and standard deviation.

5. Save the random variable after completing the above steps. The probability density function and cumulative distribution function corresponding to the specified distribution will then be displayed.


Sc6.png


6. Repeat this process for all uncertain quantities incorporated in the problem.

Functions

Any functions of the previously specified parameters and random variables necessary for the computation of the final output should be defined. This is again completed within the input folder in the following way:

1. Open Input then Functions.

2. Right click the Functions folder and select Add Function.


Sc7.png


3. Give the function a name and description, again ensuring the script is to be saved in the current project i.e., Cyclist_Power_Problem. Finally, click Finish.


Sc8.png


4. In the box labeled Function definition, add the equation of the function which is to be defined. Each parameter and random variable included in the function should be enclosed by <& &>, with a dot (.) included immediately before each operation (excluding addition and subtraction). Note only the right-hand side of the equation should be added.

5. Finally, save the function.

Sc9.png

Matlab Script

A Matlab script must be created to enable the calculation of Plegs and Pwheels. The evaluator should be thought of as the functional relation which transforms input values into output values. It is the Evaluators folder which facilitates the creation of the Matlab script in the following steps:

1. Open Evaluators then Matlab files.

2. Right click Matlab files and select Add Matlab Script.


Sc10.png


3. Select Create new script and give the script a name and description, ensuring the script is to be saved in the current project i.e., Cyclist_Power_Problem.


Sc11.png


4. Upon completion of these steps an editor will appear which allows you to create your Matlab script. Firstly give the metadata a name and description, then identify all input factors which will be necessary in order to perform the power calculations. In this tutorial all parameters, random variables and functions previously defined are required. Using the plus button corresponding to the Input window each factor should be added to the script.

5. The desired output should then be named, again using the plus button corresponding to the Output window. In this case, plegs represents the cyclist’s required leg power.


Sc12.png


6. Select the Script/Function tab at the bottom of the editor in order to create the Matlab script.

7. The required power in the legs is calculated using the following script:

Toutput(n).p_legs = ((1 - (Tinput(n).Loss_dt/100)  )^(-1)) * (Tinput(n).F_total * Tinput(n).V);

The power required to be transferred to the wheels is calculated using the following script:

Toutput(n).p_wheel = (1- (Tinput(n).Loss_dt/100)) * (Toutput(n).p_legs);

When writing your script ensure to add Toutput(n). before each output term and Tinput(n). before each input term in the formulation. Each of the above scripts should be inserted inside the for loop which appears in the Matlab script template.

8. Once you have completed these steps save the Matlab script by selecting Ctrl + S.


Sc13.png

Model

Creation of the Physical Model

In this tutorial, both Uncertainty Quantification Analysis and Sensitivity Analysis of the physical model describing our problem will be performed. This will enable analysis of the impact of the uncertain random variables inserted into the model on the output values. In this section, a description on how to create a physical model in COSSAN-X is provided:

1. Right-click on Physical Models (from Models dropdown list in Workspace) and select Add Physical Model.


Sc14.png


2. Add a name (e.g. bike_physmdl) and a short description of the physical model. Make sure that your model belongs to the project “Cyclist_Power_Problem”. Finally, press Finish to create your model.


Sc15.png


3. Add an evaluator i.e., Power_cyclist to the editor that appears in the main window by clicking the “+” button on the right side of the Evaluator box and selecting the corresponding evaluator in the pop-up window. Then, all the related inputs and outputs will automatically appear in the corresponding boxes in the main window.


Sc16.png


4. The entry “uncorrelated_rvs” will appear in the Random Variable Sets window by default.

Note: In order to consider correlations between random variables, it is essential to add a random variable set by pressing the “+” button on the right side of the Random Variable Set box and selecting rvset1.


Sc17.png


Then, we can modify the correlation coefficients by double-clicking “rvset1” (in the window), and selecting the Correlations section (below Random Variables and Correlations). All random variables are assumed to be uncorrelated if the Correlations button is not selected.


Sc18.png


5. Save the object. The error message (in red) at the top of the window disappears and the model is ready to be analysed.


Sc19.png

Uncertainty Quantification

Uncertainty quantification analyses the likelihood of specified outcomes when not all variables involved in the statistical problem are known with certainty. The cyclist problem takes into consideration each of the input factors, and using uncertainty quantification allows us to predict the probability of a cyclist having to increase the power they produce. Monte Carlo simulation is a technique used to quantify the uncertainty, providing results which enable us to visualise the likelihood of a required increase in power given the input data.

1. Click on the green button at the top-right of the window in order to begin the simulation.


Sc20.png


2. In the pop-up window that appears there are a number of available analysis types. For Uncertainty Quantification analysis select Uncertainty Quantification, name the analysis and provide a short description. Then, press Next.


Sc21.png


3. On the following page, select Monte Carlo from the available simulation methods and set the number of independent samples (Samples per Batch) to 1,000. Specifying the number of batches enables the computation to be split, this is useful when multiple computers are used to process the computation. In this case, keep the number of batches as 1 and the maximum runtime as 0. Press Next.


Sc23.png


4. In this tutorial the analysis will be performed on a local machine so there is no need to configure the HPC settings that appear in the next window.


Sc24.png


5. Pressing Finish starts the actual computations, and once the simulation is complete a message of successful completion appears in the Engine Console.


Sc25.png


Results

The results of the Uncertainty Quantification analysis are available in the Analysis section, within the Uncertainty Quantification folder. Expand the corresponding drop-down list until you reach the SimulationData_batch_1_of_1 in the Results folder (as shown below). Selection of each of the variables involved in the computation and the outputs allows the user to observe the corresponding plots. An example is displayed in the histogram below:

Sc26.png


Sc27.png


Combinations of each variable can also be selected, enabling comparative analysis. An example of this is displayed in the scatterplot below in which a strong positive correlation between the power required in the legs of the cyclist and the cyclist's weight appears. In order to obtain this scatterplot, select the variables you wish to compare, then select the scatterplot in the list of actions on the right of the window.


Scatterplotscat.png


Further to this, it is possible to analyse any correlations between the variables by selecting the Parallel Coordinates View in the list of available actions.


Whatamess.png

Sensitivity Analysis

Sensitivity analysis and uncertainty analysis are well-coupled, with sensitivity analysis focusing more on how the output may be allocated to different sources of uncertainty included in a model's inputs. It is possible to determine the impact of uncertain variables using sensitivity analysis by evaluating results when considering various assumptions. This can be useful for a range of reasons:

1. Increased understanding of the relationships between input and output variables in a system or model.

2. Testing the robustness of the results of a model or system while taking into consideration the uncertainty.

3. Searching for errors in a model.

4. Finding regions in the input factors for which the model output is either maximum or minimum.

5. Uncertainty reduction, through identification of model inputs causing significant uncertainty in the output.


Local Sensitivity

1. Click on the green button at the top-right of the window in order to begin the analysis.

2. In the window that appears, select Sensitivity Analysis, name the analysis and provide a short description. Then, press Next.


Sc28.png


3. On the following page, select Local Sensitivity Measures as the quantity of interest, ensuring the desired output is selected as the output of interest i.e., plegs. Press Next.


Sc29.png


4. Add all random variables to the Reference Point section by clicking “+” and selecting each of the variables required for the analysis. Select Finite Difference Method, keeping the default value for the distance between points (1.0E-4).


Sc30.png


5. In this tutorial, the analysis will be performed on a local machine so there is no need to configure the HPC settings that appears in the next window.


Sc31.png

Results

The results of the Local Sensitivity Analysis can be found in the Sensitivity Analysis folder within the Analysis section. Expand the drop-down list corresponding to the model i.e., bike_physmdl_analysis2, and select the output from the Results folder (under Engine Outputs).


Sc32.png


7. Again use the available actions listed in the results section (e.g. pie chart, bar chart, etc). to visualise the results. Selecting the object corresponding to the project will provide a summary of the sensitivity measure.


Sens1234.png

Deterministic Analysis

Deterministic analysis creates outputs which are fully determined by the parameter values and initial conditions, without any randomness. This provides an alternative to stochastic risk analysis in which a non-deterministic model is applied to the variables with input and output values known.

1. Again right-click on Physical Models and select Add Physical Model.


SC36.JPG


2. Add a name (e.g. DeterministicAnalysis) and a description of the physical model. Make sure that your model is saved in the project “Cyclist_Power_Problem”. Finally, press Finish to create your model.


SC37.JPG


3. Add an evaluator to the editor that appears in the main window by clicking the “+” button on the right side of the Evaluator box and selecting the corresponding evaluator in the pop-up window. Then, all the related inputs and outputs will automatically appear in the corresponding boxes in the main window.

4. The entry “uncorrelated_rvs” will appear in the Random Variable Sets window by default. Add a random variable set by pressing the “+” button on the right side of the Random Variable Set box and selecting rvset1.


SC38.JPG


5. Save the object. The error message (in red) at the top of the window disappears and the model is ready to be analysed.

6. Next select your model (e.g. DeterministicAnalysis) in the Physical Models section of the Models folder, then click the green button in the top-right of the window to start the analysis.


SC39.JPG


7. Within the Analysis Selection window which appears, give the analysis a name and description, then select Design of Experiments and press Next.


SC40.JPG


8. In the second window which appears select Deterministic Analysis, then Next once again.


SC41.JPG


9. Finally, select Finish in the following window in order to run the analysis.


SC42.JPG

Results

10. In order to view your results go to Design of Experiments in the Analysis folder. Then double click Results and open the alphanumerically labeled folder. Open SimulationData_Deterministic_Analysis and observe the results.


SC44.png

Exercise

In order to compare the difference in the required plegs between various positions of the cyclist, use the parameters provided in the problem description to perform Uncertainty Quantification for the positions hoods and drops.

Results

Tops

Sc33.png


Hoods

Sc34.png


Drops

Sc35.png

The three histograms displayed above show how the power required in the cyclist's legs to maintain a stead-state speed varies as they change their position above the handlebars. The shape of the plots suggests that plegs is normally distributed. The drops position corresponds to the smallest frontal area and perhaps in line with intuition, the histogram resulting from the uncertainty analysis in this instance displays that the value of plegs is significantly less in comparison with the same result in the case that the rider takes the tops position. The value of plegs associated with the hoods position falls in-between tops and drops, as should be expected. This therefore suggests that a cyclist should lower their position above the handlebars when aiming to maintain their speed in order to reserve power.

See also