- Index
- » Users
- » nugrohoav
- » Profile
Posts
Posts
Hi, I'm learning about writing equations in open modelica.
The following is the program code of Modelica.Electrical.Analog.Sources.StepVoltage
Code:
class Modelica.Electrical.Analog.Sources.StepVoltage "Step voltage source"
Real v(quantity = "ElectricPotential", unit = "V") "Voltage drop between the two pins (= p.v - n.v)";
Real i(quantity = "ElectricCurrent", unit = "A") "Current flowing from pin p to pin n";
Real p.v(quantity = "ElectricPotential", unit = "V") "Potential at the pin";
Real p.i(quantity = "ElectricCurrent", unit = "A") "Current flowing into the pin";
Real n.v(quantity = "ElectricPotential", unit = "V") "Potential at the pin";
Real n.i(quantity = "ElectricCurrent", unit = "A") "Current flowing into the pin";
parameter Real offset(quantity = "ElectricPotential", unit = "V") = 0.0 "Voltage offset";
parameter Real startTime(quantity = "Time", unit = "s") = 0.0 "Time offset";
Real signalSource.y "Connector of Real output signal";
parameter Real signalSource.offset = offset "Offset of output signal y";
parameter Real signalSource.startTime(quantity = "Time", unit = "s") = startTime "Output y = offset for time < startTime";
parameter Real signalSource.height = V "Height of step";
parameter Real V(quantity = "ElectricPotential", unit = "V", start = 1.0) "Height of step";
equation
signalSource.y = signalSource.offset + (if time < signalSource.startTime then 0.0 else signalSource.height);
v = signalSource.y;
v = p.v - n.v;
0.0 = p.i + n.i;
i = p.i;
p.i = 0.0;
n.i = 0.0;
end Modelica.Electrical.Analog.Sources.StepVoltage;
I want to know the explanation in the following sections :
Code:
v = signalSource.y;
v = p.v - n.v;
1.Why does the "v" expression need to be written twice?
Code:
p.i = 0.0;
n.i = 0.0;
2. What is the purpose of having these two lines of code ? Why are the two lines of code written at the end?
Thank you
Ok, I will try. Thank you...
Yes, I tried that. I only managed to plot the Voltage VS Current. I don't know yet how to plot Power (W) vs Voltage (V). I think I need to calculate the power value (P = V x I) first. Can that be done in the "Plotting" perspectiv?
I have download openmodelica repo in this link : PVSystems Repo.
I have run a PVarray verification simulation [/PVSystems/Examples/Verification/PVArrayVerification]. I want to plot Power (W) vs Voltage (V) as in the picture :. How to do that?
Thank you
- Index
- » Users
- » nugrohoav
- » Profile