-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves #2957 - Batteries #3054
Conversation
So we need library officers for Electrical.Batteries. According to our project rules we have:
Since you have signed the MA CLA I believe it is enough if you just mention the two or more new library officers. I also will create a new label for Electrical.Batteries. |
Library Officers: @AHaumer and @christiankral , both have alreay signed the CLA. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, both Modelica.Electrical.Batteries.Examples.BatteryDischargeCharge and Modelica.Electrical.Batteries.Examples.CCCVcharging abort simulation in SimulationX 4.0.2 by
cellData.rcData[1].C=Modelica.Electrical.Batteries.ParameterRecords.RCData.Tau*Modelica.Electrical.Batteries.ParameterRecords.RCData.R^-1;
Invalid call of operator "/" (0/0).
Help: Eval.InvalidBinOp
In more detail:
(cellData.Ri|0.0035000000000000001):=(cellData.OCVmax|4.2000000000000002)/(cellData.Isc|1200)
(cellData.rcData[1].R|0.0007000000000000001):=0.20000000000000001*(cellData.Ri|0.0035000000000000001)
(cellData.rcData[2].R|0.00035000000000000005):=0.10000000000000001*(cellData.Ri|0.0035000000000000001)
(cellData.rcData[1].C|0)=(Modelica.Electrical.Batteries.ParameterRecords.RCData.Tau|0)/(Modelica.Electrical.Batteries.ParameterRecords.RCData.R|0)
EXCEPTION:
Invalid call of operator "/" (0/0).
ID: Eval.InvalidBinOp
In the initial system, it calculates the correct value cellData.rcData[1].R, but does not use this value when calculating cellData.rcData[1].C. Thus there seems to be some lookup issue. @gkurzbach Can you elaborate please.
By the way, referencing the component name in the modification is ugly and error-prone
parameter ParameterRecords.ExampleData cellData2( Qnom=18000, useLinearSOCDependency=false, Idis=0.1, Isc=1200, rcData={Batteries.ParameterRecords.RCData(R=0.2*cellData2.Ri, Tau=60), Batteries.ParameterRecords.RCData(R=0.1*cellData2.Ri, Tau=10)}) annotation (Placement(transformation(extent={{60,-80},{80,-60}})));
and should not be promoted. Unfortunately the modelica/ModelicaSpecification#213 proposal using the self-keyword (which resolved the issue) never made it in the Modelica specification.
@beutlich regarding 0/0: Regarding rcData={Batteries.ParameterRecords.RCData(R=0.2cellData2.Ri, Tau=60), |
@beutlich would you please try again, I hope the problem 0/0 is cured. |
Yes, it is resolved, but disguising the actual tool issue, since cellData.rcData[1].C should not be zero in the initial step, right? (cellData.Ri|0.0035000000000000001):=(cellData.OCVmax|4.2000000000000002)/(cellData.Isc|1200) (cellData.rcData[1].R|0.0007000000000000001):=0.20000000000000001*(cellData.Ri|0.0035000000000000001) (cellData.rcData[2].R|0.00035000000000000005):=0.10000000000000001*(cellData.Ri|0.0035000000000000001) (cellData.rcData[1].C|0):=(if ((Modelica.Electrical.Batteries.ParameterRecords.RCData.R|0)<=0)|true then 0 else(Modelica.Electrical.Batteries.ParameterRecords.RCData.T|0)/(Modelica.Electrical.Batteries.ParameterRecords.RCData.R|0))
Not the array of records is the issue, but using the component name in the modifier again. See the bold names in the lines above. |
I tested
I guess this is a tool issue of the new frontend, as the parameter parameter ParameterRecords.ExampleData cellData2(
Qnom=18000,
useLinearSOCDependency=false,
Idis=0.1,
Isc=1200,
rcData={Modelica.Electrical.Batteries.ParameterRecords.RCData(R=0.2*
cellData2.Ri, T=60),
Modelica.Electrical.Batteries.ParameterRecords.RCData(R=0.1*
cellData2.Ri, T=10)}) |
As this a is a new package you could actually introduce the |
I created ticket OM#5597 on the OpenModelica issue tracker regarding the two examples which do not simulate. |
In Dymola and OM all three examples simulate without any complaint. |
@beutlich I'm afraid I don't understand the issue with C=0: |
Don't worry. I need some feedback from the SimulationX frontend dev @gkurzbach here if the tool issue can be confirmed. |
@henrikt-ma The three Batteries examples have various validaton/simulation issues in Wolfram SystemModeler. Can you have a look at it? |
I confirm that the "Invalid call of operator "/" (0/0)" is a tool issue. The original code is fine and the additional modifications are not necessary. This will be fixed in next release. |
Thanks for confirmation, @gkurzbach . @AHaumer Your commit 21d2b55 can be reverted as it only disguises the tool issue (0/0) but still yields wrong simulation results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21d2b55 should be reverted.
@christiankral @christophclauss Never mind my previous comment. Can you please review the proposed changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK now.
Resolved the merge commit via rebasing and force-pushing. |
This resolves #2957 - Batteries.
As I said before, I got some results from master thesis, ending up in improved cell and stack models.
Since the whole thing has grown, I vote for moving Batteries out from Analog to an own sublibrary Electrical.Batteries.
This answers questions from users regarding Modelica_EnergyStorages, which shall be replaced by this library in the long run - simpler and easier to use. We hope to get suggestions for improvements from users.