Skip to content

Commit

Permalink
Updated references to Scen-verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplisticCode committed Dec 18, 2023
1 parent 2523491 commit 82640b8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.spencerwi.either.Either;
import org.intocps.verification.scenarioverifier.core.MasterModel;
import org.intocps.verification.scenarioverifier.core.masterModel.MasterModel;
import org.intocps.verification.scenarioverifier.core.ScenarioLoader;
import org.apache.commons.lang3.tuple.Pair;
import org.intocps.maestro.Mabl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.intocps.verification.scenarioverifier.core.*;
import org.intocps.verification.scenarioverifier.core.masterModel.*;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.intocps.maestro.Mabl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.intocps.maestro.template;

import org.intocps.verification.scenarioverifier.core.MasterModel;
import org.intocps.verification.scenarioverifier.core.masterModel.MasterModel;
import org.apache.commons.lang3.tuple.Pair;
import org.intocps.maestro.core.Framework;
import org.intocps.maestro.framework.fmi2.Fmi2SimulationEnvironment;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.intocps.maestro.template;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.intocps.verification.scenarioverifier.core.MasterModel;
import org.intocps.verification.scenarioverifier.core.masterModel.MasterModel;
import org.apache.commons.text.StringEscapeUtils;
import org.intocps.maestro.ast.LexIdentifier;
import org.intocps.maestro.ast.MableAstFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.intocps.verification.scenarioverifier.core.MasterModel;
import org.intocps.verification.scenarioverifier.core.masterModel.MasterModel;
import org.intocps.verification.scenarioverifier.core.ScenarioLoader;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.tuple.Pair;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.jdk.javaapi.CollectionConverters;
import org.intocps.verification.scenarioverifier.core.*;
import org.intocps.verification.scenarioverifier.core.masterModel.*;
import org.intocps.verification.scenarioverifier.core.masterModel.*;
import org.intocps.verification.scenarioverifier.synthesizer.LoopStrategy;
import org.intocps.verification.scenarioverifier.synthesizer.SynthesizerSimple;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import org.intocps.maestro.framework.fmi2.Fmi2SimulationEnvironment
import org.intocps.maestro.framework.fmi2.Fmi2SimulationEnvironmentConfiguration
import scala.jdk.javaapi.CollectionConverters
import org.intocps.verification.scenarioverifier.api.GenerationAPI
import org.intocps.verification.scenarioverifier.core.*
import org.intocps.verification.scenarioverifier.core.masterModel.*

class MasterModelMapper {
companion object {

private fun getFmuNameFromFmuInstanceName(name: String): String {
return name.split(Sigver.MASTER_MODEL_FMU_INSTANCE_DELIMITER)[0]
}
Expand All @@ -29,12 +28,18 @@ class MasterModelMapper {
return name.split(Sigver.MULTI_MODEL_FMU_INSTANCE_DELIMITER).let { it.subList(2, it.size).joinToString(Sigver.MULTI_MODEL_FMU_INSTANCE_DELIMITER) }
}

fun scenarioToMasterModel(scenario: String): MasterModel {
fun scenarioToFMI2MasterModel(scenario: String): MasterModel {
// Load master model without algorithm
val masterModel = ScenarioLoader.load(scenario.byteInputStream())
return GenerationAPI.synthesizeAlgorithm(masterModel.name(), masterModel.scenario())
}

fun scenarioToFMI3MasterModel(scenario: String): MasterModel3 {
// Load master model without algorithm
val masterModel = ScenarioLoader_FMI3.load(scenario.byteInputStream())
return GenerationAPI.synthesizeAlgorithm(masterModel.name(), masterModel.scenario())
}

fun masterModelConnectionsToMultiModelConnections(masterModel: MasterModel): HashMap<String, MutableList<String>> {
// Setup connections as defined in the scenario (These should be identical to the multi-model)
return CollectionConverters.asJava(masterModel.scenario().connections())
Expand Down

0 comments on commit 82640b8

Please sign in to comment.