/* * sim1.fx * * Created on Sep 13, 2009, 8:47:22 PM */ /** * @author Bagus Sulistyo */ import java.lang.Math; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.shape.Line; import javafx.scene.paint.Color; import javafx.scene.Group; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.shape.Circle; import javafx.scene.effect.Reflection; import javafx.scene.paint.RadialGradient; import javafx.scene.paint.Stop; //definisi masukan semisal Ia dan sudut nya var ia:Number=1.6; var sa:Number=Math.toRadians(25); var ib:Number=1; var sb:Number=Math.toRadians(180); var ic:Number=0.9; var sc:Number=Math.toRadians(132); def a:Number=Math.toRadians(120); def b:Number=Math.toRadians(240); def c:Number=Math.toRadians(360); def d:Number=100;// faktor pengkali skala var x1=(ia*Math.cos(sa)+ ib*Math.cos(sb) + ic*Math.cos(sc))/3; var y1=(ia*Math.sin(sa)+ ib*Math.sin(sb) + ic*Math.sin(sc))/3; var xx1=Math.sqrt((x1*x1)+(y1*y1)); var yy1=Math.toDegrees(Math.atan(y1/x1)); println("ia0= {x1} + j ({y1})"); println("ia0 polar= {xx1} sudut {180+yy1}"); var x2=(ia*Math.cos(sa)+ ib*Math.cos(sb+a) + ic*Math.cos(sc+b))/3; var y2=(ia*Math.sin(sa)+ ib*Math.sin(sb+a) + ic*Math.sin(sc+b))/3; var xx2=Math.sqrt((x2*x2)+(y2*y2)); var yy2=Math.toDegrees(Math.atan(y2/x2)); //println("ia0= {x} + j ({y})"); //println("ia0 polar= {xx} sudut {yy}"); var x3=(ia*Math.cos(sa)+ ib*Math.cos(sb+b) + ic*Math.cos(sc+a))/3; var y3=(ia*Math.sin(sa)+ ib*Math.sin(sb+b) + ic*Math.sin(sc+a))/3; var xx3=Math.sqrt((x3*x3)+(y3*y3)); var yy3=Math.toDegrees(Math.atan(y3/x3)); // println("ia0= {x} + j ({y})"); println("ia0 polar= {xx3} sudut {yy3}"); Stage { title : "Symmetri Component" scene: Scene { fill: RadialGradient { centerX: 200 centerY: 500 focusX: 10 focusY: 0.1 radius: 100 stops: [ Stop { color : Color.BISQUE offset: 0.0 }, Stop { color : Color.LIGHTBLUE offset: 1.0 }, ] } width: 200 height: 200 content: [ Group { translateX:200 translateY:300 effect: Reflection { fraction: 0.75 topOffset: 0.0 topOpacity: 0.5 bottomOpacity: 0.0 } content: [ Line { //startX: 10, startY: 10 endX: bind d*ib*Math.cos(-sb), endY: bind d*ib*Math.sin(-sb) strokeWidth: 3 stroke: Color.BLUE } , Line { //startX: 10, startY: 10 endX: bind d*ia*Math.cos(-sa), endY: bind d*ia*Math.sin(-sa) strokeWidth: 3 stroke: Color.BLACK }, Line { //startX: 10, startY: 10 endX: bind d*ic*Math.cos(-sc), endY: bind d*ic*Math.sin(-sc) strokeWidth: 3 stroke: Color.RED }, Text { font : Font { size: 12 } x:bind d*ia*Math.cos(-sa) , y: bind d*ia*Math.sin(-sa) content: "ia" }, Text { font : Font { size: 12 } x:bind d*ib*Math.cos(-sb) , y: bind d*ib*Math.sin(-sb) content: "ib" }, Text { font : Font { size: 12 } x:bind d*ic*Math.cos(-sc) , y: bind d*ic*Math.sin(-sc) content: "ic" }, Text { font : Font { size: 12 } x:20, y:50 content: "Un-balanced Currents" }, Circle { //centerX: 100, centerY: 100 radius: 4 fill: Color.BLACK } ] } , Group { translateX:500 translateY:300 effect: Reflection { fraction: 0.75 topOffset: 0.0 topOpacity: 0.5 bottomOpacity: 0.0 } content: [ Line { //startX: 10, startY: 10 endX: bind d*xx1*Math.cos(yy1), endY: bind d*xx1*Math.sin(yy1) strokeWidth: 3 stroke: Color.BLACK }, Text { font : Font { size: 12 } x:20, y:50 content: "Zero Sequence " }, Text { font : Font { size: 12 } x:bind d*xx1*Math.cos(yy1), y:bind d*xx1*Math.sin(yy1) content: "ia = ic = ib " } ] }, Group { translateX:700 translateY:300 effect: Reflection { fraction: 0.75 topOffset: 0.0 topOpacity: 0.5 bottomOpacity: 0.0 } content: [ Line { endX: bind d*xx2*Math.cos(yy2), endY: bind d*xx2*Math.sin(yy2) strokeWidth: 3 stroke: Color.BLACK },Text { font : Font { size: 12 } x:bind d*xx2*Math.cos(yy2) , y: bind d*xx2*Math.sin(yy2) content: "ia" }, Line { endX: bind d*xx2*Math.cos(-(yy2-a)), endY: bind d*xx2*Math.sin(-(yy2-a)) strokeWidth: 3 stroke: Color.BLUE },Text { font : Font { size: 12 } x:bind d*xx2*Math.cos(-(yy2-a)) , y: bind d*xx2*Math.sin(-(yy2-a)) content: "ib" }, Line { endX: bind d*xx2*Math.cos(-(yy2-b)), endY: bind d*xx2*Math.sin(-(yy2-b)) strokeWidth: 3 stroke: Color.RED },Text { font : Font { size: 12 } x:bind d*xx2*Math.cos(-(yy2-b)) , y: bind d*xx2*Math.sin(-(yy2-b)) content: "ic" }, Text { font : Font { size: 12 } x:20 , y: 50 content: "Positive Squence" }, Circle { radius: 4 fill: Color.BLACK } ] } Group { translateX:1000 translateY:300 effect: Reflection { fraction: 0.75 topOffset: 0.0 topOpacity: 0.5 bottomOpacity: 0.0 } content: [ Line { endX: bind d*xx3*Math.cos(-(b-yy3)), endY: bind d*xx3*Math.sin(-(b-yy3)) strokeWidth: 3 stroke: Color.BLACK }, Text { font : Font { size: 12 } x: bind d*xx3*Math.cos(-(b-yy3)), y: bind d*xx3*Math.sin(-(b-yy3)) content: "ia" }, Line { endX: bind d*xx3*Math.cos(-(a-yy3)), endY: bind d*xx3*Math.sin(-(a-yy3)) strokeWidth: 3 stroke: Color.RED }, Text { font : Font { size: 12 } x: bind d*xx3*Math.cos(-(a-yy3)), y: bind d*xx3*Math.sin(-(a-yy3)) content: "ic" }, Line { endX: bind d*xx3*Math.cos((yy3)), endY: bind d*xx3*Math.sin((yy3)) strokeWidth: 3 stroke: Color.BLUE }, Text { font : Font { size: 12 } x: bind d*xx3*Math.cos((yy3)), y: bind d*xx3*Math.sin((yy3)) content: "ib" }, Text { font : Font { size: 12 } x:30 , y: 50 content: "Negative Squence" }, Circle { radius: 4 fill: Color.BLACK } ] } ] } }