Skip to content

Commit

Permalink
PCF value for testing
Browse files Browse the repository at this point in the history
Property with total PCF value
GET by API for automatic testing
  • Loading branch information
aorzelskiGH committed Jul 4, 2024
1 parent dc0ade4 commit 51cdedb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/AasxServerBlazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
},
"AasxServerBlazor": {
"commandName": "Project",
"commandLineArgs": "--no-security --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"\\\\wsl.localhost\\Ubuntu\\home\\oze\\Integration-Plugfest\\aasxs-registry\" --edit --external-blazor http://localhost:5001",
"commandLineArgs": "--no-security --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"C:\\Development\\PCF View\" --edit --external-blazor http://localhost:5001",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"AASREGISTRY": "http://localhost:50001",
"AASREGISTRY": "https://registry.dpp40-2-v2.industrialdigitaltwin.org/",
"IFRAMEPATH": "https://dpp40-2-v2.industrialdigitaltwin.org/dashboard/submodelViewV3.html"
},
"applicationUrl": "http://localhost:5001",
Expand Down
35 changes: 31 additions & 4 deletions src/AasxServerStandardBib/SecurityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,7 @@ public class cfpNode

public static cfpNode root = null;
public static string asbuilt_total = null;
public static Property pCO2eqTotal = null;
public static bool cfpValid = false;
public static DateTime lastCreateTimestamp = new DateTime();
public static bool credentialsChanged = false;
Expand Down Expand Up @@ -1754,7 +1755,8 @@ public static bool createCfpTree(int envIndex, DateTime timeStamp)
Dictionary<string, cfpNode> assetCfp = new Dictionary<string, cfpNode>();
// cfpNode root = new cfpNode();
aascount = AasxServer.Program.env.Length;
root = null;
root = null;
ISubmodel co2eqSubmodel = null;

// Collect data from all AAS into cfpNode(s)
for (int i = 0; i < aascount; i++)
Expand Down Expand Up @@ -1789,7 +1791,8 @@ public static bool createCfpTree(int envIndex, DateTime timeStamp)
}

if (sm.SubmodelElements != null)
{
{
co2eqSubmodel = sm;
foreach (var v in sm.SubmodelElements)
{
if (v is SubmodelElementCollection c)
Expand All @@ -1806,7 +1809,7 @@ public static bool createCfpTree(int envIndex, DateTime timeStamp)
case "LifeCyclePhase":
lifeCyclePhase = v2.ValueAsText();
break;
case "CO2eq":
case "CO2eq":
co2eq = v2 as Property;
break;
}
Expand Down Expand Up @@ -1874,6 +1877,7 @@ public static bool createCfpTree(int envIndex, DateTime timeStamp)

if (sm.SubmodelElements != null)
{
co2eqSubmodel = sm;
foreach (var v in sm.SubmodelElements)
{
if (v is SubmodelElementCollection c)
Expand Down Expand Up @@ -2111,7 +2115,26 @@ public static bool createCfpTree(int envIndex, DateTime timeStamp)
{
//TODO: elements need proper deep clone method implemented within AAS metamodel classes
if (asbuilt_total == null)
asbuilt_total = new String(root.cradleToGateCombination.Value);
asbuilt_total = new String(root.cradleToGateCombination.Value);
if (co2eqSubmodel != null)
{
pCO2eqTotal = null;
foreach (var sme in co2eqSubmodel.SubmodelElements)
{
if (sme is Property p && p.IdShort == "CO2eqTotal")
{
pCO2eqTotal = p;
}
}
if (pCO2eqTotal == null)
{
pCO2eqTotal = new Property(DataTypeDefXsd.String, idShort: "CO2eqTotal");
co2eqSubmodel.SubmodelElements.Add(pCO2eqTotal);
pCO2eqTotal.SetAllParentsAndTimestamps(co2eqSubmodel, timeStamp, co2eqSubmodel.TimeStampCreate);
pCO2eqTotal.SetTimeStamp(timeStamp);
pCO2eqTotal.Value = "0";
}
}
}

if (Program.showWeight && root.weightCombination != null)
Expand Down Expand Up @@ -2339,6 +2362,10 @@ public static void operation_calculate_cfp(Operation op, int envIndex, DateTime
}
}

if (pCO2eqTotal != null)
{
pCO2eqTotal.Value = root.cradleToGateCombination.Value;
}
// once = true;
// if (root != null && root.bomTimestamp > lastCreateTimestamp)
if (changed || credentialsChanged)
Expand Down

0 comments on commit 51cdedb

Please sign in to comment.