Skip to content

Commit

Permalink
Merge pull request #7 from virtual-labs/dev
Browse files Browse the repository at this point in the history
updated
  • Loading branch information
coepvlab authored Dec 12, 2023
2 parents d6e3e32 + 95c9d64 commit dbc5006
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
9 changes: 6 additions & 3 deletions experiment/simulation/src/calculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ function columnType(){

if(hasDuplicate == true){
dupFlg = 0;

alert("Avoid Duplicates");
$(".modal-header").html("Error Message");
$(".modal-header").css("background","#9c1203b0");
$("#btnModal").removeClass("btn-success").addClass("btn-danger");
$("#MsgModal").html("Avoid Duplicates");
// alert("Avoid Duplicates");
arrWeight.splice(index,1);
$("#submit_load1").prop('disabled',false);
$("#text1").prop('disabled',false);
Expand Down Expand Up @@ -333,7 +336,7 @@ function columnType(){
$(".modal-header").html("Error Message");
$(".modal-header").css("background","#23435c");
$("#btnModal").removeClass("btn-success").addClass("btn-danger");
$("#MsgModal").html("<b>Formula : Transverse Strain = -P*Pos / AE where, <br> Pos = Poison's Ratio</b>");
$("#MsgModal").html("<b>Formula : Transverse Strain = -P &times; Pos / AE where, <br> Pos = Poison's Ratio</b>");
// alert("formula : Transverse Strain = -P*Pos / AE");

// $("#modelMsg").html("<b class='boldTextBlue'>formula : Area = "+unescape('%u220F')+" r"+unescape('%B2')+"</b> ");
Expand Down
125 changes: 108 additions & 17 deletions experiment/simulation/src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var secondVal = 0;
var thirdVal = 0;
var idCal = 1;
var flg = 0;

var p1,p2,p3,p4,p5;
var r1,r2,r3,txt;
function tableReading(masterJson)
{

Expand Down Expand Up @@ -141,8 +142,21 @@ function tableReading(masterJson)
+'<div class="col-sm-3" id="submitCal">'
+'<br><button type="submit" class="btn btn-danger" id="submit_selLoad2" data-toggle="modal" data-target="#myModal" style="width:100%;margin-top: -6px;" >Submit</input>'
+'</div>'
+'</div>'


+'</div>'
+'<div class="row" >'
+'<div class="col-sm-12">'
+'<button type="button" style="padding: 10px; " class="btn btn-danger btnStyle" id="anotherReading" hidden><b>SELECT ANOTHER LOAD </b></button>'
+'</div>'
+'</div>'
+'<br>'
+'</div>'
+'<div class="row" >'
+'<div class="col-sm-12">'
+'<button type="button" style="padding: 10px; " class="btn btn-danger btnStyle" id="finishReading" data-toggle="modal" data-target="#myModal" hidden><b>COMPLETED </b></button>'
+'</div>'
+'</div>'

for(i=0,p=1;i<masterJson.demo.length;i++,p++)
{
tableMainDiv+=' <tr>'
Expand All @@ -163,43 +177,56 @@ function tableReading(masterJson)
var loadCheck1=0;

$("#text4").change(function(){
loadCheck1 = $("#text4").val();
loadCheck = parseFloat(loadCheck1);
console.log(" loadCheck "+loadCheck);

loadCheck1 = $("#text4").val();
loadCheck = parseInt(loadCheck1);
pressureValue =$("#text4").children(":selected").attr("value");
$("#text4").children('option[value="' + pressureValue + '"]').attr('disabled', true);

// loadCheck1 = $("#text4").val();
// loadCheck = parseFloat(loadCheck1);
// console.log(" loadCheck "+loadCheck);
});

var selLoadOut = 0;

$("#submit_selLoad").click(function(){


if(loadCheck!=0)
{
for(i=0 ,flag=0; i<masterJson.demo.length;i++){
// var temp=parseInt(masterJson.demo[i].text1);
if(loadCheck ==1){
flag = 1;
selLoadOut = firstLoad;
secondVal = masterJson.demo[0].text2;
thirdVal = masterJson.demo[0].text3;
break;
}else if(loadCheck==2)
{
flag = 1;
selLoadOut = secondLoad;
secondVal = masterJson.demo[1].text2;
thirdVal = masterJson.demo[1].text3;
break;

}else if(loadCheck==3)
{
flag = 1;
selLoadOut = thirdLoad;
secondVal = masterJson.demo[2].text2;
thirdVal = masterJson.demo[2].text3;
break;
}else if(loadCheck==4){
flag = 1;
selLoadOut = forthLoad;
secondVal = masterJson.demo[3].text2;
thirdVal = masterJson.demo[3].text3;
break;
}else if(loadCheck==5){
flag = 1;
selLoadOut = fifthLoad;
secondVal = masterJson.demo[4].text2;
thirdVal = masterJson.demo[4].text3;
break;
Expand Down Expand Up @@ -286,10 +313,15 @@ function tableReading(masterJson)
$("#submit_selLoad2").prop("disabled",true);
$("#text6").prop("disabled",true);
additionToJson();
$("#btnModal").removeClass("btn-danger").addClass("btn-success");
$(".modal-header").html("Success Message");
$(".modal-header").css("background","#5cb85c");
$("#MsgModal").html(" Experiment Completed Successfully!!" );
if(iter1<4){
$("#anotherReading").prop("hidden",false);
$("#finishReading").prop("hidden",false);
}else{
$("#anotherReading").prop("disabled",true);
$("#finishReading").prop("hidden",false);
}



} else if (corrOut != outVolt) {
$(".modal-header").html("Error Message");
Expand All @@ -310,7 +342,7 @@ function tableReading(masterJson)
$(".modal-header").html("Error Message");
$(".modal-header").css("background","#23435c");
$("#btnModal").removeClass("btn-success").addClass("btn-danger");
$("#MsgModal").html("<b>Output voltage = Eb*f[E2+E4-E1-E3]/4</b>");
$("#MsgModal").html("<b>Output voltage = Eb &times; f[E2+E4-E1-E3]/4</b>");
// alert("formula : Output voltage = Eb*f[E2+E4-E1-E3]/4");

// $("#modelMsg").html("<b class='boldTextBlue'>formula : Area = "+unescape('%u220F')+" r"+unescape('%B2')+"</b> ");
Expand All @@ -326,10 +358,18 @@ function tableReading(masterJson)
additionToJson();
$("#submit_selLoad2").prop("disabled",true);
$("#text6").prop("disabled",true);
$("#btnModal").removeClass("btn-danger").addClass("btn-success");
$(".modal-header").html("Success Message");
$(".modal-header").css("background","#5cb85c");
$("#MsgModal").html(" Experiment Completed Successfully!!" );
if(iter1<4){
$("#anotherReading").prop("hidden",false);
$("#finishReading").prop("hidden",false);
}else{
$("#anotherReading").prop("disabled",true);
$("#finishReading").prop("hidden",false);
}

// $("#btnModal").removeClass("btn-danger").addClass("btn-success");
// $(".modal-header").html("Success Message");
// $(".modal-header").css("background","#5cb85c");
// $("#MsgModal").html(" Experiment Completed Successfully!!" );

} else {
checkAns = 0;
Expand All @@ -348,10 +388,61 @@ function tableReading(masterJson)
idCal++;
}
});

$("#finishReading").click(function(){
complete();
$("#anotherReading").prop("disabled",true);
$("#finishReading").prop("disabled",true);



});

function complete(){

alert("Experiment Completed Successfully!");
// $("#btnModal").removeClass("btn-danger").addClass("btn-success");
// $(".modal-header").html("Success Message");
// $(".modal-header").css("background","#5cb85c");
// $("#MsgModal").html("Experiment Completed Successfully!");
}

var iter1 = 0;
$("#anotherReading").click(function(){
clear();
idCal = 1;
$("#text4").val(0);
$("#text4").prop("disabled",false);
$("#submit_selLoad").prop("disabled",false);
$("#guageFact").prop("hidden",true);
$("#ebVal").prop("hidden",true);
$("#outVal").prop("hidden",true);
$("#text5").val(0);
$("#text6").val('');
$("#anotherReading").prop("hidden",true);
$("#finishReading").prop("hidden",true);
$("#text5").prop("disabled",false);
$("#submit_selLoad1").prop("disabled",false);
$("#submit_selLoad2").prop("disabled",false);
$("#text6").prop("disabled",false);
iter1++;
});


function clear(){
p1.remove();
p2.remove();
p3.remove();
p4.remove();
p5.remove();
txt.remove();
// var txt = paper.text(x+328,y+159," ").attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold"});
r1.attr({"fill":"#fff"});
}

function additionToJson(){
tempJson = {};
tempJson.selectedLoad = selLoad ;
tempJson.selectedLoad = selLoadOut ;
tempJson.ebValue = eb;
tempJson.outputVoltage = outVolt;
arrayJson.push(tempJson);
Expand Down
48 changes: 28 additions & 20 deletions experiment/simulation/src/wheatStoneCalculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ function bridgeCalculate(){
$("#main-div-conf").html('');
x = 100;
y = 100;
var paper = new Raphael(document.getElementById('main-div-conf'),600,500);
p1 = paper.text(x+280,y+108,"") ;
p2 = paper.text(x+375,y+212,"");
p3 = paper.text(x+375,y+107,"");
p4 = paper.text(x+278,y+212,"");
p5 = paper.text(x-6,y+159,"");

// var p1,p2,p3,p4,p5;
console.log("secondVal"+secondVal);
console.log("thirdVal"+thirdVal);
var paper = new Raphael(document.getElementById('main-div-conf'),600,500);

wheatStone = paper.image("images/wheatStoneBridgeE.png",(x-50), (y-100),700, 600);
var r1 = paper.circle(x+327,y+160,35).attr({'stroke' : '#000' , 'stroke-width' : 3 });
var r2 = paper.circle(x+228,y+142,12).attr({'stroke' : '#fff' , 'stroke-width' : 3,"fill":"#fff"});
var r3 = paper.circle(x+423,y+142,12).attr({'stroke' : '#fff' , 'stroke-width' : 3,"fill":"#fff" });
r1 = paper.circle(x+327,y+160,35).attr({'stroke' : '#000' , 'stroke-width' : 3,"fill":"#fff" });
r2 = paper.circle(x+228,y+142,12).attr({'stroke' : '#fff' , 'stroke-width' : 3,"fill":"#fff"});
r3 = paper.circle(x+423,y+142,12).attr({'stroke' : '#fff' , 'stroke-width' : 3,"fill":"#fff" });
if(flg==1){
paper.text(x+280,y+108,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+212,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+107,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+278,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+280,y+108,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+212,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+107,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+278,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});

// paper.text(x+280,y+100,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
// paper.text(x+385,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
Expand All @@ -23,25 +31,25 @@ function bridgeCalculate(){

}
if(flg==2){
paper.text(x+280,y+108,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+212,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+107,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+278,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x-6,y+159,eb+"v").attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"red"});
paper.text(x+280,y+108,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+212,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+107,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+278,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x-6,y+159,eb+"v").attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"red"});
}


if(flg == 3){
paper.text(x+280,y+108,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+212,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+375,y+107,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x+278,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
paper.text(x-6,y+159,eb+"v").attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"red"});
p1 = paper.text(x+280,y+108,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
p2 = paper.text(x+375,y+212,thirdVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
p3 =paper.text(x+375,y+107,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
p4 = paper.text(x+278,y+212,secondVal).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"#0ee8e5"});
p5 =paper.text(x-6,y+159,eb+"v").attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold","fill":"red"});
if (corrOut == outVolt){
var txt = paper.text(x+328,y+159,corrOut).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold"});
txt = paper.text(x+328,y+159,corrOut).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold"});
r1.attr({"fill":"green"});
}else{
var txt = paper.text(x+328,y+159,corrOut).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold"});
txt = paper.text(x+328,y+159,corrOut).attr({'stroke' : '#000' , "font-size":"20px","font-weight": "bold"});
r1.attr({"fill":"red"});

}
Expand Down

0 comments on commit dbc5006

Please sign in to comment.