ModelicaBook icon indicating copy to clipboard operation
ModelicaBook copied to clipboard

Invalid import clause in ThirdSpecies

Open henrikt-ma opened this issue 4 months ago • 0 comments

The import clause in ModelicaByExample.Components.LotkaVolterra.Examples.ThirdSpecies is invalid; quoting System Modeler:

Error: ModelicaByExample.Components.LotkaVolterra.Examples.ThirdSpecies [2:3-2:3] Invalid qualified import. ModelicaByExample.Components.LotkaVolterra.Components.RegionalPopulation.InitializationOptions.FixedPopulation is an enumeration element and ModelicaByExample.Components.LotkaVolterra.Components.RegionalPopulation.InitializationOptions is a type but a qualified import must reference a package or a package element.

A simple fix is to simply not do the import:

--- a/ModelicaByExample/Components/LotkaVolterra/Examples/ThirdSpecies.mo
+++ b/ModelicaByExample/Components/LotkaVolterra/Examples/ThirdSpecies.mo
@@ -1,8 +1,7 @@
 within ModelicaByExample.Components.LotkaVolterra.Examples;
 model ThirdSpecies "Adding a third species to Lotka-Volterra"
-  import ModelicaByExample.Components.LotkaVolterra.Components.RegionalPopulation.InitializationOptions.FixedPopulation;
   extends ClassicLotkaVolterra(rabbits(initial_population=25), foxes(initial_population=2));
-  Components.RegionalPopulation wolves(init=FixedPopulation, initial_population=4)
+  Components.RegionalPopulation wolves(init=Components.RegionalPopulation.InitializationOptions.FixedPopulation, initial_population=4)
     annotation (Placement(transformation(extent={{30,40},{50,60}})));
   Components.Starvation wolf_starvation(gamma=0.4)
     annotation (Placement(transformation(extent={{70,40},{90,60}})));

henrikt-ma avatar Oct 10 '24 10:10 henrikt-ma