Verification and validation of Simulink models, MATLAB Assignment Help

Verification and validation of Simulink models:

After developing the Simulink models according to the specification there are three steps generally followed in the verification and validation of Simulink models

1. MIL (Model-in-loop testing)

2. SIL (Software-in-loop testing)

3. PIL (Processor-in-loop testing)

4. HIL (Hardware-in-loop testing)

1.  MIL (Model-in-loop testing):

          -  Here we will harness the model as separate entity and write the test cases to the harnessed model by giving the inputs and simulate it and log the results.

         - Here in this phase we will validate that our models are implemented correctly according to the requirements.

         - Here we will take the model coverage report

2.      SIL (Software-in-loop testing):

          -  Here we will generate the code from the model for the host pc and execute our MIL test cases against to the code and log the results

         - Here we will take the code coverage reports by using the tools VECTORCAST or LDRA.

        - Here we will check that our code is behaving correctly according to the requirements.

3. PIL (Processor-in-loop testing):

- Here we will generate the code from the model for the actual target and execute our MIL test cases against to the code and log the results

- Here we will take the code coverage reports by using the tools VECTORCAST or LDRA.

- Here we will check that our actual code for target is behaving correctly according to the requirements.

4. HIL (Hardware-in-loop testing):

- Here we will dump our controller code in the actual hardware and will simulate all other integration needed Io by using Scape goat (MATLAB providing it) where our plant model is simulated and providing the hooks to it and then we will execute all our test scenarios and check in the real hardware.

Simulink Verification and Validation Example:

Sample test script to harness and view the results

%Define input data

t_pedal = [0;10];

u_pedal = [1;1];

t_angle = [0;10];

u_angle = [0;0];

 

%Create structure of timeseries

clear inp;

inp.pedal_scaled = timeseries(u_pedal,t_pedal)

inp.angle_scaled = timeseries(u_angle,t_angle)

 

%Loop over value of kp

for kpVal = 0.5:0.5:3.0

   %update parameter value

   kp.value = kpVal;

 

   %simulate model

   sim('modelname')

 

   %Pause temporarily to look at results in viewer

   pause(0.5)

end

 

Automating Test Cases:

Common inputs and outputs for testing include

Inputs:

Parameters

Input signals

Model names

Solver setting (stop time, solver, simulation mode)

Data file names

 

Outputs:

Numerical data

Metrics (minimum/ maximum, pass/fail)

Displays, warning or error messages

Data files (MAT files, text files, spread sheets)

Visualizations (plots, reports etc)

 

By creating such test framework you can efficiently add or remove test cases in an existing database. MATLAB can automatically loop through the new set of test cases and produce results.

Features:

For analyzing test results it can be done in two ways in Simulink:

1.      Run time analysis:

Using Simulink block (check static range, check dynamic range, assertion block) to analyze data during simulation. This is often done via use of a harness model. so that we do not have to add analysis block

Some libraries that contain useful blocks for this include

1.      signal routing

Contains blocks that you can use to select the desired signals for analysis

2.      Logic and Bit Operations

Contains relational and logical operators that are useful as part of analysis

3.      Sinks

Contains display blocks that you can use to visualize simulation data during the simulation.

4.      Model Verification

Contains blocks that check a signals range or rate of change.These blocks has the ability to stop the simulation if a signal violates a given condition.

 

2.      Post-simulation analysis:

Log signal data from the simulation and then analyze the logged data after the simulation. This gives us the ability to analyze the entire set of results as a unit, and you can perform analysis at any time you want.

 

 

Command line simulation:

simout = sim('modelname','stoptime','10');

 

Saving results:

You can save logged simulation data to a MAT file

For analyzing it at a later time

For comparing it against later simulations

save ('modelname',simout)

model ----> modeltestcase----> simout---->save----->testname.mat

 

Common post simulation analysis:

1.      obtain data of interest from the logged data object

ex: motor_inputs = simout.get('logsout').get('motor_inputs');

    duty_timeseries = motor_inputs.values.duty_timeseries

 

2.      perform analysis:

--visualization:

   >>> plot(duty_timeseries)

--Range check

if(max(duty_timeseries.Data) > 1) || ...

  (min(duty_timeseries.Data) < 0)

  disp('Test failed!')

end

 

 

Warnings and errors:

Messages:

Display text in the MATLAB Command window

disp - Display a string or variable data

disp('test passed')

 

fprintf - Display a formatted string in the command window

fprintf('\nTest1 status:\n Passed\n\n')

 

Warning:

Warning can display text in the command window and be given unique IDs that you can use to toggle

Warning - Issue a new warning

>>warning('Testing:outof rangeid')

warndlgv- Display a dialog with a warning message

warndlg('value out of range')

 

Errors:

Errors display text in the command window and provide links to where the error occurred. They also stop execution of the script

 

 

error - Issue a new error

>>error('Testing:outof rangeid')

errordlg- Display a dialog with a error message

>>errordlg('value out of range')

num2str and sprintf are other functions to display

 

Running multiple models in Simulink:

Function test name

          Define input signals

                                |

                                |

                          Set parameters

                                |

                                |                

 

                          Simulate model

                                |

                                |                

                          Process results

 

 

 

 

function testsuite

loadsystem ('model1')

test1 ()

closesystem('model1')

loadsystem('model2')

test2()

test3()

closesystem('model2')

 

----------------------------------------------------------------------------------------------------------

parfor i = 1:3

   switch i

      case 1

                load system('model1')

                        simout = test1for();

                        closesystem('model1');

      case 2

                load system('model2')

                        simout = test1for();

                        closesystem('model2');

      case 3

                load system('model3')

                        simout = test1for();

                        closesystem('model3');

            end

end

 

Model coverage:

After developing the test cases for model (MIL) we can get the model coverage by selecting Analysis ----> Coverage ----> Setting from the simuink menu and then enable the coverage for this model option

1.      decision coverage

All the possible outcomes of decision is tested once.

2.      Condition Coverage

All the possible outcomes of condition is tested once.

3.      Modified Condition decision coverage

Each possible outcome of decision is triggering the outcome of the condition at least once

After developing the test cases in MIL we will run these scripts against to our generated code from the model and take the coverage report by using the VECTORCAST or LDRA and check the following coverage report.

1. Statement coverage

2. Decision coverage

3. Condition coverage

4. Modified Condition decision coverage

 

Guide for students who get stuck with Verification and Validation problems:

-debug line by line referencing using m script.

-use signal viewers, scope and x y graph

-use step forward and step back feature in simulation for debugging

How we help you? - MATLAB Assignment Help 24x7

We offer Verification and validation of Simulink models assignment help, Verification and validation of Simulink models assignment writing help, assessments writing service, Verification and validation of Simulink models tutors support, step by step solutions to Verification and validation of Simulink models problems, Verification and validation of Simulink models answers, MATLAB assignment experts help online. Our MATLAB assignment help service is most popular and browsed all over the world for each grade level.

There are key services in MATLAB or Simulink models which are listed below:-

  • Verification and validation of Simulink models help
  • Assignment Help
  • Homework Help
  • Verification and validation of Simulink models Assessments Writing Service
  • Solutions to problems
  • MATLAB papers writing and editing
  • Paper formatting and referencing
  • Verification and validation of Simulink models research papers writing help
  • Thesis and dissertation help
  • Experts support 24x7
  • Online tutoring

Why choose us - The first thing come in your mind that why choose us why not others what is special and different about us in comparison to other site. As we told you our team of expert, they are best in their field and we are always live to help you in your assignment which makes it special.

Key features of services are listed below:

  • Confidentiality of student private information
  • 100% unique and original solutions
  • Step by step explanations of problems
  • Minimum 4 minutes turnaround time - fast and reliable service
  • Secure payment options
  • On time delivery
  • Unlimited clarification till you are done
  • Guaranteed satisfaction
  • Affordable price to cover maximum number of students in service
  • Easy and powerful interface to track your order

assignment help

Popular Writing Services:-

  • Factorial get solutions to factorial problems, factorial assignment help online, assignment writing service from mathematics assignment experts.
  • States of Matter Get States of Matter Assignment Help Online, assessment help and Writing Service from Physical chemistry Assignment Experts.
  • Theory of Automata TOC getting help theory of automata TOC assignments online, theory of automata assessments writing service from computer science assignment experts.
  • Border Security Assignment Help get border security assignment help assignment help online, assessment help and writing service from coursework assignment experts.
  • Analytical Essay looking for analytical essay writing help, professional essay writer who can write your analytical essay with cheap or affordable price?
  • Newtons laws of motion Get Newtons laws of motion Assignment Help Online, assessment help and Writing Service from Motions and forces Assignment Experts.
  • Angular velocity Get Angular velocity Assignment Help Online, assessment help and Writing Service from Motions and forces Assignment Experts.
  • Talent Management find best hr - management tutors, hrm study resources, for hrm - talent management homework help and assignment help and writing papers or essays.
Captcha

Get Academic Excellence with Best Skilled Tutor! Order Assignment Now! Submit Assignment