📄 dsmodel.c
字号:
DeclareParameter("motor.Ra.R", "Resistance [Ohm]", 2, 0.5, 0.0,1E+100,0.0,0,624)
DeclareVariable("motor.La.v", "Voltage drop between the two pins (= p.v - n.v) [V]",\
0, 0.0,0.0,0.0,0,576)
DeclareState("motor.La.i", "Current flowing from pin p to pin n [A]", 0, 0, \
0.0,0.0,0.0,0,624)
DeclareDerivative("motor.La.der(i)", "der(Current flowing from pin p to pin n) [A/s]",\
0, 0.0,0.0,0.0,0,576)
DeclareAlias2("motor.La.p.v", "Potential at the pin [V]", "motor.Ra.n.v", 1, 5, 5,\
4)
DeclareAlias2("motor.La.p.i", "Current flowing into the pin [A]", "motor.La.i", 1,\
1, 0, 132)
DeclareAlias2("motor.La.n.v", "Potential at the pin [V]", "motor.emf.v", 1, 5, 7,\
4)
DeclareAlias2("motor.La.n.i", "Current flowing into the pin [A]", "motor.La.i", -1,\
1, 0, 132)
DeclareParameter("motor.La.L", "Inductance [H]", 3, 0.05, 0.0,0.0,0.0,0,624)
DeclareParameter("motor.emf.k", "Transformation coefficient [N.m/A]", 4, 1, \
0.0,0.0,0.0,0,624)
DeclareVariable("motor.emf.v", "Voltage drop between the two pins [V]", 0, \
0.0,0.0,0.0,0,576)
DeclareAlias2("motor.emf.i", "Current flowing from positive to negative pin [A]",\
"motor.La.i", 1, 1, 0, 0)
DeclareAlias2("motor.emf.w", "Angular velocity of flange_b [rad/s]", \
"motor.Jm.der(phi)", 1, 5, 11, 0)
DeclareAlias2("motor.emf.p.v", "Potential at the pin [V]", "motor.emf.v", 1, 5, 7,\
4)
DeclareAlias2("motor.emf.p.i", "Current flowing into the pin [A]", "motor.La.i", 1,\
1, 0, 132)
DeclareVariable("motor.emf.n.v", "Potential at the pin [V]", 0, 0.0,0.0,0.0,0,521)
DeclareAlias2("motor.emf.n.i", "Current flowing into the pin [A]", "motor.La.i", -1,\
1, 0, 132)
DeclareAlias2("motor.emf.flange_b.phi", "Absolute rotation angle of flange [rad]",\
"motor.Jm.phi", 1, 5, 10, 4)
DeclareAlias2("motor.emf.flange_b.der(phi)", "der(Absolute rotation angle of flange) [rad/s]",\
"motor.Jm.der(phi)", 1, 5, 11, 4)
DeclareAlias2("motor.emf.flange_b.tau", "Cut torque in the flange [N.m]", \
"motor.Jm.flange_a.tau", -1, 5, 12, 132)
DeclareVariable("motor.inPort.n", "Dimension of signal vector", 1, 0.0,0.0,0.0,0,525)
DeclareAlias2("motor.inPort.signal[1]", "Real input signals", "controller.outPort.signal[1]", 1,\
5, 31, 4)
DeclareVariable("motor.Jm.phi", "Absolute rotation angle of component (= flange_a.phi = flange_b.phi) [rad]",\
0, 0.0,0.0,0.0,0,576)
DeclareVariable("motor.Jm.der(phi)", "der(Absolute rotation angle of component (= flange_a.phi = flange_b.phi)) [rad/s]",\
0, 0.0,0.0,0.0,0,576)
DeclareAlias2("motor.Jm.flange_a.phi", "Absolute rotation angle of flange [rad]",\
"motor.Jm.phi", 1, 5, 10, 4)
DeclareVariable("motor.Jm.flange_a.tau", "Cut torque in the flange [N.m]", 0, \
0.0,0.0,0.0,0,840)
DeclareAlias2("motor.Jm.flange_b.phi", "Absolute rotation angle of flange [rad]",\
"motor.Jm.phi", 1, 5, 10, 4)
DeclareAlias2("motor.Jm.flange_b.tau", "Cut torque in the flange [N.m]", \
"gearbox.flange_a.tau", -1, 5, 14, 132)
DeclareParameter("motor.Jm.J", "Moment of inertia [kg.m2]", 5, 0.001, 0.0,0.0,\
0.0,0,624)
DeclareAlias2("motor.Jm.w", "Absolute angular velocity of component [rad/s]", \
"motor.Jm.der(phi)", 1, 5, 11, 0)
DeclareVariable("motor.Jm.der(w)", "der(Absolute angular velocity of component) [rad/s/s]",\
0, 0.0,0.0,0.0,0,576)
DeclareAlias2("motor.Jm.a", "Absolute angular acceleration of component [rad/s2]",\
"motor.Jm.der(w)", 1, 5, 13, 0)
DeclareAlias2("motor.flange_b.phi", "Absolute rotation angle of flange [rad]", \
"motor.Jm.phi", 1, 5, 10, 4)
DeclareAlias2("motor.flange_b.tau", "Cut torque in the flange [N.m]", \
"gearbox.flange_a.tau", -1, 5, 14, 132)
DeclareAlias2("gearbox.flange_a.phi", "Absolute rotation angle of flange [rad]",\
"motor.Jm.phi", 1, 5, 10, 4)
DeclareVariable("gearbox.flange_a.tau", "Cut torque in the flange [N.m]", 0, \
0.0,0.0,0.0,0,840)
DeclareAlias2("gearbox.flange_b.phi", "Absolute rotation angle of flange [rad]",\
"load.phi", 1, 1, 1, 4)
DeclareVariable("gearbox.flange_b.tau", "Cut torque in the flange [N.m]", 0, \
0.0,0.0,0.0,0,840)
DeclareVariable("gearbox.tau_support", "[N.m]", 0, 0.0,0.0,0.0,0,576)
DeclareVariable("gearbox.bearing.phi", "Absolute rotation angle of flange [rad]",\
0, 0.0,0.0,0.0,0,521)
DeclareVariable("gearbox.bearing.tau", "Cut torque in the flange [N.m]", 0, \
0.0,0.0,0.0,0,777)
DeclareAlias2("gearbox.phi_a", "[rad]", "motor.Jm.phi", 1, 5, 10, 0)
DeclareAlias2("gearbox.phi_b", "[rad]", "load.phi", 1, 1, 1, 0)
DeclareParameter("gearbox.ratio", "Transmission ratio (flange_a.phi/flange_b.phi)",\
6, 100, 0.0,0.0,0.0,0,624)
DeclareState("load.phi", "Absolute rotation angle of component (= flange_a.phi = flange_b.phi) [rad]",\
1, 0, 0.0,0.0,0.0,0,624)
DeclareDerivative("load.der(phi)", "der(Absolute rotation angle of component (= flange_a.phi = flange_b.phi)) [rad/s]",\
0, 0.0,0.0,0.0,0,576)
DeclareAlias2("load.flange_a.phi", "Absolute rotation angle of flange [rad]", \
"load.phi", 1, 1, 1, 4)
DeclareAlias2("load.flange_a.tau", "Cut torque in the flange [N.m]", \
"gearbox.flange_b.tau", -1, 5, 15, 132)
DeclareAlias2("load.flange_b.phi", "Absolute rotation angle of flange [rad]", \
"load.phi", 1, 1, 1, 4)
DeclareVariable("load.flange_b.tau", "Cut torque in the flange [N.m]", 0, \
0.0,0.0,0.0,0,777)
DeclareVariable("load.J", "Moment of inertia [kg.m2]", 0, 0.0,0.0,0.0,0,577)
DeclareState("load.w", "Absolute angular velocity of component [rad/s]", 2, 0, \
0.0,0.0,0.0,0,624)
DeclareDerivative("load.der(w)", "der(Absolute angular velocity of component) [rad/s/s]",\
0, 0.0,0.0,0.0,0,576)
DeclareAlias2("load.a", "Absolute angular acceleration of component [rad/s2]", \
"load.der(w)", 1, 6, 2, 0)
DeclareAlias2("phiload.flange_a.phi", "Absolute rotation angle of flange [rad]",\
"load.phi", 1, 1, 1, 4)
DeclareVariable("phiload.flange_a.tau", "Cut torque in the flange [N.m]", 0, \
0.0,0.0,0.0,0,777)
DeclareVariable("phiload.outPort.n", "Dimension of signal vector", 1, 0.0,0.0,\
0.0,0,525)
DeclareVariable("phiload.outPort.signal[1]", "Real output signals", 0, 0.0,0.0,\
0.0,0,584)
DeclareAlias2("phiload.phi", "Absolute angle of flange [rad]", "load.phi", 1, 1,\
1, 0)
DeclareVariable("positionerror.n", "size of input and feedback signal", 1, \
0.0,0.0,0.0,0,517)
DeclareVariable("positionerror.inPort1.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("positionerror.inPort1.signal[1]", "Real input signals", \
"Step1.outPort.signal[1]", 1, 5, 63, 68)
DeclareVariable("positionerror.inPort2.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("positionerror.inPort2.signal[1]", "Real input signals", \
"load.phi", 1, 1, 1, 4)
DeclareVariable("positionerror.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("positionerror.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareVariable("controller.inPort.n", "Dimension of signal vector", 1, 0.0,0.0,\
0.0,0,525)
DeclareAlias2("controller.inPort.signal[1]", "Real input signals", \
"positionerror.outPort.signal[1]", 1, 5, 28, 4)
DeclareVariable("controller.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("controller.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareVariable("controller.y", "", 0, 0.0,0.0,0.0,0,576)
DeclareAlias2("controller.u", "", "positionerror.outPort.signal[1]", 1, 5, 28, 1024)
DeclareParameter("controller.k", "Gain", 7, 1, 0.0,0.0,0.0,0,624)
DeclareParameter("controller.Ti", "Time Constant of Integrator [s]", 8, 0.5, \
1E-060,1E+100,0.0,0,624)
DeclareParameter("controller.Td", "Time Constant of Derivative block [s]", 9, \
0.1, 0.0,1E+100,0.0,0,624)
DeclareParameter("controller.Nd", "The higher Nd, the more ideal the derivative block",\
10, 10, 1E-060,1E+100,0.0,0,624)
DeclareParameter("controller.P.k[1]", "Gain vector multiplied element-wise with input vector",\
11, 1, 0.0,0.0,0.0,0,624)
DeclareAlias2("controller.P.u[1]", "Input signals", "positionerror.outPort.signal[1]", 1,\
5, 28, 1024)
DeclareAlias2("controller.P.y[1]", "Output signals", "controller.P.outPort.signal[1]", 1,\
5, 35, 1024)
DeclareVariable("controller.P.inPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.P.inPort.signal[1]", "Real input signals", \
"positionerror.outPort.signal[1]", 1, 5, 28, 4)
DeclareVariable("controller.P.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("controller.P.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareVariable("controller.I.n", "Number of inputs (= number of outputs)", 1, \
0.0,0.0,0.0,0,517)
DeclareVariable("controller.I.inPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.I.inPort.signal[1]", "Real input signals", \
"positionerror.outPort.signal[1]", 1, 5, 28, 4)
DeclareVariable("controller.I.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("controller.I.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareState("controller.I.y[1]", "Output signals", 3, 0, 0.0,0.0,0.0,0,624)
DeclareDerivative("controller.I.der(y[1])", "der(Output signals)", 0, 0.0,0.0,\
0.0,0,576)
DeclareAlias2("controller.I.u[1]", "Input signals", "positionerror.outPort.signal[1]", 1,\
5, 28, 1024)
DeclareVariable("controller.I.k[1]", "Integrator gains", 0, 0.0,0.0,0.0,0,577)
DeclareVariable("controller.I.y0[1]", "Start values of integrators", 0, 0.0,0.0,\
0.0,0,513)
DeclareVariable("controller.D.n", "Number of inputs (= number of outputs)", 1, \
0.0,0.0,0.0,0,517)
DeclareVariable("controller.D.inPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.D.inPort.signal[1]", "Real input signals", \
"positionerror.outPort.signal[1]", 1, 5, 28, 4)
DeclareVariable("controller.D.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("controller.D.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareVariable("controller.D.y[1]", "Output signals", 0, 0.0,0.0,0.0,0,576)
DeclareAlias2("controller.D.u[1]", "Input signals", "positionerror.outPort.signal[1]", 1,\
5, 28, 1024)
DeclareVariable("controller.D.k[1]", "Gains", 0, 0.0,0.0,0.0,0,577)
DeclareVariable("controller.D.T[1]", "Time constants (T>0 required; T=0 is ideal derivative block) [s]",\
1E-060, 1E-060,1E+100,0.0,0,577)
DeclareState("controller.D.x[1]", "State of block", 4, 0, 0.0,0.0,0.0,0,624)
DeclareDerivative("controller.D.der(x[1])", "der(State of block)", 0, 0.0,0.0,\
0.0,0,576)
DeclareVariable("controller.D.p_k[1]", "", 0, 0.0,0.0,0.0,0,2625)
DeclareVariable("controller.D.p_T[1]", "", 0, 0.0,0.0,0.0,0,2625)
DeclareVariable("controller.Gain.k[1]", "Gain vector multiplied element-wise with input vector",\
0, 0.0,0.0,0.0,0,577)
DeclareAlias2("controller.Gain.u[1]", "Input signals", "controller.Add.outPort.signal[1]", 1,\
5, 60, 1024)
DeclareAlias2("controller.Gain.y[1]", "Output signals", "controller.outPort.signal[1]", 1,\
5, 31, 1024)
DeclareVariable("controller.Gain.inPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.Gain.inPort.signal[1]", "Real input signals", \
"controller.Add.outPort.signal[1]", 1, 5, 60, 4)
DeclareVariable("controller.Gain.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("controller.Gain.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareParameter("controller.Add.k1", "Gain of upper input", 12, 1, 0.0,0.0,0.0,\
0,624)
DeclareParameter("controller.Add.k2", "Gain of middle input", 13, 1, 0.0,0.0,0.0,\
0,624)
DeclareParameter("controller.Add.k3", "Gain of lower input", 14, 1, 0.0,0.0,0.0,\
0,624)
DeclareVariable("controller.Add.n", "Dimension of input and output vectors.", 1,\
0.0,0.0,0.0,0,517)
DeclareVariable("controller.Add.inPort1.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.Add.inPort1.signal[1]", "Real input signals", \
"controller.P.outPort.signal[1]", 1, 5, 35, 4)
DeclareVariable("controller.Add.inPort2.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.Add.inPort2.signal[1]", "Real input signals", \
"controller.I.y[1]", 1, 1, 3, 4)
DeclareVariable("controller.Add.inPort3.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareAlias2("controller.Add.inPort3.signal[1]", "Real input signals", \
"controller.D.y[1]", 1, 5, 46, 4)
DeclareVariable("controller.Add.outPort.n", "Dimension of signal vector", 1, \
0.0,0.0,0.0,0,525)
DeclareVariable("controller.Add.outPort.signal[1]", "Real output signals", 0, \
0.0,0.0,0.0,0,584)
DeclareVariable("Step1.nout", "Number of outputs", 1, 1.0,1E+100,0.0,0,517)
DeclareVariable("Step1.outPort.n", "Dimension of signal vector", 1, 0.0,0.0,0.0,\
0,525)
DeclareVariable("Step1.outPort.signal[1]", "Real output signals", 0, 0.0,0.0,0.0,\
0,712)
DeclareVariable("Step1.y[1]", "", 0, 0.0,0.0,0.0,0,704)
DeclareParameter("Step1.offset[1]", "offset of output signal", 15, 0, 0.0,0.0,\
0.0,0,624)
DeclareParameter("Step1.startTime[1]", "output = offset for time < startTime [s]",\
16, 0, 0.0,0.0,0.0,0,624)
DeclareParameter("Step1.height[1]", "Heights of steps", 17, 1, 0.0,0.0,0.0,0,624)
DeclareVariable("Step1.p_height[1]", "", 0, 0.0,0.0,0.0,0,2625)
DeclareVariable("Step1.p_offset[1]", "", 0, 0.0,0.0,0.0,0,2625)
DeclareVariable("Step1.p_startTime[1]", "[s]", 0, 0.0,0.0,0.0,0,2625)
EndNonAlias(0)
#define NX_ 5
#define NX2_ 0
#define NU_ 0
#define NY_ 0
#define NW_ 68
#define NP_ 18
#define NPS_ 0
#define NI_ 0
#define NRelF_ 0
#define NRel_ 0
#define NTim_ 1
#define NSamp_ 0
#define NCons_ 0
#define NA_ 57
#define SizePre_ 0
#define SizeEq_ 2
#define SizeDelay_ 0
#define QNLmax_ 0
#define MAXAux 0
#define NrDymolaTimers_ 0
#define NWhen_ 0
#define NCheckIf_ 0
#define NGlobalHelp_ 1
#define NExternalObject_0
#include <dsblock5.c>
StartDataBlock
StartEqBlock
DoRemember_(load_der_w, 0, 0);
DoRemember_(motor_La_der_i, 0, 1);
EndEqBlock
EndDataBlock
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -