/* autogenerated from "macros/Electrical/IdealTransformer.sci" */ function IdealTransformer() { IdealTransformer.prototype.define = function IdealTransformer() { ModelName = "IdealTransformer"; PrametersValue = [1]; ParametersName = ["N"]; model = scicos_model(); Typein = []; Typeout = []; MI = []; MO = []; P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; PortName = [["p1"],["n1"],["p2"],["n2"]]; for (i=1;i<=size(P,"r");i+=1) { if (P[i-1][3-1]==1) { Typein = [[Typein],["E"]]; MI = [[MI],[PortName[i-1]]]; } if (P[i-1][3-1]==2) { Typein = [[Typein],["I"]]; MI = [[MI],[PortName[i-1]]]; } if (P[i-1][3-1]==-1) { Typeout = [[Typeout],["E"]]; MO = [[MO],[PortName[i-1]]]; } if (P[i-1][3-1]==-2) { Typeout = [[Typeout],["I"]]; MO = [[MO],[PortName[i-1]]]; } } model = scicos_model(); mo = modelica(); model.sim = ModelName; mo.inputs = MI; mo.outputs = MO; model.rpar = PrametersValue; mo.parameters = list(ParametersName,PrametersValue,zeros(ParametersName)); exprs = ["1"]; gr_i = []; model.blocktype = "c"; model.dep_ut = [false,true]; mo.model = ModelName; model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); this.x = standard_define([2,2],model,exprs,list(gr_i,0)); this.x.graphics.in_implicit = Typein; this.x.graphics.out_implicit = Typeout; return new BasicBlock(this.x); } IdealTransformer.prototype.details = function IdealTransformer() { return this.x; } IdealTransformer.prototype.get = function IdealTransformer() { var options = { N:["N",this.N], } return options; } IdealTransformer.prototype.set = function IdealTransformer() { this.N = parseFloat((arguments[0]["N"])) this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; this.x = arg1; exprs = this.x.graphics.exprs; while (true) { [ok,this.N,exprs] = scicos_getvalue([["Set Transformer block parameters:"],[""],["N:"+" Turn ratio (N1/N2)"]],["N"],list("vec",1),exprs); if (!ok) { break; } this.x.model.equations.parameters[2-1] = list(this.N); this.x.graphics.exprs = exprs; break; } return new BasicBlock(this.x); } }