Hello, I am trying to connect the grid to a line in the modelica building.electrical library. I get this error:
[2] 18:20:02 Translation Error [Buildings.Electrical.AC.ThreePhasesBalanced.Lines.Line: 4:5-4:47]: Type mismatch in binding terminal_n = grid_connection, expected subtype of Buildings.Electrical.AC.ThreePhasesBalanced.Interfaces.Terminal_n, got type Buildings.Electrical.AC.ThreePhasesBalanced.Sources.Grid
I found this unusual since I am connecting it like the example which does not have an error
My code:
model building
Buildings.Electrical.AC.ThreePhasesBalanced.Sources.Grid grid_connection annotation(
Placement(visible = true, transformation(origin = {-82, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Buildings.Electrical.AC.ThreePhasesBalanced.Sources.PVSimpleOriented solar_array(A = 10) annotation(
Placement(visible = true, transformation(origin = {-106, 12}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Buildings.Electrical.AC.ThreePhasesBalanced.Loads.Resistive building_load annotation(
Placement(visible = true, transformation(origin = {-4, 12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Buildings.Electrical.AC.ThreePhasesBalanced.Storage.Battery BESS(EMax = 1800000000, SOC_start = 20) annotation(
Placement(visible = true, transformation(origin = {-82, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
Buildings.Electrical.AC.ThreePhasesBalanced.Lines.Line grid_line(terminal_n = grid_connection) annotation(
Placement(visible = true, transformation(origin = {-40, 12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weather_data(filNam = "weather.mos") annotation(
Placement(visible = true, transformation(origin = {-184, 4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.CombiTimeTable load_data(columns = 15:44640, fileName = "data.txt", tableOnFile = true, timeScale = 60, verboseRead = true) annotation(
Placement(visible = true, transformation(origin = {29, 13}, extent = {{9, -9}, {-9, 9}}, rotation = 0)));
Modelica.Blocks.Sources.CombiTimeTable bess_data annotation(
Placement(visible = true, transformation(origin = {-48, -46}, extent = {{8, -8}, {-8, 8}}, rotation = 0)));
equation
connect(BESS.terminal, grid_line.terminal_n) annotation(
Line(points = {{-82, -36}, {-48, -36}, {-48, 12}, {-50, 12}}, color = {255, 255, 255}));
connect(grid_line.terminal_n, BESS.terminal) annotation(
Line(points = {{-50, 12}, {-82, 12}, {-82, -36}}));
connect(grid_line.terminal_n, solar_array.terminal) annotation(
Line(points = {{-50, 12}, {-96, 12}}));
connect(grid_line.terminal_p, building_load.terminal) annotation(
Line(points = {{-30, 12}, {-14, 12}}));
connect(load_data.y, building_load.Pow) annotation(
Line(points = {{19, 13}, {13.5, 13}, {13.5, 12}, {6, 12}}, color = {0, 0, 127}));
connect(bess_data.y, BESS.P) annotation(
Line(points = {{-56, -46}, {-72, -46}}, color = {0, 0, 127}));
connect(weather_data.weaBus, solar_array.weaBus) annotation();
annotation(
uses(Buildings(version = "9.1.0"), Modelica(version = "4.0.0")));
end building;
Example Code:
within Buildings.Electrical.Examples;
model RenewableSources
AC.ThreePhasesBalanced.Sources.Grid gri(
f=f,
V=V_nominal,
phiSou=0) "Grid model that provides power to the system"
AC.ThreePhasesBalanced.Lines.Line line1(mode=Buildings.Electrical.Types.CableMode.automatic,
l=1500,
V_nominal=V_nominal,
P_nominal=7*(PLoa_nominal + PSun) + PWin) "Electrical line"
annotation (Placement(transformation(extent={{-80,10},{-60,30}})));
equation
connect(gri.terminal, line1.terminal_n) annotation (Line(
points={{-90,40},{-90,20},{-80,20}},
color={0,120,120},
smooth=Smooth.None));
Thank you for all the help