Help - Search - Members - Calendar
Full Version: Problem with multiphase components
Modelica Forum > Modelica > Modelica
gaggio
Hi everyone! I am a new user of this forum (I'm kinda newby for Modelica too) and this is my first message. Obviously I write to get some help, but I hope I can soon contribute helping someone else.
I'm trying to write a model for a linear brushless motor, essentially adapting a model existing in Modelica Library 2.2.1. I think I managed to write some code that should be working. When I try to execute the simulation in Openmodelica 1.4.3, I get the following error.

CODE
record
    resultFile = "Simulation failed.
Type mismatch in equation {spacePhasorS.v[1],spacePhasorS.v[2],spacePhasorS.v[3]}=spacePhasorS.plug_p.pin.v - spacePhasorS.plug_n.pin.v of type Real(quantity="ElectricPotential", unit="V")[3]=Real


I think that the Openmodelica compiler has some problems with multiphase connectors, since I had to connect each phase of each multiphase component with a connect( , ) command. This seems to be a problem in the equations of Modelica.Electrical.Machines.Interfaces.SpacePhasor.

Any idea?

Thank you so much! smile.gif
Carsten
Hello Gaggio,

if it is a problem connected to OpenModelica, then I do not have enough experiences. But if it is more a problem with Modelica, then it would be nice if you can attach your model. That helps a lot and we even can check it with other tools (e.g. Dymola).

Your error message looks like, that the types of variables are different (Real and Modelica.SIunits.ElectricPotential (extending from type Real)) . As you might know Modelica introduces special types for physical units. They extend from type Real and including units. Strictly using that types, the tool is able to find physical model erros (e.g. an equation: mass = length x temperature is not correct and the tool can figure it out). In dymola you can enable/disable that check by the option Advanced.CheckUnits. In case it is enabled it prints warnings but no errors. But I do not know, how OpenModelica handle such cases.

Hope it helps for the beginning. Otherwise try to attach your model.

regards
Carsten
RungeZipperer
QUOTE(gaggio @ Jul 20 2007, 02:53 PM) *


CODE
record
    resultFile = "Simulation failed.
Type mismatch in equation {spacePhasorS.v[1],spacePhasorS.v[2],spacePhasorS.v[3]}=spacePhasorS.plug_p.pin.v - spacePhasorS.plug_n.pin.v of type Real(quantity="ElectricPotential", unit="V")[3]=Real




What kind of model is spacePhasorS? Why does the voltage have the dimension 3? The space phasor should only have the dimension 2 plus an extra zero component.
gaggio
spacePhasorS is a component of type Modelica.Electrical.Machines.SpacePhasors.Components.SpacePhasor, modelica library 2.2.1. If you look at the definition of this component, you can see that it has Modelica.Electrical.MultiPhase.Interfaces.PositivePlug and a Modelica.Electrical.MultiPhase.Interfaces.NegativePlug. These interfaces are the multiphase versions of positive and negative plugs, so each of them has an array of three pins.
As I mentioned, in OpenModelica I had problems also with the other multiphase plugs. So, for example I had to connect a multiphase inductor with a space phasor using:
CODE

connect(lssigma.plug_n.pin[1], spacePhasorS.plug_p.pin[1]);
connect(lssigma.plug_n.pin[2], spacePhasorS.plug_p.pin[2]);
connect(lssigma.plug_n.pin[3], spacePhasorS.plug_p.pin[3]);

instead of a single
CODE

connect(lssigma.plug_n, spacePhasorS.plug_p);

Maybe my problem is due to the same issue? Next I will attach the whole model, thank you very much for your effort in trying to solve this annoying problem!
RungeZipperer
QUOTE(gaggio @ Jul 23 2007, 03:58 PM) *

spacePhasorS is a component of type Modelica.Electrical.Machines.SpacePhasors.Components.SpacePhasor, modelica library 2.2.1. If you look at the definition of this component, you can see that it has Modelica.Electrical.MultiPhase.Interfaces.PositivePlug and a Modelica.Electrical.MultiPhase.Interfaces.NegativePlug. [...]


Sorry, stupid mistake, I only thought of the space phasor components itself and not of the "input" that is the normal three phase plug.

You should provide the whole model.
gaggio
Ok, that's my model. Let me first apologize because it will surely seem a mess to you. Indeed I am sure can make many things look and work better, but I need to be able to run it completely at least one time! Ok, here it is:
CODE

model BrushlessAndInverter "Motore lineare brushless azionato da un inverter"
  constant Integer m=3 "numero di fasi";
  parameter Modelica.SIunits.Voltage VNominal=100
    "voltaggio nominale RMS per fase";
  parameter Modelica.SIunits.Frequency fNominal=50
    "frequenza nominale di alimentazione";
  parameter Modelica.SIunits.Frequency f=50 "frequenza effettiva";
  parameter Modelica.SIunits.Time tRamp=1 "rampa di frequenza";
  //parameter Modelica.SIunits.Force F_Load=10 "forza nominale del carico";
  //parameter Modelica.SIunits.Time tStep=1.2 "tempo al quale si verifica il gradino di forza del carico";
  parameter Modelica.SIunits.Mass M_Load=1 "massa del carico";
  SynchronousInductionTranslationalMachine linearMotor;
  Modelica.Electrical.Machines.Sensors.CurrentRMSsensor currentRMSSensor;
  Modelica.Blocks.Sources.Ramp ramp(height=f, duration=tRamp);
  Modelica.Electrical.Machines.Examples.Utilities.VfController Vfcontroller1(
    final m=m,
    VNominal=VNominal,
    fNominal=fNominal,
    BasePhase=+Modelica.Constants.pi/2);
  Modelica.Electrical.MultiPhase.Sources.SignalVoltage SignalVoltage1(final m=m);
  Modelica.Electrical.MultiPhase.Basic.Star Star1(final m=m);
  Modelica.Electrical.Analog.Basic.Ground Ground1;
  Modelica.Mechanics.Translational.SlidingMass LoadMass(m=M_Load);
  Modelica.Electrical.Machines.Examples.Utilities.TerminalBox TerminalBox1;
equation
  connect(SignalVoltage1.plug_n, Star1.plug_p);
  connect(Star1.pin_n, Ground1.p);
  connect(ramp.y, VfController1.u);
  connect(VfController.y, SignalVoltage1.v);
  connect(SignalVoltage1.plug_p, currentRMSSensor.plug_p);
  connect(linearMotor.flange_a, LoadMass.flange_a);
  connect(TerminalBox1.negativeMachinePlug, linearMotor.plug_sn);
  connect(TerminalBox1.positiveMachinePlug, linearMotor.plug_sp);
  connect(TerminalBox1.plugToGrid, CurrentRMSSensor.plug_n);
  annotation (uses(Modelica(version="2.2.1")));
end BrushlessAndInverter;

model TranslationalAirGapR
  "Modello dell'airgap per motori lineari, sistema di coordinate fissato al rotore."
  constant Integer m=3 "numero di fasi";
  parameter Modelica.SIunits.Length Radius = 0.1
    "Raggio del rotore avvolto corrispondente";
  parameter Integer p(min=1) "numero di coppie polari";
  parameter Modelica.SIunits.Inductance Lmd "induttanza asse d";
  parameter Modelica.SIunits.Inductance Lmq "induttanza asse q";
  output Modelica.SIunits.Force F_electrical;
  Modelica.SIunits.Angle gamma "angolo di rotazione del rotore";
  Modelica.SIunits.Current i_ss[2]
    "corrente di statore rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.Current i_sr[2]
    "corrente di statore rispetto al sistema di riferimento del rotore";
  Modelica.SIunits.Current i_rs[2]
    "corrente di rotore rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.Current i_rr[2]
    "corrente di rotore rispetto al sistema di riferimento del rotore";
  Modelica.SIunits.Current i_mr[2]
    "corrente di magnetizzazione rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.MagneticFlux psi_ms[2]
    "flusso magnetico rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.MagneticFlux psi_mr[2]
    "flusso magnetico rispetto al sistema di riferimento del rotore";
  Real RotationMatrix[2,2] "matrix of rotation from rotor to stator";
protected
  parameter Modelica.SIunits.Inductance L[2,2]={{Lmd,0},{0,Lmd}}
    "matrice di induttanza";
public
  Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a;
  Modelica.Mechanics.Translational.Interfaces.Flange_a support
    "supporto sul quale agisce la forza motrice";
  Modelica.Electrical.Machines.Interfaces.SpacePhasor spacePhasor_s;
  Modelica.Electrical.Machines.Interfaces.SpacePhasor spacePhasor_r;
equation
  //Angolo meccanico corrispondente alla traslazione relativa di pattino e guida.
  gamma = p*(flange_a.s - support.s)/Radius;
  RotationMatrix = {{+cos(gamma), -sin(gamma)},{+sin(gamma),+cos(gamma)}};
  i_ss = spacePhasor_s.i_;
  i_ss = RotationMatrix*i_sr;
  i_rr = spacePhasor_r.i_;
  i_rs = RotationMatrix*i_rr;
  i_mr = i_sr + i_rr;
  psi_mr = L*i_mr;
  psi_ms = RotationMatrix*psi_mr;
  spacePhasor_s.v_ = der(psi_ms);
  spacePhasor_r.v_ = der(psi_mr);
  F_electrical = m/2*p*(spacePhasor_s.i_[2]*psi_ms[1] - spacePhasor_s.i_[1]*psi_ms[2]);
  flange_a.f = -F_electrical;
  support.f = F_electrical;
  annotation (uses(Modelica(version="2.2.1")));
end TranslationalAirGapR;

partial model PartialBasicTranslationalMachine
  "Partial model per macchina elettrica lineare"
  parameter Modelica.SIunits.Mass M_carriage "Massa del pattino traslante";
  output Modelica.SIunits.Position s = SlidingMass1.s "Posizione del pattino";
  output Modelica.SIunits.Velocity v = SlidingMass1.v "Velocita  del pattino";
  output Modelica.SIunits.Force F_electrical = SlidingMass1.flange_a.f
    "Forza elettromagnetica applicata al pattino";
  output Modelica.SIunits.Force F_flange = -flange_a.f
    "Forza ottenuta alla flangia del carrello";
  Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a
    "Flangia del carrello";
  Modelica.Mechanics.Translational.SlidingMass SlidingMass1(final m=M_carriage);
  Modelica.Mechanics.Translational.Fixed FixedGuide(final s0=0);
protected
  Modelica.Mechanics.Translational.Interfaces.Flange_b internalSupport;
equation
  connect(SlidingMass1.flange_b, flange_a);
  connect(internalSupport, FixedGuide.flange_b);
  annotation (uses(Modelica(version="2.2.1")));
end PartialBasicTranslationalMachine;

partial model PartialBasicInductionTranslationalMachine
  "Partial model per macchina elettrica lineare a induzione"
  extends PartialBasicTranslationalMachine(M_carriage=1);
  constant Real pi=Modelica.Constants.pi;
  constant Integer m=3 "Numero di fasi";
  parameter Integer p(min=1)=2 "numero di coppie polari";
  //output Modelica.SIunits.Voltage vs[m]=plug_sp.pin.v - plug_sn.pin.v
  output Modelica.SIunits.Voltage vs[1]=plug_sp.pin[1].v - plug_sn.pin[1].v
  output Modelica.SIunits.Voltage vs[2]=plug_sp.pin[2].v - plug_sn.pin[2].v
  output Modelica.SIunits.Voltage vs[3]=plug_sp.pin[3].v - plug_sn.pin[3].v
    "voltaggi istantanei allo statore";
  //output Modelica.SIunits.Current is[m]=plug_sp.pin.i
  output Modelica.SIunits.Current is[1]=plug_sp.pin[1].i
  output Modelica.SIunits.Current is[2]=plug_sp.pin[2].i
  output Modelica.SIunits.Current is[3]=plug_sp.pin[3].i
    "corrente istantanea allo statore";
  Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plug_sp(final m=m);
  Modelica.Electrical.MultiPhase.Interfaces.NegativePlug plug_sn(final m=m);
  annotation (uses(Modelica(version="2.2.1")));
end PartialBasicInductionTranslationalMachine;

model SynchronousInductionTranslationalMachine
  extends PartialBasicInductionTranslationalMachine;
  parameter Modelica.SIunits.Frequency fNominal=50
    "Frequenza nominale di eccitazione";
  parameter Modelica.SIunits.Voltage V0=112.3
    "Voltaggio nominale RMS no-load, per fase";
  parameter Modelica.SIunits.Resistance Rs=0.03
    "Resistenza di statore, per fase";
  parameter Modelica.SIunits.Inductance Lssigma=0.1/(2*pi*fNominal)
    "Stray inductance di statore, per fase";
  parameter Modelica.SIunits.Inductance Lmd=0.3/(2*pi*fNominal)
    "Induttanza in direzione d";
  parameter Modelica.SIunits.Inductance Lmq=0.3/(2*pi*fNominal)
    "Induttanza in direzione q";
  output Modelica.SIunits.Current i_0_s(stateSelect=StateSelect.prefer)=spacePhasorS.zero.i
    "Corrente al terminale zero dello statore";
  output Modelica.SIunits.Current idq_ss[2] = airGapR.i_ss
    "Corrente di statore, riferimento fisso sullo statore";
  output Modelica.SIunits.Current idq_sr[2](each stateSelect=StateSelect.prefer)=airGapR.i_sr
    "Corrente di statore, riferimento fisso sul rotore";
protected
  parameter Modelica.SIunits.Current Ie=sqrt(2)*V0/(Lmd*2*pi*fNominal)
    "Corrente di eccitazione equivalente";
public
  Modelica.Electrical.MultiPhase.Basic.Resistor rs(final m=m, final R=fill(Rs, m));
  Modelica.Electrical.MultiPhase.Basic.Inductor lssigma(final m=m, final L=fill(Lssigma, m));
  Modelica.Electrical.Machines.SpacePhasors.Components.SpacePhasor spacePhasorS;
  TranslationalAirGapR airGapR(
    final p=p,
    final Lmd=Lmd,
    final Lmq=Lmq);
  Modelica.Electrical.Machines.BasicMachines.Components.PermanentMagnet
    permanentMagnet(                                                                    Ie=Ie);
equation
  connect(rs.plug_n, lssigma.plug_p);
  // controllare sezione seguente
  connect(lssigma.plug_n.pin[1], spacePhasorS.plug_p.pin[1]);
  connect(lssigma.plug_n.pin[2], spacePhasorS.plug_p.pin[2]);
  connect(lssigma.plug_n.pin[3], spacePhasorS.plug_p.pin[3]);
  //
  connect(rs.plug_p, plug_sp);
  // controllare sezione seguente
  connect(spacePhasorS.plug_n.pin[1], plug_sn.pin[1]);
  connect(spacePhasorS.plug_n.pin[2], plug_sn.pin[2]);
  connect(spacePhasorS.plug_n.pin[3], plug_sn.pin[3]);
  //
  connect(spacePhasorS.ground, spacePhasorS.zero);
  connect(spacePhasorS.spacePhasor, TranslationalAirGapR.spacePhasor_s);
  connect(TranslationalAirGapR.flange_a, SlidingMass1.flange_a);
  connect(TranslationalAirGapR.support, internalSupport);
  connect(TranslationalAirGapR.spacePhasor_r, permanentMagnet.spacePhasor_r);
  annotation (uses(Modelica(version="2.2.1")));
end SynchronousInductionTranslationalMachine;

As you can see the main model is BrushlessAndInverter, which I try to simulate with
CODE
simulate(BrushlessAndInverter, stopTime=10)

Sorry for the italian language I used for the comments...
Thank you!
tshort
I think you're right in that the problem is with connect's and plugs. I had the same problem. See my post to the openmodelica mailing list and a response:

My posting

Adrian Pop's response

I also tried your models in Dymola. You have some syntax problems on these lines:

//output Modelica.SIunits.Voltage vs[m]=plug_sp.pin.v - plug_sn.pin.v
output Modelica.SIunits.Voltage vs[1]=plug_sp.pin[1].v - plug_sn.pin[1].v
output Modelica.SIunits.Voltage vs[2]=plug_sp.pin[2].v - plug_sn.pin[2].v
output Modelica.SIunits.Voltage vs[3]=plug_sp.pin[3].v - plug_sn.pin[3].v
"voltaggi istantanei allo statore";
//output Modelica.SIunits.Current is[m]=plug_sp.pin.i
output Modelica.SIunits.Current is[1]=plug_sp.pin[1].i
output Modelica.SIunits.Current is[2]=plug_sp.pin[2].i
output Modelica.SIunits.Current is[3]=plug_sp.pin[3].i


I tried a couple of ways of fixing but didn't get anything to compile correctly (just adding the semicolons isn't enough).

- Tom
Carsten
Hi,

if you define an array of output variables, you can only declare it once! That mean you have to transfrom the equations:

QUELLTEXT
  output Modelica.SIunits.Voltage vs[1]=plug_sp.pin[1].v - plug_sn.pin[1].v
  output Modelica.SIunits.Voltage vs[2]=plug_sp.pin[2].v - plug_sn.pin[2].v
  output Modelica.SIunits.Voltage vs[3]=plug_sp.pin[3].v - plug_sn.pin[3].v
    "voltaggi istantanei allo statore";


to

QUELLTEXT

  output Modelica.SIunits.Voltage vs[3]={plug_sp.pin[i].v - plug_sn.pin[i].v for i in 1:3}
    "voltaggi istantanei allo statore";


or
QUELLTEXT

  output Modelica.SIunits.Voltage vs[3]={plug_sp.pin[1].v - plug_sn.pin[1].v, plug_sp.pin[2].v - plug_sn.pin[2].v, plug_sp.pin[3].v - plug_sn.pin[3].v }
    "voltaggi istantanei allo statore";


regards
Carsten
gaggio
Hi everyone, thanks to your suggestions I managed to correct some of the errors of my model. By the way, I also had to write a slightly different SpacePhasor model to make it work. Its equations had to be rewritten explicitly for each phase instead than only once.

However I can't get any result: the simulation fails even this time, but with no error message from the compiler. How can I find the problem now?

Thank you once more! smile.gif
tshort
Sometimes, it returns but doesn't show anything. That's often an indication of an error. You can try typing the following at the command prompt to show error messages:

getErrorString()

You also may want to try the OpenModelica mailing list for further help:

Archives are at:

http://news.gmane.org/gmane.comp.misc.openmodelica

Info on signing up at:

http://www.ida.liu.se/labs/pelab/modelica/...lica.html#Forum

- Tom
gaggio
QUOTE(tshort @ Sep 13 2007, 05:06 PM) *

Sometimes, it returns but doesn't show anything. That's often an indication of an error. You can try typing the following at the command prompt to show error messages:

getErrorString()


I tried but I only get:

CODE
>> getErrorString()
"Variable getErrorString not found in scope <global scope>
"


If it can be useful, I can post the model as it is now, with the discussed corrections... I really hope someone can find where the problem is, or at least try to run the simulation in dymola just to know if it's openmodelica's fault.

Thank you again, I'll post the new one
gaggio
Here is the actual model which doesn't run, without any useful error message:

CODE
model BrushlessAndInverter "Motore lineare brushless azionato da un inverter"
  constant Integer m=3 "numero di fasi";
  parameter Modelica.SIunits.Voltage VNominal=100
    "voltaggio nominale RMS per fase";
  parameter Modelica.SIunits.Frequency fNominal=50
    "frequenza nominale di alimentazione";
  parameter Modelica.SIunits.Frequency f=50 "frequenza effettiva";
  parameter Modelica.SIunits.Time tRamp=1 "rampa di frequenza";
  parameter Modelica.SIunits.Mass M_Load=1 "massa del carico";
  SynchronousInductionTranslationalMachine linearMotor;
  Modelica.Electrical.Machines.Sensors.CurrentRMSsensor currentRMSSensor;
  Modelica.Blocks.Sources.Ramp ramp(height=f, duration=tRamp);
  Modelica.Electrical.Machines.Examples.Utilities.VfController Vfcontroller1(
    final m=m,
    VNominal=VNominal,
    fNominal=fNominal,
    BasePhase=+Modelica.Constants.pi/2);
  Modelica.Electrical.MultiPhase.Sources.SignalVoltage SignalVoltage1(final m=m);
  Modelica.Electrical.MultiPhase.Basic.Star Star1(final m=m);
  Modelica.Electrical.Analog.Basic.Ground Ground1;
  Modelica.Mechanics.Translational.SlidingMass LoadMass(m=M_Load);
  Modelica.Electrical.Machines.Examples.Utilities.TerminalBox TerminalBox1;
equation
  connect(SignalVoltage1.plug_n, Star1.plug_p);
  connect(Star1.pin_n, Ground1.p);
  connect(ramp.y, VfController1.u);
  connect(VfController.y, SignalVoltage1.v);
  connect(SignalVoltage1.plug_p, currentRMSSensor.plug_p);
  connect(linearMotor.flange_a, LoadMass.flange_a);
  connect(TerminalBox1.negativeMachinePlug, linearMotor.plug_sn);
  connect(TerminalBox1.positiveMachinePlug, linearMotor.plug_sp);
  connect(TerminalBox1.plugToGrid, CurrentRMSSensor.plug_n);
  annotation (uses(Modelica(version="2.2.1")));
end BrushlessAndInverter;

model SynchronousInductionTranslationalMachine
  extends PartialBasicInductionTranslationalMachine;
  parameter Modelica.SIunits.Frequency fNominal=50
    "Frequenza nominale di eccitazione";
  parameter Modelica.SIunits.Voltage V0=112.3
    "Voltaggio nominale RMS no-load, per fase";
  parameter Modelica.SIunits.Resistance Rs=0.03
    "Resistenza di statore, per fase";
  parameter Modelica.SIunits.Inductance Lssigma=0.1/(2*pi*fNominal)
    "Stray inductance di statore, per fase";
  parameter Modelica.SIunits.Inductance Lmd=0.3/(2*pi*fNominal)
    "Induttanza in direzione d";
  parameter Modelica.SIunits.Inductance Lmq=0.3/(2*pi*fNominal)
    "Induttanza in direzione q";
  output Modelica.SIunits.Current i_0_s(stateSelect=StateSelect.prefer)=spacePhasorS.zero.i
    "Corrente al terminale zero dello statore";
  output Modelica.SIunits.Current idq_ss[2] = airGapR.i_ss
    "Corrente di statore, riferimento fisso sullo statore";
  output Modelica.SIunits.Current idq_sr[2](each stateSelect=StateSelect.prefer)=airGapR.i_sr
    "Corrente di statore, riferimento fisso sul rotore";
protected
  parameter Modelica.SIunits.Current Ie=sqrt(2)*V0/(Lmd*2*pi*fNominal)
    "Corrente di eccitazione equivalente";
public
  Modelica.Electrical.MultiPhase.Basic.Resistor rs(final m=m, final R=fill(Rs, m));
  Modelica.Electrical.MultiPhase.Basic.Inductor lssigma(final m=m, final L=fill(Lssigma, m));
  MySpacePhasor spacePhasorS;
  TranslationalAirGapR airGapR(
    final p=p,
    final Lmd=Lmd,
    final Lmq=Lmq);
  Modelica.Electrical.Machines.BasicMachines.Components.PermanentMagnet
    permanentMagnet(                                                                    Ie=Ie);
equation
  connect(rs.plug_n, lssigma.plug_p);
  connect(lssigma.plug_n.pin[1], spacePhasorS.plug_p.pin[1]);
  connect(lssigma.plug_n.pin[2], spacePhasorS.plug_p.pin[2]);
  connect(lssigma.plug_n.pin[3], spacePhasorS.plug_p.pin[3]);
  connect(rs.plug_p, plug_sp);
  connect(spacePhasorS.plug_n.pin[1], plug_sn.pin[1]);
  connect(spacePhasorS.plug_n.pin[2], plug_sn.pin[2]);
  connect(spacePhasorS.plug_n.pin[3], plug_sn.pin[3]);
  connect(spacePhasorS.ground, spacePhasorS.zero);
  connect(spacePhasorS.spacePhasor, TranslationalAirGapR.spacePhasor_s);
  connect(TranslationalAirGapR.flange_a, SlidingMass1.flange_a);
  connect(TranslationalAirGapR.support, internalSupport);
  connect(TranslationalAirGapR.spacePhasor_r, permanentMagnet.spacePhasor_r);
  annotation (uses(Modelica(version="2.2.1")));
end SynchronousInductionTranslationalMachine;

partial model PartialBasicInductionTranslationalMachine
  "Partial model per macchina elettrica lineare a induzione"
  extends PartialBasicTranslationalMachine(M_carriage=1);
  constant Real pi=Modelica.Constants.pi;
  constant Integer m=3 "Numero di fasi";
  parameter Integer p(min=1)=2 "numero di coppie polari";
  output Modelica.SIunits.Voltage vs[3]={plug_sp.pin[1].v - plug_sn.pin[1].v, plug_sp.pin[2].v - plug_sn.pin[2].v, plug_sp.pin[3].v - plug_sn.pin[3].v };
  output Modelica.SIunits.Voltage is[m]={plug_sp.pin[1].i, plug_sp.pin[2].i, plug_sp.pin[3].i };
  Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plug_sp(final m=m);
  Modelica.Electrical.MultiPhase.Interfaces.NegativePlug plug_sn(final m=m);
  annotation (uses(Modelica(version="2.2.1")));
end PartialBasicInductionTranslationalMachine;

partial model PartialBasicTranslationalMachine
  "Partial model per macchina elettrica lineare"
  parameter Modelica.SIunits.Mass M_carriage "Massa del pattino traslante";
  output Modelica.SIunits.Position s = SlidingMass1.s "Posizione del pattino";
  output Modelica.SIunits.Velocity v = SlidingMass1.v "Velocità  del pattino";
  output Modelica.SIunits.Force F_electrical = SlidingMass1.flange_a.f
    "Forza elettromagnetica applicata al pattino";
  output Modelica.SIunits.Force F_flange = -flange_a.f
    "Forza ottenuta alla flangia del carrello";
  Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a
    "Flangia del carrello";
  Modelica.Mechanics.Translational.SlidingMass SlidingMass1(final m=M_carriage);
  Modelica.Mechanics.Translational.Fixed FixedGuide(final s0=0);
protected
  Modelica.Mechanics.Translational.Interfaces.Flange_b internalSupport;
equation
  connect(SlidingMass1.flange_b, flange_a);
  connect(internalSupport, FixedGuide.flange_b);
  annotation (uses(Modelica(version="2.2.1")));
end PartialBasicTranslationalMachine;

model TranslationalAirGapR
  "Modello dell'airgap per motori lineari, sistema di coordinate fissato al rotore."
  constant Integer m=3 "numero di fasi";
  parameter Modelica.SIunits.Length Radius = 0.1
    "Raggio del rotore avvolto corrispondente";
  parameter Integer p(min=1) "numero di coppie polari";
  parameter Modelica.SIunits.Inductance Lmd "induttanza asse d";
  parameter Modelica.SIunits.Inductance Lmq "induttanza asse q";
  output Modelica.SIunits.Force F_electrical;
  Modelica.SIunits.Angle gamma "angolo di rotazione del rotore";
  Modelica.SIunits.Current i_ss[2]
    "corrente di statore rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.Current i_sr[2]
    "corrente di statore rispetto al sistema di riferimento del rotore";
  Modelica.SIunits.Current i_rs[2]
    "corrente di rotore rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.Current i_rr[2]
    "corrente di rotore rispetto al sistema di riferimento del rotore";
  Modelica.SIunits.Current i_mr[2]
    "corrente di magnetizzazione rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.MagneticFlux psi_ms[2]
    "flusso magnetico rispetto al sistema di riferimento dello statore";
  Modelica.SIunits.MagneticFlux psi_mr[2]
    "flusso magnetico rispetto al sistema di riferimento del rotore";
  Real RotationMatrix[2,2] "matrix of rotation from rotor to stator";
protected
  parameter Modelica.SIunits.Inductance L[2,2]={{Lmd , 0.0} , {0.0 , Lmd}}
    "matrice di induttanza";
public
  Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a;
  Modelica.Mechanics.Translational.Interfaces.Flange_a support
    "supporto sul quale agisce la forza motrice";
  Modelica.Electrical.Machines.Interfaces.SpacePhasor spacePhasor_s;
  Modelica.Electrical.Machines.Interfaces.SpacePhasor spacePhasor_r;
equation
  //Angolo meccanico corrispondente alla traslazione relativa di pattino e guida.
  gamma = p*(flange_a.s - support.s)/Radius;
  RotationMatrix = {{+cos(gamma), -sin(gamma)},{+sin(gamma),+cos(gamma)}};
  i_ss = spacePhasor_s.i_;
  i_ss = RotationMatrix*i_sr;
  i_rr = spacePhasor_r.i_;
  i_rs = RotationMatrix*i_rr;
  i_mr = i_sr + i_rr;
  psi_mr = L*i_mr;
  psi_ms = RotationMatrix*psi_mr;
  spacePhasor_s.v_ = der(psi_ms);
  spacePhasor_r.v_ = der(psi_mr);
  F_electrical = m/2*p*(spacePhasor_s.i_[2]*psi_ms[1] - spacePhasor_s.i_[1]*psi_ms[2]);
  flange_a.f = -F_electrical;
  support.f = F_electrical;
  annotation (uses(Modelica(version="2.2.1")));
end TranslationalAirGapR;

model MySpacePhasor
  "Physical transformation: three phase <-> space phasors"
  constant Integer m=3 "number of phases";
  constant Real pi=Modelica.Constants.pi;
  Modelica.SIunits.Voltage v[m] "instantaneous phase voltages";
  Modelica.SIunits.Current i[m] "instantaneous phase currents";
protected
  parameter Real TransformationMatrix[ 2, m]=2/m*
    {{cos(+(k - 1)/m*2*pi) for k in 1:m}, {+sin(+(k - 1)/m*2*pi) for k in 1:m}};
  parameter Real InverseTransformation[m, 2]=
    {{cos(-(k - 1)/m*2*pi), -sin(-(k - 1)/m*2*pi)} for k in 1:m};
public
  Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plug_p(final m=m);
  Modelica.Electrical.MultiPhase.Interfaces.NegativePlug plug_n(final m=m);
  Modelica.Electrical.Analog.Interfaces.PositivePin zero;
  Modelica.Electrical.Analog.Interfaces.NegativePin ground;
  Modelica.Electrical.Analog.Basic.Ground gnd;
  Modelica.Electrical.Machines.Interfaces.SpacePhasor spacePhasor;
equation
  v = {plug_p.pin[1].v - plug_n.pin[1].v, plug_p.pin[2].v - plug_n.pin[2].v, plug_p.pin[3].v - plug_n.pin[3].v};
  i = {+plug_p.pin[1].i, +plug_p.pin[2].i, +plug_p.pin[3].i};
  i = {-plug_n.pin[1].i, -plug_n.pin[2].i, -plug_n.pin[3].i};
  zero.v = 1/m*sum(v);
  spacePhasor.v_ = TransformationMatrix *v;
  -zero.i = 1/m*sum(i);
  -spacePhasor.i_ = TransformationMatrix *i;
  connect(gnd.p, ground);
end MySpacePhasor;


Thank you again for your precious help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.