<?xml version="1.0" encoding="UTF-8"?>
<Document>
 <Model version="4.8" build="4.8.2.10124">
    <Sidops>
<![CDATA[stepper_model 360 80
 description '<Information>
 <Description>
    <Version>4.8</Version>
<IsMainModel>1</IsMainModel>
    <LibraryPath>Motor\stepper_model.emx</LibraryPath>
  <TimeStamp>2020-7-23 10:54:47</TimeStamp>
</Description>
 <Attributes>
  <GlobalRelations>parameters 
	real I_phase = 3.4 {mH};
	real R_phase = 2.9 {ohm};
	real u_max = 3.4 {V};
	real RotorInertia = 5.6e-6 {kg.m2};
	real StepperMass = 0.29 {kg};
	real angle_step = 1.8 {deg};
	real n_phase = 2 {none};
	real fluxLinkage = 0.0022 {Wb};
	real detentTorque = 0.01 {N.m};
variables
	real omega;
	real p; // rotor division
initialequations
	p = 2 * pi / (2 * n_phase * angle_step);
	omega = 200;</GlobalRelations>
 </Attributes>
</Information>';
 type Submodel
  ports
   signal in angle;
   rotation out p;
 end;
 implementation bg
  submodels
   I 560 104
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\I.emx</LibraryPath>
  <TimeStamp>2011-11-29 15:55:55</TimeStamp>
</Description>
</Information>';
    type I
     ports
      power in p;
      signal out state;
     restrictions
      causality preferred in p;
    end;
    icon bg bottom
     figures
      text 'I' 560 104 color 0 18 bold;
    end;
    implementation eq
parameters
	real global I_phase;
equations
    state = int(p.e);
    p.f = state / I_phase;
implementation_end;
   I1 608 328
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\I.emx</LibraryPath>
  <TimeStamp>2011-11-29 15:55:55</TimeStamp>
</Description>
</Information>';
    type I
     ports
      power in p;
      signal out state;
     restrictions
      causality preferred in p;
    end;
    icon bg bottom
     figures
      text 'I' 608 328 color 0 18 bold;
    end;
    implementation eq
parameters
	real global I_phase;
equations
    state = int(p.e);
    p.f = state / I_phase;
implementation_end;
   I2 752 160
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\I.emx</LibraryPath>
  <TimeStamp>2011-11-29 15:55:55</TimeStamp>
</Description>
</Information>';
    type I
     ports
      power in p;
      signal out state;
     restrictions
      causality preferred in p;
    end;
    icon bg bottom
     figures
      text 'I' 752 160 color 0 18 bold;
    end;
    implementation eq
parameters
	real i = 8e-5 {kg.m2};
	real global RotorInertia;
equations
    state = int(p.e);
    p.f = state / (RotorInertia);
implementation_end;
   MGY_a 656 160
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\MGY.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:03:53</TimeStamp>
</Description>
</Information>';
    type MGY
     ports
      power in p1;
      power out p2;
      signal in r;
     restrictions
      causality constraint equal p1 p2;
    end;
    icon bg bottom
     figures
      text 'MGY' 656 160 color 0 18 bold;
    end;
    implementation eq
equations
	p1.e = r * p2.f;
	p2.e = r * p1.f;
implementation_end;
   MGY_b 656 272
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\MGY.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:03:53</TimeStamp>
</Description>
</Information>';
    type MGY
     ports
      power in p1;
      power out p2;
      signal in r;
     restrictions
      causality constraint equal p1 p2;
    end;
    icon bg bottom
     figures
      text 'MGY' 656 272 color 0 18 bold;
    end;
    implementation eq
equations
	p1.e = r * p2.f;
	p2.e = r * p1.f;
implementation_end;
   MSe_a 512 160
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\MSe.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:12:33</TimeStamp>
</Description>
</Information>';
    type MSe
     ports
      electric out p;
      signal in effort;
     restrictions
      causality fixed out p;
    end;
    icon bg bottom
     figures
      text 'MSe' 512 160 color 0 18 bold;
    end;
    implementation eq
variables
	real flow;
equations
	p.e = effort;
	flow = p.f;
implementation_end;
   MSe_b 512 272
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\MSe.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:12:33</TimeStamp>
</Description>
</Information>';
    type MSe
     ports
      electric out p;
      signal in effort;
     restrictions
      causality fixed out p;
    end;
    icon bg bottom
     figures
      text 'MSe' 512 272 color 0 18 bold;
    end;
    implementation eq
variables
	real flow;
equations
	p.e = effort;
	flow = p.f;
implementation_end;
   plug angle 200 216;
   plug p 1472 216;
   OneJunction1 840 216
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\OneJunction.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:17:51</TimeStamp>
</Description>
</Information>';
    knot OneJunction
     ports
      rotation knot duplicatable none p [1];
      signal knot out flow [1];
     restrictions
      causality constraint one_out p;
    end;
    icon bg
     figures
      text '1' 840 216 color 0 18 bold;
    end;
    implementation eq
equations
	sum (direct (p.e)) = 0;
	equal (collect (p.f));
	flow = first (p.f);
implementation_end;
   OneJunction2 584 160
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\OneJunction.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:17:51</TimeStamp>
</Description>
</Information>';
    knot OneJunction
     ports
      electric knot duplicatable none p [1];
      signal knot out flow [1];
     restrictions
      causality constraint one_out p;
    end;
    icon bg
     figures
      text '1' 584 160 color 0 18 bold;
    end;
    implementation eq
equations
	sum (direct (p.e)) = 0;
	equal (collect (p.f));
	flow = first (p.f);
implementation_end;
   OneJunction3 584 272
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\OneJunction.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:17:51</TimeStamp>
</Description>
</Information>';
    knot OneJunction
     ports
      electric knot duplicatable none p [1];
      signal knot out flow [1];
     restrictions
      causality constraint one_out p;
    end;
    icon bg
     figures
      text '1' 584 272 color 0 18 bold;
    end;
    implementation eq
equations
	sum (direct (p.e)) = 0;
	equal (collect (p.f));
	flow = first (p.f);
implementation_end;
   OneJunction4 752 216
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\OneJunction.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:17:51</TimeStamp>
</Description>
</Information>';
    knot OneJunction
     ports
      rotation knot duplicatable none p [1];
      signal knot out flow [1];
     restrictions
      causality constraint one_out p;
    end;
    icon bg
     figures
      text '1' 752 216 color 0 18 bold;
    end;
    implementation eq
equations
	sum (direct (p.e)) = 0;
	equal (collect (p.f));
	flow = first (p.f);
implementation_end;
   phase_control 512 216
    description '<Description><Version>4.0</Version>
   <LibraryPath>Template\Submodel-Equation.emx</LibraryPath>
<IsMainModel>1</IsMainModel>
 <KeepParameterValues>False</KeepParameterValues>
   <TimeStamp>2007-11-1 22:32:1</TimeStamp>
   <AllowLibraryUpdate>False</AllowLibraryUpdate>
</Description>';
    type Submodel
     ports
      signal in angle;
      signal out a;
      signal out b;
    end;
    icon bg
     figures
      rectangle 472 200 552 232 color 0 fill 15132390;
      text 'name' 512 216 color 0 'Clear Sans' 16;
    end;
    implementation eq
parameters
	real global u_max {V};
variables
	real global p;
	boolean hidden eventa, eventb;
equations
	a = u_max * (cos (p*angle));
	eventa = event(a);
	b = u_max * -(sin (p*angle));
	eventb = event(b);

	
	
 implementation_end;
   R 608 104
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\R.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:35:37</TimeStamp>
</Description>
</Information>';
    type R
     ports
      power in p;
    end;
    icon bg bottom
     figures
      text 'R' 608 104 color 0 18 bold;
    end;
    implementation eq
parameters
	real global R_phase;
equations
	p.e = R_phase * p.f;
implementation_end;
   R1 560 328
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\R.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:35:37</TimeStamp>
</Description>
</Information>';
    type R
     ports
      power in p;
    end;
    icon bg bottom
     figures
      text 'R' 560 328 color 0 18 bold;
    end;
    implementation eq
parameters
	real global R_phase;
equations
	p.e = R_phase * p.f;
implementation_end;
   R2 824 264
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\R.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:35:37</TimeStamp>
</Description>
</Information>';
    type R
     ports
      power in p;
    end;
    icon bg bottom
     figures
      text 'R' 824 264 color 0 18 bold;
    end;
    implementation eq
parameters
	real r = 1.0e-3;
equations
	p.e = r * p.f;
implementation_end;
   RotorAngle 656 216
    description '<Description><Version>4.0</Version>
   <LibraryPath>Template\Submodel-Equation.emx</LibraryPath>
<IsMainModel>1</IsMainModel>
 <KeepParameterValues>False</KeepParameterValues>
   <TimeStamp>2007-11-1 22:32:1</TimeStamp>
   <AllowLibraryUpdate>False</AllowLibraryUpdate>
</Description>';
    type Submodel
     ports
      signal out output_b;
      signal out output_a;
      signal in omega {rad/s} ;
      signal out output_d;
    end;
    icon bg
     figures
      rectangle 616 200 696 232 color 0 fill 15132390;
      text 'name' 656 216 color 0 'Clear Sans' 16;
    end;
    implementation eq
parameters
	real global fluxLinkage;
	real global detentTorque;
variables
	real global p;
	real angle {rad};
equations
	angle = int(omega);
	output_a = -p * fluxLinkage * sin(p * angle);
	output_b =  p * fluxLinkage * sin(p * angle - pi / 2);
	output_d =  detentTorque * sin(2 * p * angle);
 implementation_end;
   Se 752 272
    description '<Information>
 <Description>
    <Version>4.2</Version>
<IsMainModel>1</IsMainModel>
  <KeepParameterValues>False</KeepParameterValues>
    <LibraryPath>Bond Graph\MSe.emx</LibraryPath>
  <TimeStamp>2011-11-29 16:12:33</TimeStamp>
</Description>
</Information>';
    type MSe
     ports
      power out p;
      signal in effort;
     restrictions
      causality fixed out p;
    end;
    icon bg bottom
     figures
      text 'MSe' 752 272 color 0 18 bold;
    end;
    implementation eq

variables
	real flow;
equations
	p.e = effort;
	flow = p.f;
implementation_end;
  end;
  connections
   angle -> phase_control\angle;
   I2\p <= OneJunction4\p;
   MGY_a\p2 => OneJunction4\p;
   MGY_b\p2 => OneJunction4\p;
   MSe_b\p => OneJunction3\p;
   OneJunction1\p => p;
   OneJunction2\p <= MSe_a\p;
   OneJunction2\p => I\p;
   OneJunction2\p => MGY_a\p1;
   OneJunction2\p => R\p;
   OneJunction3\p => I1\p;
   OneJunction3\p => MGY_b\p1;
   OneJunction3\p => R1\p;
   OneJunction4\flow -> RotorAngle\omega;
   OneJunction4\p => OneJunction1\p;
   OneJunction4\p => R2\p;
   phase_control\a -> MSe_a\effort;
   phase_control\b -> MSe_b\effort;
   RotorAngle\output_a -> MGY_a\r;
   RotorAngle\output_b -> MGY_b\r;
   RotorAngle\output_d -> Se\effort;
   Se\p => OneJunction4\p;
  end;
 implementation_end;
]]>
  </Sidops>
</Model>
</Document>
